@brightlayer-ui/react-native-template-blank-typescript 2.1.0-beta.0 → 3.0.0-alpha.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/README.md +3 -3
- package/package.json +3 -3
- package/template/.bundle/config +2 -0
- package/template/.eslintrc.js +57 -0
- package/template/.prettierrc.js +7 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +26 -19
- package/template/Gemfile +9 -0
- package/template/Gemfile.lock +105 -0
- package/template/README.md +79 -0
- package/template/__tests__/App.test.tsx +17 -0
- package/template/android/app/build.gradle +120 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/debug/AndroidManifest.xml +9 -0
- package/template/android/app/src/main/AndroidManifest.xml +25 -0
- package/template/android/app/src/main/java/com/blanktemplate/MainActivity.kt +22 -0
- package/template/android/app/src/main/java/com/blanktemplate/MainApplication.kt +43 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/build.gradle +21 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +41 -0
- package/template/android/gradlew +249 -0
- package/template/android/gradlew.bat +92 -0
- package/template/android/link-assets-manifest.json +25 -0
- package/template/android/settings.gradle +4 -0
- package/template/app.json +4 -0
- package/template/assets/fonts/OpenSans-Bold.ttf +0 -0
- package/template/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/template/assets/fonts/OpenSans-Light.ttf +0 -0
- package/template/assets/fonts/OpenSans-Regular.ttf +0 -0
- package/template/assets/fonts/OpenSans-SemiBold.ttf +0 -0
- package/template/assets/images/Logo.png +0 -0
- package/template/babel.config.js +3 -0
- package/template/eslint.config.mjs +10 -0
- package/template/index.js +9 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/Podfile +40 -0
- package/template/ios/Podfile.lock +1402 -0
- package/template/ios/blankTemplate/AppDelegate.h +6 -0
- package/template/ios/blankTemplate/AppDelegate.mm +31 -0
- package/template/ios/blankTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/blankTemplate/Images.xcassets/Contents.json +6 -0
- package/template/ios/blankTemplate/Info.plist +75 -0
- package/template/ios/blankTemplate/LaunchScreen.storyboard +47 -0
- package/template/ios/blankTemplate/PrivacyInfo.xcprivacy +37 -0
- package/template/ios/blankTemplate/main.m +10 -0
- package/template/ios/blankTemplate.xcodeproj/project.pbxproj +741 -0
- package/template/ios/blankTemplate.xcodeproj/xcshareddata/xcschemes/blankTemplate.xcscheme +88 -0
- package/template/ios/blankTemplate.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/blankTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/blankTemplateTests/Info.plist +24 -0
- package/template/ios/blankTemplateTests/blankTemplateTests.m +66 -0
- package/template/ios/link-assets-manifest.json +25 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +7 -25
- package/template/package.json +54 -0
- package/template/tsconfig.json +60 -0
- package/template/yarn.lock +7127 -0
- package/template.config.js +4 -0
- package/CHANGELOG.md +0 -54
- package/dependencies.json +0 -17
- package/images/Logo.svg +0 -11
- package/template/__mocks__/svgMock.js +0 -8
- package/template/jestSetupFile.js +0 -2
- package/template/react-native.config.js +0 -3
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Bold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-ExtraBold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Light.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Regular.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-SemiBold.ttf +0 -0
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
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
8
|
|
|
9
9
|
## Usage
|
|
10
|
-
|
|
10
|
+
To create a new project using the Blank Template simply run :
|
|
11
11
|
```sh
|
|
12
|
-
npx -
|
|
12
|
+
npx react-native init MyApp --template @brightlayer-ui/react-native-template-blank-typescript
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Project Structure
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlayer-ui/react-native-template-blank-typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"author": "brightlayer-ui <brightlayer-ui@eaton.com>",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react native",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"description": "The base template for React Native projects created with the Brightlayer UI CLI.",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/etn-ccis/blui-react-native-cli-templates.git"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"publish:package": "set npm_config_yes=true && npx -p @brightlayer-ui/publish blui-publish",
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"node": ">=10"
|
|
24
24
|
},
|
|
25
25
|
"bugs": {
|
|
26
|
-
"url": "https://github.com/
|
|
26
|
+
"url": "https://github.com/etn-ccis/blui-react-native-cli-templates/issues"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
parser: '@typescript-eslint/parser',
|
|
4
|
+
extends: ['@brightlayer-ui/eslint-config/tsx'],
|
|
5
|
+
parserOptions: {
|
|
6
|
+
project: './tsconfig.json',
|
|
7
|
+
},
|
|
8
|
+
plugins: ['react-hooks'],
|
|
9
|
+
rules: {
|
|
10
|
+
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
|
11
|
+
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
|
12
|
+
'react/display-name': 'off',
|
|
13
|
+
'@typescript-eslint/naming-convention': [
|
|
14
|
+
'error',
|
|
15
|
+
{
|
|
16
|
+
selector: 'default',
|
|
17
|
+
format: ['camelCase', 'PascalCase'],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
selector: 'variable',
|
|
21
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
selector: 'property',
|
|
25
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
selector: 'property',
|
|
29
|
+
format: null,
|
|
30
|
+
modifiers: ['requiresQuotes'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
selector: 'enumMember',
|
|
34
|
+
format: ['UPPER_CASE'],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
selector: 'parameter',
|
|
38
|
+
format: ['camelCase'],
|
|
39
|
+
leadingUnderscore: 'allow',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
selector: 'memberLike',
|
|
43
|
+
modifiers: ['private'],
|
|
44
|
+
format: ['camelCase'],
|
|
45
|
+
leadingUnderscore: 'require',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
selector: 'typeLike',
|
|
49
|
+
format: ['PascalCase'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
selector: 'import',
|
|
53
|
+
format: ['camelCase', 'PascalCase'],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/template/App.tsx
CHANGED
|
@@ -16,16 +16,15 @@ import {
|
|
|
16
16
|
View,
|
|
17
17
|
Animated,
|
|
18
18
|
Easing,
|
|
19
|
+
Image,
|
|
19
20
|
} from 'react-native';
|
|
20
21
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
21
|
-
import { Button, Divider, Provider as ThemeProvider
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import { Theme } from 'react-native-paper/lib/typescript/types';
|
|
25
|
-
import Logo from './assets/images/Logo.svg';
|
|
22
|
+
import { Button, Divider, Text, Provider as ThemeProvider } from 'react-native-paper';
|
|
23
|
+
import { ExtendedTheme, useExtendedTheme, blue } from '@brightlayer-ui/react-native-themes';
|
|
24
|
+
import { Header } from '@brightlayer-ui/react-native-components';
|
|
26
25
|
|
|
27
26
|
const styles = (
|
|
28
|
-
theme:
|
|
27
|
+
theme: ExtendedTheme
|
|
29
28
|
): StyleSheet.NamedStyles<{
|
|
30
29
|
content: ViewStyle;
|
|
31
30
|
pxbLogoWrapper: ViewStyle;
|
|
@@ -63,14 +62,14 @@ const styles = (
|
|
|
63
62
|
marginVertical: 24,
|
|
64
63
|
},
|
|
65
64
|
openURLButtonText: {
|
|
66
|
-
color: theme.colors.
|
|
65
|
+
color: theme.colors.primary,
|
|
67
66
|
padding: 8,
|
|
68
67
|
},
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
const OpenURLButton = (props: any): JSX.Element => {
|
|
72
71
|
const { url, title } = props;
|
|
73
|
-
const theme =
|
|
72
|
+
const theme = useExtendedTheme();
|
|
74
73
|
const defaultStyles = styles(theme);
|
|
75
74
|
|
|
76
75
|
const handlePress = useCallback(async () => {
|
|
@@ -89,7 +88,7 @@ const OpenURLButton = (props: any): JSX.Element => {
|
|
|
89
88
|
};
|
|
90
89
|
|
|
91
90
|
const App = (): JSX.Element => {
|
|
92
|
-
const theme =
|
|
91
|
+
const theme = useExtendedTheme();
|
|
93
92
|
const defaultStyles = styles(theme);
|
|
94
93
|
const spinValue = new Animated.Value(0);
|
|
95
94
|
|
|
@@ -108,22 +107,30 @@ const App = (): JSX.Element => {
|
|
|
108
107
|
});
|
|
109
108
|
|
|
110
109
|
return (
|
|
111
|
-
<ThemeProvider theme={
|
|
110
|
+
<ThemeProvider theme={blue}>
|
|
112
111
|
<SafeAreaProvider>
|
|
113
112
|
<Header title={'Brightlayer UI React Native'} />
|
|
114
113
|
<SafeAreaView style={defaultStyles.content}>
|
|
115
114
|
<ScrollView>
|
|
116
115
|
<View style={defaultStyles.pxbLogoWrapper}>
|
|
117
116
|
<Animated.View style={[defaultStyles.pxbLogo, { transform: [{ rotate: spin }] }]}>
|
|
118
|
-
<
|
|
117
|
+
<Image source={require('./assets/images/Logo.png')} />
|
|
119
118
|
</Animated.View>
|
|
120
119
|
</View>
|
|
121
|
-
<
|
|
122
|
-
Welcome to Brightlayer
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
<Text variant={'headlineLarge'} style={defaultStyles.title}>
|
|
121
|
+
Welcome to Brightlayer{' '}
|
|
122
|
+
<Text variant={'headlineLarge'} style={{ fontSize: 34, color: theme.colors.primary }}>
|
|
123
|
+
UI
|
|
124
|
+
</Text>
|
|
125
|
+
.
|
|
126
|
+
</Text>
|
|
127
|
+
<Text variant={'bodyLarge'} style={defaultStyles.subtitle}>
|
|
128
|
+
Edit{' '}
|
|
129
|
+
<Text variant={'bodyLarge'} style={defaultStyles.bold}>
|
|
130
|
+
App.tsx
|
|
131
|
+
</Text>{' '}
|
|
132
|
+
and save to reload.
|
|
133
|
+
</Text>
|
|
127
134
|
<Divider style={defaultStyles.divider} />
|
|
128
135
|
<OpenURLButton
|
|
129
136
|
title={'Brightlayer UI Documentation'}
|
|
@@ -141,10 +148,10 @@ const App = (): JSX.Element => {
|
|
|
141
148
|
title={'React Native Component Library'}
|
|
142
149
|
url={'https://brightlayer-ui-components.github.io/react-native/'}
|
|
143
150
|
/>
|
|
144
|
-
<OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/
|
|
151
|
+
<OpenURLButton title={'Visit Us on GitHub'} url={'https://github.com/etn-ccis?q=blui'} />
|
|
145
152
|
<OpenURLButton
|
|
146
153
|
title={'Design Pattern Source on GitHub'}
|
|
147
|
-
url={'https://github.com/
|
|
154
|
+
url={'https://github.com/etn-ccis/blui-react-native-design-patterns'}
|
|
148
155
|
/>
|
|
149
156
|
<OpenURLButton title={'Release Roadmap'} url={'https://brightlayer-ui.github.io/roadmap'} />
|
|
150
157
|
<OpenURLButton
|
package/template/Gemfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
|
+
|
|
6
|
+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
|
|
7
|
+
# bound in the template on Cocoapods with next React Native release.
|
|
8
|
+
gem 'cocoapods', '>= 1.13', '< 1.15'
|
|
9
|
+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
CFPropertyList (3.0.7)
|
|
5
|
+
base64
|
|
6
|
+
nkf
|
|
7
|
+
rexml
|
|
8
|
+
activesupport (6.1.7.7)
|
|
9
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
10
|
+
i18n (>= 1.6, < 2)
|
|
11
|
+
minitest (>= 5.1)
|
|
12
|
+
tzinfo (~> 2.0)
|
|
13
|
+
zeitwerk (~> 2.3)
|
|
14
|
+
addressable (2.8.6)
|
|
15
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
16
|
+
algoliasearch (1.27.5)
|
|
17
|
+
httpclient (~> 2.8, >= 2.8.3)
|
|
18
|
+
json (>= 1.5.1)
|
|
19
|
+
atomos (0.1.3)
|
|
20
|
+
base64 (0.2.0)
|
|
21
|
+
claide (1.1.0)
|
|
22
|
+
cocoapods (1.14.3)
|
|
23
|
+
addressable (~> 2.8)
|
|
24
|
+
claide (>= 1.0.2, < 2.0)
|
|
25
|
+
cocoapods-core (= 1.14.3)
|
|
26
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
|
27
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
|
28
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
|
29
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
|
30
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
|
31
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
|
32
|
+
colored2 (~> 3.1)
|
|
33
|
+
escape (~> 0.0.4)
|
|
34
|
+
fourflusher (>= 2.3.0, < 3.0)
|
|
35
|
+
gh_inspector (~> 1.0)
|
|
36
|
+
molinillo (~> 0.8.0)
|
|
37
|
+
nap (~> 1.0)
|
|
38
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
|
39
|
+
xcodeproj (>= 1.23.0, < 2.0)
|
|
40
|
+
cocoapods-core (1.14.3)
|
|
41
|
+
activesupport (>= 5.0, < 8)
|
|
42
|
+
addressable (~> 2.8)
|
|
43
|
+
algoliasearch (~> 1.0)
|
|
44
|
+
concurrent-ruby (~> 1.1)
|
|
45
|
+
fuzzy_match (~> 2.0.4)
|
|
46
|
+
nap (~> 1.0)
|
|
47
|
+
netrc (~> 0.11)
|
|
48
|
+
public_suffix (~> 4.0)
|
|
49
|
+
typhoeus (~> 1.0)
|
|
50
|
+
cocoapods-deintegrate (1.0.5)
|
|
51
|
+
cocoapods-downloader (2.1)
|
|
52
|
+
cocoapods-plugins (1.0.0)
|
|
53
|
+
nap
|
|
54
|
+
cocoapods-search (1.0.1)
|
|
55
|
+
cocoapods-trunk (1.6.0)
|
|
56
|
+
nap (>= 0.8, < 2.0)
|
|
57
|
+
netrc (~> 0.11)
|
|
58
|
+
cocoapods-try (1.2.0)
|
|
59
|
+
colored2 (3.1.2)
|
|
60
|
+
concurrent-ruby (1.2.3)
|
|
61
|
+
escape (0.0.4)
|
|
62
|
+
ethon (0.16.0)
|
|
63
|
+
ffi (>= 1.15.0)
|
|
64
|
+
ffi (1.16.3)
|
|
65
|
+
fourflusher (2.3.1)
|
|
66
|
+
fuzzy_match (2.0.4)
|
|
67
|
+
gh_inspector (1.1.3)
|
|
68
|
+
httpclient (2.8.3)
|
|
69
|
+
i18n (1.14.5)
|
|
70
|
+
concurrent-ruby (~> 1.0)
|
|
71
|
+
json (2.7.2)
|
|
72
|
+
minitest (5.22.3)
|
|
73
|
+
molinillo (0.8.0)
|
|
74
|
+
nanaimo (0.3.0)
|
|
75
|
+
nap (1.1.0)
|
|
76
|
+
netrc (0.11.0)
|
|
77
|
+
nkf (0.2.0)
|
|
78
|
+
public_suffix (4.0.7)
|
|
79
|
+
rexml (3.2.6)
|
|
80
|
+
ruby-macho (2.5.1)
|
|
81
|
+
typhoeus (1.4.1)
|
|
82
|
+
ethon (>= 0.9.0)
|
|
83
|
+
tzinfo (2.0.6)
|
|
84
|
+
concurrent-ruby (~> 1.0)
|
|
85
|
+
xcodeproj (1.24.0)
|
|
86
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
87
|
+
atomos (~> 0.1.3)
|
|
88
|
+
claide (>= 1.0.2, < 2.0)
|
|
89
|
+
colored2 (~> 3.1)
|
|
90
|
+
nanaimo (~> 0.3.0)
|
|
91
|
+
rexml (~> 3.2.4)
|
|
92
|
+
zeitwerk (2.6.13)
|
|
93
|
+
|
|
94
|
+
PLATFORMS
|
|
95
|
+
ruby
|
|
96
|
+
|
|
97
|
+
DEPENDENCIES
|
|
98
|
+
activesupport (>= 6.1.7.5, < 7.1.0)
|
|
99
|
+
cocoapods (>= 1.13, < 1.15)
|
|
100
|
+
|
|
101
|
+
RUBY VERSION
|
|
102
|
+
ruby 2.6.10p210
|
|
103
|
+
|
|
104
|
+
BUNDLED WITH
|
|
105
|
+
1.17.2
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
2
|
+
|
|
3
|
+
# Getting Started
|
|
4
|
+
|
|
5
|
+
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
|
|
6
|
+
|
|
7
|
+
## Step 1: Start the Metro Server
|
|
8
|
+
|
|
9
|
+
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
|
|
10
|
+
|
|
11
|
+
To start Metro, run the following command from the _root_ of your React Native project:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# using npm
|
|
15
|
+
npm start
|
|
16
|
+
|
|
17
|
+
# OR using Yarn
|
|
18
|
+
yarn start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Step 2: Start your Application
|
|
22
|
+
|
|
23
|
+
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
|
|
24
|
+
|
|
25
|
+
### For Android
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# using npm
|
|
29
|
+
npm run android
|
|
30
|
+
|
|
31
|
+
# OR using Yarn
|
|
32
|
+
yarn android
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### For iOS
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# using npm
|
|
39
|
+
npm run ios
|
|
40
|
+
|
|
41
|
+
# OR using Yarn
|
|
42
|
+
yarn ios
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
|
|
46
|
+
|
|
47
|
+
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
|
48
|
+
|
|
49
|
+
## Step 3: Modifying your App
|
|
50
|
+
|
|
51
|
+
Now that you have successfully run the app, let's modify it.
|
|
52
|
+
|
|
53
|
+
1. Open `App.tsx` in your text editor of choice and edit some lines.
|
|
54
|
+
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
|
|
55
|
+
|
|
56
|
+
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
|
|
57
|
+
|
|
58
|
+
## Congratulations! :tada:
|
|
59
|
+
|
|
60
|
+
You've successfully run and modified your React Native App. :partying_face:
|
|
61
|
+
|
|
62
|
+
### Now what?
|
|
63
|
+
|
|
64
|
+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
65
|
+
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
|
|
66
|
+
|
|
67
|
+
# Troubleshooting
|
|
68
|
+
|
|
69
|
+
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
70
|
+
|
|
71
|
+
# Learn More
|
|
72
|
+
|
|
73
|
+
To learn more about React Native, take a look at the following resources:
|
|
74
|
+
|
|
75
|
+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
76
|
+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
77
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
78
|
+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
79
|
+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import App from '../App';
|
|
8
|
+
|
|
9
|
+
// Note: import explicitly to use the types shipped with jest.
|
|
10
|
+
import { it } from '@jest/globals';
|
|
11
|
+
|
|
12
|
+
// Note: test renderer must be required after react-native.
|
|
13
|
+
import renderer from 'react-test-renderer';
|
|
14
|
+
|
|
15
|
+
it('renders correctly', () => {
|
|
16
|
+
renderer.create(<App />);
|
|
17
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
3
|
+
apply plugin: "com.facebook.react"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This is the configuration block to customize your React Native Android app.
|
|
7
|
+
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
8
|
+
*/
|
|
9
|
+
react {
|
|
10
|
+
/* Folders */
|
|
11
|
+
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
12
|
+
// root = file("../")
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
14
|
+
// reactNativeDir = file("../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
18
|
+
// cliFile = file("../node_modules/react-native/cli.js")
|
|
19
|
+
|
|
20
|
+
/* Variants */
|
|
21
|
+
// The list of variants to that are debuggable. For those we're going to
|
|
22
|
+
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
23
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
+
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
25
|
+
|
|
26
|
+
/* Bundling */
|
|
27
|
+
// A list containing the node command and its flags. Default is just 'node'.
|
|
28
|
+
// nodeExecutableAndArgs = ["node"]
|
|
29
|
+
//
|
|
30
|
+
// The command to run when bundling. By default is 'bundle'
|
|
31
|
+
// bundleCommand = "ram-bundle"
|
|
32
|
+
//
|
|
33
|
+
// The path to the CLI configuration file. Default is empty.
|
|
34
|
+
// bundleConfig = file(../rn-cli.config.js)
|
|
35
|
+
//
|
|
36
|
+
// The name of the generated asset file containing your JS bundle
|
|
37
|
+
// bundleAssetName = "MyApplication.android.bundle"
|
|
38
|
+
//
|
|
39
|
+
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
40
|
+
// entryFile = file("../js/MyApplication.android.js")
|
|
41
|
+
//
|
|
42
|
+
// A list of extra flags to pass to the 'bundle' commands.
|
|
43
|
+
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
44
|
+
// extraPackagerArgs = []
|
|
45
|
+
|
|
46
|
+
/* Hermes Commands */
|
|
47
|
+
// The hermes compiler command to run. By default it is 'hermesc'
|
|
48
|
+
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
49
|
+
//
|
|
50
|
+
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
51
|
+
// hermesFlags = ["-O", "-output-source-map"]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
56
|
+
*/
|
|
57
|
+
def enableProguardInReleaseBuilds = false
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
61
|
+
*
|
|
62
|
+
* For example, to use the international variant, you can use:
|
|
63
|
+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
64
|
+
*
|
|
65
|
+
* The international variant includes ICU i18n library and necessary data
|
|
66
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
67
|
+
* give correct results when using with locales other than en-US. Note that
|
|
68
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
69
|
+
*/
|
|
70
|
+
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
71
|
+
|
|
72
|
+
android {
|
|
73
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
74
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
75
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
76
|
+
|
|
77
|
+
namespace "com.blanktemplate"
|
|
78
|
+
defaultConfig {
|
|
79
|
+
applicationId "com.blanktemplate"
|
|
80
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
81
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
82
|
+
versionCode 1
|
|
83
|
+
versionName "1.0"
|
|
84
|
+
}
|
|
85
|
+
signingConfigs {
|
|
86
|
+
debug {
|
|
87
|
+
storeFile file('debug.keystore')
|
|
88
|
+
storePassword 'android'
|
|
89
|
+
keyAlias 'androiddebugkey'
|
|
90
|
+
keyPassword 'android'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
buildTypes {
|
|
94
|
+
debug {
|
|
95
|
+
signingConfig signingConfigs.debug
|
|
96
|
+
}
|
|
97
|
+
release {
|
|
98
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
99
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
100
|
+
signingConfig signingConfigs.debug
|
|
101
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
102
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
dependencies {
|
|
108
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
109
|
+
implementation("com.facebook.react:react-android")
|
|
110
|
+
|
|
111
|
+
if (hermesEnabled.toBoolean()) {
|
|
112
|
+
implementation("com.facebook.react:hermes-android")
|
|
113
|
+
} else {
|
|
114
|
+
implementation jscFlavor
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
119
|
+
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
|
|
120
|
+
apply from: "../../node_modules/@brightlayer-ui/react-native-vector-icons/fonts.gradle"
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
4
|
+
|
|
5
|
+
<application
|
|
6
|
+
android:usesCleartextTraffic="true"
|
|
7
|
+
tools:targetApi="28"
|
|
8
|
+
tools:ignore="GoogleAppIndexingWarning"/>
|
|
9
|
+
</manifest>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
4
|
+
|
|
5
|
+
<application
|
|
6
|
+
android:name=".MainApplication"
|
|
7
|
+
android:label="@string/app_name"
|
|
8
|
+
android:icon="@mipmap/ic_launcher"
|
|
9
|
+
android:roundIcon="@mipmap/ic_launcher_round"
|
|
10
|
+
android:allowBackup="false"
|
|
11
|
+
android:theme="@style/AppTheme">
|
|
12
|
+
<activity
|
|
13
|
+
android:name=".MainActivity"
|
|
14
|
+
android:label="@string/app_name"
|
|
15
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
16
|
+
android:launchMode="singleTask"
|
|
17
|
+
android:windowSoftInputMode="adjustResize"
|
|
18
|
+
android:exported="true">
|
|
19
|
+
<intent-filter>
|
|
20
|
+
<action android:name="android.intent.action.MAIN" />
|
|
21
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
22
|
+
</intent-filter>
|
|
23
|
+
</activity>
|
|
24
|
+
</application>
|
|
25
|
+
</manifest>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.blanktemplate
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate
|
|
5
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
+
|
|
8
|
+
class MainActivity : ReactActivity() {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
+
* rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
override fun getMainComponentName(): String = "blankTemplate"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
+
*/
|
|
20
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package com.blanktemplate
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeHost
|
|
8
|
+
import com.facebook.react.ReactPackage
|
|
9
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
10
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
+
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
+
import com.facebook.soloader.SoLoader
|
|
13
|
+
|
|
14
|
+
class MainApplication : Application(), ReactApplication {
|
|
15
|
+
|
|
16
|
+
override val reactNativeHost: ReactNativeHost =
|
|
17
|
+
object : DefaultReactNativeHost(this) {
|
|
18
|
+
override fun getPackages(): List<ReactPackage> =
|
|
19
|
+
PackageList(this).packages.apply {
|
|
20
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
21
|
+
// add(MyReactNativePackage())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun getJSMainModuleName(): String = "index"
|
|
25
|
+
|
|
26
|
+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
27
|
+
|
|
28
|
+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
29
|
+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override val reactHost: ReactHost
|
|
33
|
+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
|
|
34
|
+
|
|
35
|
+
override fun onCreate() {
|
|
36
|
+
super.onCreate()
|
|
37
|
+
SoLoader.init(this, false)
|
|
38
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
39
|
+
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
|
40
|
+
load()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|