@brightlayer-ui/react-native-template-blank-typescript 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ ## v2.0.0 (Not yet published)
4
+
5
+ ### Changed
6
+
7
+ - Changed package namespace from `@pxblue` to `@brightlayer-ui`.
8
+
9
+ ## Package Migration Notice
10
+
11
+ Previous versions listed after this indicator refer to our deprecated `@pxblue` packages.
12
+
13
+ ---
14
+
15
+ ## v2.0.0 (November 3, 2021)
16
+
17
+ ### Changed
18
+
19
+ - Updated to use latest APIs from `@pxblue/react-native-components`.
20
+
21
+ ## v1.3.1 (October 1, 2021)
22
+
23
+ ### Fixed
24
+
25
+ - Added dependency for `@pxblue/react-native-vector-icons`
26
+
27
+ ## v1.3.0 (September 30, 2021)
28
+
29
+ ### Changed
30
+ - Upgrade PX Blue packages
31
+
32
+ ## v1.2.0 (July 26, 2021)
33
+
34
+ ### Changed
35
+ - Updated version of react-native-modal dependency to 12.0.2
36
+
37
+ ## v1.1.0 (March 31, 2021)
38
+
39
+ ### Changed
40
+ - Updated dependencies to use latest packages.
41
+
42
+ ### Fixed
43
+ - Jest configuration allows default tests to pass.
44
+
45
+ ## v1.0.0 (March 1, 2021)
46
+
47
+ ### Added
48
+ - Initial blank template for TypeScript projects
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Blank Template (TypeScript)
2
+
3
+ ![npm (scoped)](https://img.shields.io/npm/v/@brightlayer-ui/react-native-template-blank-typescript?color=%23007bc1&label=%40brightlayer-ui%2Freact-native-template-blank-typescript)
4
+
5
+ This is an official Brightlayer UI template used internally by the [Brightlayer UI CLI](https://www.npmjs.com/package/@brightlayer-ui/cli).
6
+
7
+ This template installs the basic Brightlayer UI libraries for themes and components and configures the application to use them. It includes a simple placeholder screen that you can replace with your own application content.
8
+
9
+ ## Usage
10
+ This template can be used with the Brightlayer UI CLI:
11
+ ```sh
12
+ npx -p @brightlayer-ui/cli blui new react-native --name=myapp --cli=rnc --language=ts --template=blank
13
+ ```
14
+
15
+ ## Project Structure
16
+ Projects created using this template will start out with the following file structure:
17
+
18
+ ```
19
+ |── /ios // ios project folder
20
+ |── /android // android project folder
21
+ |── /assets // fonts and images used by the application
22
+ └── App.tsx // sample landing page
23
+ ```
@@ -0,0 +1,17 @@
1
+ {
2
+ "dependencies": [
3
+ "@brightlayer-ui/react-native-themes@^6.0.0",
4
+ "@brightlayer-ui/colors@^3.0.1",
5
+ "@brightlayer-ui/react-native-components@^6.0.1",
6
+ "@brightlayer-ui/react-native-vector-icons@^1.4.0",
7
+ "react-native-modal@^12.0.2",
8
+ "react-native-paper@^4.7.2",
9
+ "@brightlayer-ui/icons-svg@^1.8.0",
10
+ "react-native-vector-icons@^8.0.0",
11
+ "react-native-svg@^12.1.0",
12
+ "react-native-gesture-handler@^1.10.2",
13
+ "react-native-svg-transformer@^0.14.3",
14
+ "react-native-safe-area-context@^3.2.0"
15
+ ],
16
+ "devDependencies": ["@types/react-native-vector-icons", "jest-transform-stub"]
17
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 82 82" width='82' height='82'>
3
+
4
+ <ellipse cx="41" cy="41" rx="11.2" ry="11.1"/>
5
+ <path d="M72.7,33.9c2.4,10.9-0.8,22.1-8.7,30C51.4,76.6,30.8,76.6,18.2,64S5.4,30.8,18,18.1c5-5,11.4-8.2,18.4-9.2
6
+ c0.3,0.9,0.8,1.8,1.5,2.5c2.3,2.3,6.1,2.3,8.4,0c0.9-0.9,1.5-2.1,1.7-3.5l0,0c0.2-1.8-0.4-3.6-1.7-4.9c-2.3-2.3-6.1-2.3-8.4,0
7
+ c-0.9,0.9-1.5,2.1-1.7,3.3c-7.6,1-14.6,4.6-20,10C2.6,30,2.7,52.2,16.3,65.8s35.9,13.6,49.5-0.1c8.4-8.5,11.9-20.5,9.4-32.2l0,0
8
+ c-1.4-6.4-4.8-12.1-9.5-16.8l0,0C65.7,16.7,71.2,23.3,72.7,33.9z M37.4,7.5L37.4,7.5L37.4,7.5L37.4,7.5z M45.5,7.6
9
+ c-0.1,0.8-0.4,1.5-1,2.1c-1.4,1.4-3.6,1.4-4.9,0c-0.6-0.6-1-1.4-1-2.3l0,0c-0.1-1,0.3-2,1-2.7c1.4-1.4,3.6-1.4,4.9,0
10
+ C45.3,5.5,45.7,6.6,45.5,7.6z"/>
11
+ </svg>
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@brightlayer-ui/react-native-template-blank-typescript",
3
+ "version": "2.0.0-beta.0",
4
+ "author": "brightlayer-ui <brightlayer-ui@eaton.com>",
5
+ "keywords": [
6
+ "react native",
7
+ "template",
8
+ "brightlayer-ui",
9
+ "Brightlayer UI",
10
+ "cli"
11
+ ],
12
+ "description": "The base template for React Native projects created with the Brightlayer UI CLI.",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/brightlayer-ui/react-native-cli-templates.git"
16
+ },
17
+ "scripts": {
18
+ "publish:package": "set npm_config_yes=true && npx -p @brightlayer-ui/publish blui-publish",
19
+ "tag:package": "set npm_config_yes=true && npx -p @brightlayer-ui/tag blui-tag"
20
+ },
21
+ "license": "BSD-3-Clause",
22
+ "engines": {
23
+ "node": ">=10"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/brightlayer-ui/react-native-cli-templates/issues"
27
+ }
28
+ }
@@ -0,0 +1,161 @@
1
+ /**
2
+ Copyright (c) 2021-present, Eaton
3
+
4
+ All rights reserved.
5
+
6
+ This code is licensed under the BSD-3 license found in the LICENSE file in the root directory of this source tree and at https://opensource.org/licenses/BSD-3-Clause.
7
+ **/
8
+ import React, { useCallback } from 'react';
9
+ import {
10
+ SafeAreaView,
11
+ ScrollView,
12
+ StyleSheet,
13
+ Linking,
14
+ TextStyle,
15
+ ViewStyle,
16
+ View,
17
+ Animated,
18
+ Easing,
19
+ } from 'react-native';
20
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
21
+ import { Button, Divider, Provider as ThemeProvider, useTheme } from 'react-native-paper';
22
+ import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
23
+ import { Body1, Header, H4 } from '@brightlayer-ui/react-native-components';
24
+ import { Theme } from 'react-native-paper/lib/typescript/types';
25
+ import Logo from './assets/images/Logo.svg';
26
+
27
+ const styles = (
28
+ theme: Theme
29
+ ): StyleSheet.NamedStyles<{
30
+ content: ViewStyle;
31
+ pxbLogoWrapper: ViewStyle;
32
+ pxbLogo: ViewStyle;
33
+ title: TextStyle;
34
+ subtitle: TextStyle;
35
+ bold: TextStyle;
36
+ divider: ViewStyle;
37
+ openURLButtonText: TextStyle;
38
+ }> =>
39
+ StyleSheet.create({
40
+ content: {
41
+ flex: 1,
42
+ },
43
+ pxbLogoWrapper: {
44
+ justifyContent: 'center',
45
+ marginTop: 16,
46
+ },
47
+ pxbLogo: {
48
+ alignSelf: 'center',
49
+ height: 100,
50
+ width: 100,
51
+ },
52
+ title: {
53
+ textAlign: 'center',
54
+ marginBottom: 16,
55
+ },
56
+ subtitle: {
57
+ textAlign: 'center',
58
+ },
59
+ bold: {
60
+ fontWeight: 'bold',
61
+ },
62
+ divider: {
63
+ marginVertical: 24,
64
+ },
65
+ openURLButtonText: {
66
+ color: theme.colors.text,
67
+ padding: 8,
68
+ },
69
+ });
70
+
71
+ const OpenURLButton = (props: any): JSX.Element => {
72
+ const { url, title } = props;
73
+ const theme = useTheme();
74
+ const defaultStyles = styles(theme);
75
+
76
+ const handlePress = useCallback(async () => {
77
+ await Linking.openURL(url);
78
+ }, [url]);
79
+
80
+ return (
81
+ <Button
82
+ onPress={(): Promise<void> => handlePress()}
83
+ labelStyle={defaultStyles.openURLButtonText}
84
+ uppercase={false}
85
+ >
86
+ {title}
87
+ </Button>
88
+ );
89
+ };
90
+
91
+ const App = (): JSX.Element => {
92
+ const theme = useTheme();
93
+ const defaultStyles = styles(theme);
94
+ const spinValue = new Animated.Value(0);
95
+
96
+ Animated.loop(
97
+ Animated.timing(spinValue, {
98
+ toValue: 1,
99
+ duration: 2500,
100
+ easing: Easing.linear,
101
+ useNativeDriver: true,
102
+ })
103
+ ).start();
104
+
105
+ const spin = spinValue.interpolate({
106
+ inputRange: [0, 1],
107
+ outputRange: ['0deg', '360deg'],
108
+ });
109
+
110
+ return (
111
+ <ThemeProvider theme={BLUIThemes.blue}>
112
+ <SafeAreaProvider>
113
+ <Header title={'Brightlayer UI React Native'} />
114
+ <SafeAreaView style={defaultStyles.content}>
115
+ <ScrollView>
116
+ <View style={defaultStyles.pxbLogoWrapper}>
117
+ <Animated.View style={[defaultStyles.pxbLogo, { transform: [{ rotate: spin }] }]}>
118
+ <Logo height={100} width={100} fill={'#007bc1'} />
119
+ </Animated.View>
120
+ </View>
121
+ <H4 style={defaultStyles.title}>
122
+ Welcome to Brightlayer <H4 color={'primary'}>UI</H4>.
123
+ </H4>
124
+ <Body1 style={defaultStyles.subtitle}>
125
+ Edit <Body1 style={defaultStyles.bold}>App.tsx</Body1> and save to reload.
126
+ </Body1>
127
+ <Divider style={defaultStyles.divider} />
128
+ <OpenURLButton
129
+ title={'Brightlayer UI Documentation'}
130
+ url={'https://brightlayer-ui.github.io/'}
131
+ />
132
+ <OpenURLButton
133
+ title={'React Native Getting Started Guide'}
134
+ url={'https://brightlayer-ui.github.io/development/frameworks-mobile/react-native'}
135
+ />
136
+ <OpenURLButton
137
+ title={'Design Pattern Descriptions'}
138
+ url={'https://brightlayer-ui.github.io/patterns'}
139
+ />
140
+ <OpenURLButton
141
+ title={'React Native Component Library'}
142
+ url={'https://brightlayer-ui-components.github.io/react-native/'}
143
+ />
144
+ <OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/brightlayer-ui'} />
145
+ <OpenURLButton
146
+ title={'Design Pattern Source on GitHub'}
147
+ url={'https://github.com/brightlayer-ui/react-native-design-patterns'}
148
+ />
149
+ <OpenURLButton title={'Release Roadmap'} url={'https://brightlayer-ui.github.io/roadmap'} />
150
+ <OpenURLButton
151
+ title={'Send Feedback or Suggestions'}
152
+ url={'https://brightlayer-ui.github.io/community/contactus'}
153
+ />
154
+ </ScrollView>
155
+ </SafeAreaView>
156
+ </SafeAreaProvider>
157
+ </ThemeProvider>
158
+ );
159
+ };
160
+
161
+ export default App;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * SVG setup to mock react components transformed into images from SVGs
3
+ * Place this file in your project's root __mocks__ directory.
4
+ * https://github.com/kristerkari/react-native-svg-transformer#usage-with-jest
5
+ */
6
+
7
+ module.exports = 'SvgMock';
8
+ module.exports.ReactComponent = 'SvgMock';
@@ -0,0 +1,2 @@
1
+ jest.useFakeTimers();
2
+ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Metro configuration for React Native
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+
8
+ const { getDefaultConfig } = require('metro-config');
9
+
10
+ module.exports = (async () => {
11
+ const {
12
+ resolver: { sourceExts, assetExts },
13
+ } = await getDefaultConfig();
14
+ return {
15
+ transformer: {
16
+ babelTransformerPath: require.resolve('react-native-svg-transformer'),
17
+ getTransformOptions: async () => ({
18
+ transform: {
19
+ experimentalImportSupport: false,
20
+ inlineRequires: true,
21
+ },
22
+ }),
23
+ },
24
+ resolver: {
25
+ assetExts: assetExts.filter((ext) => ext !== 'svg'),
26
+ sourceExts: [...sourceExts, 'svg'],
27
+ },
28
+ };
29
+ })();
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ assets: ['./assets/fonts/'],
3
+ };