new-react-native-boilerplate 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +329 -2
- package/package.json +49 -4
- package/run.sh +36 -0
- package/setup.js +141 -0
- package/template/.bundle/config +2 -0
- package/template/.editorconfig +14 -0
- package/template/.eslintrc.js +49 -0
- package/template/.husky/commit-msg +4 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.prettierrc.js +6 -0
- package/template/.watchmanconfig +1 -0
- package/template/Gemfile +17 -0
- package/template/Gemfile.lock +114 -0
- package/template/README.md +101 -0
- package/template/__tests__/App.test.tsx +13 -0
- package/template/__tests__/CustomTextInput.test.jsx +29 -0
- package/template/android/app/build.gradle +119 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/main/AndroidManifest.xml +27 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/futura_book.otf +0 -0
- package/template/android/app/src/main/assets/fonts/futura_medium.otf +0 -0
- package/template/android/app/src/main/java/com/boilerplatereactnative/MainActivity.kt +22 -0
- package/template/android/app/src/main/java/com/boilerplatereactnative/MainApplication.kt +27 -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 +49 -0
- package/template/android/gradlew +248 -0
- package/template/android/gradlew.bat +98 -0
- package/template/android/link-assets-manifest.json +29 -0
- package/template/android/settings.gradle +6 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +43 -0
- package/template/eslint.config.mjs +175 -0
- package/template/index.d.ts +1 -0
- package/template/index.js +10 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/BoilerPlateReactNative/AppDelegate.swift +11 -0
- package/template/ios/BoilerPlateReactNative/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/BoilerPlateReactNative/Images.xcassets/Contents.json +6 -0
- package/template/ios/BoilerPlateReactNative/Info.plist +102 -0
- package/template/ios/BoilerPlateReactNative/LaunchScreen.storyboard +47 -0
- package/template/ios/BoilerPlateReactNative/PrivacyInfo.xcprivacy +37 -0
- package/template/ios/BoilerPlateReactNative/SceneDelegate.swift +54 -0
- package/template/ios/BoilerPlateReactNative.xcodeproj/project.pbxproj +531 -0
- package/template/ios/BoilerPlateReactNative.xcodeproj/xcshareddata/xcschemes/BoilerPlateReactNative.xcscheme +88 -0
- package/template/ios/BoilerPlateReactNative.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/BoilerPlateReactNative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/Podfile +34 -0
- package/template/ios/Podfile.lock +2552 -0
- package/template/ios/link-assets-manifest.json +29 -0
- package/template/jest.config.js +13 -0
- package/template/jest.setup.js +30 -0
- package/template/metro.config.js +15 -0
- package/template/package.json +88 -0
- package/template/plugins/compile-js/_prompts.js +6 -0
- package/template/plugins/compile-js/index.js +9 -0
- package/template/plugins/compile-js/plugin.js +103 -0
- package/template/plugins/compile-js/tsconfig.build.json +20 -0
- package/template/plugins/index.js +46 -0
- package/template/plugins/printSuccess/_prompts.js +1 -0
- package/template/plugins/printSuccess/index.js +9 -0
- package/template/plugins/printSuccess/plugin.js +40 -0
- package/template/react-native.config.js +7 -0
- package/template/src/App.tsx +27 -0
- package/template/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/src/assets/fonts/futura_book.otf +0 -0
- package/template/src/assets/fonts/futura_medium.otf +0 -0
- package/template/src/assets/images/check.png +0 -0
- package/template/src/assets/images/check@2x.png +0 -0
- package/template/src/assets/images/check@3x.png +0 -0
- package/template/src/assets/images/email.png +0 -0
- package/template/src/assets/images/email@2x.png +0 -0
- package/template/src/assets/images/email@3x.png +0 -0
- package/template/src/assets/images/icBack.png +0 -0
- package/template/src/assets/images/icBack@2x.png +0 -0
- package/template/src/assets/images/icBack@3x.png +0 -0
- package/template/src/assets/images/icClose.png +0 -0
- package/template/src/assets/images/icClose@2x.png +0 -0
- package/template/src/assets/images/icClose@3x.png +0 -0
- package/template/src/assets/images/icComment.png +0 -0
- package/template/src/assets/images/icComment@2x.png +0 -0
- package/template/src/assets/images/icComment@3x.png +0 -0
- package/template/src/assets/images/icLike.png +0 -0
- package/template/src/assets/images/icLike@2x.png +0 -0
- package/template/src/assets/images/icLike@3x.png +0 -0
- package/template/src/assets/images/icSearch.png +0 -0
- package/template/src/assets/images/icSearch@2x.png +0 -0
- package/template/src/assets/images/icSearch@3x.png +0 -0
- package/template/src/assets/images/icSetting.png +0 -0
- package/template/src/assets/images/icSetting@2x.png +0 -0
- package/template/src/assets/images/icSetting@3x.png +0 -0
- package/template/src/assets/images/icShare.png +0 -0
- package/template/src/assets/images/icShare@2x.png +0 -0
- package/template/src/assets/images/icShare@3x.png +0 -0
- package/template/src/assets/images/line.png +0 -0
- package/template/src/assets/images/line@2x.png +0 -0
- package/template/src/assets/images/line@3x.png +0 -0
- package/template/src/assets/images/lock.png +0 -0
- package/template/src/assets/images/lock@2x.png +0 -0
- package/template/src/assets/images/lock@3x.png +0 -0
- package/template/src/assets/images/notification.png +0 -0
- package/template/src/assets/images/notification@2x.png +0 -0
- package/template/src/assets/images/notification@3x.png +0 -0
- package/template/src/assets/images/oct_dark.png +0 -0
- package/template/src/assets/images/oct_light.png +0 -0
- package/template/src/assets/images/onboard.png +0 -0
- package/template/src/assets/images/password_hide.png +0 -0
- package/template/src/assets/images/password_hide@2x.png +0 -0
- package/template/src/assets/images/password_hide@3x.png +0 -0
- package/template/src/assets/images/password_show.png +0 -0
- package/template/src/assets/images/password_show@2x.png +0 -0
- package/template/src/assets/images/password_show@3x.png +0 -0
- package/template/src/assets/images/right_arrow.png +0 -0
- package/template/src/assets/images/right_arrow@2x.png +0 -0
- package/template/src/assets/images/right_arrow@3x.png +0 -0
- package/template/src/assets/images/star.png +0 -0
- package/template/src/assets/images/star@2x.png +0 -0
- package/template/src/assets/images/star@3x.png +0 -0
- package/template/src/assets/images/uncheck.png +0 -0
- package/template/src/assets/images/uncheck@2x.png +0 -0
- package/template/src/assets/images/uncheck@3x.png +0 -0
- package/template/src/assets/images/user.png +0 -0
- package/template/src/assets/images/user@2x.png +0 -0
- package/template/src/assets/images/user@3x.png +0 -0
- package/template/src/components/atoms/ButtonContainer.tsx +52 -0
- package/template/src/components/atoms/ImageContainer.tsx +10 -0
- package/template/src/components/atoms/RemoteImage.tsx +8 -0
- package/template/src/components/atoms/RoundImageBorder.tsx +35 -0
- package/template/src/components/atoms/TextContainer.tsx +38 -0
- package/template/src/components/atoms/WrapperContainer.tsx +43 -0
- package/template/src/components/atoms/index.ts +6 -0
- package/template/src/components/molecules/AuthHeader.tsx +55 -0
- package/template/src/components/molecules/CustomTextInput.tsx +102 -0
- package/template/src/components/molecules/EmptyComp.tsx +16 -0
- package/template/src/components/molecules/ErrorComp.tsx +25 -0
- package/template/src/components/molecules/FooterView.tsx +41 -0
- package/template/src/components/molecules/HeaderComp.tsx +51 -0
- package/template/src/components/molecules/HomeHeader.tsx +63 -0
- package/template/src/components/molecules/HomeListHeader.tsx +48 -0
- package/template/src/components/molecules/HomeListItems.tsx +86 -0
- package/template/src/components/molecules/Loader.tsx +25 -0
- package/template/src/components/molecules/ModalSheet.tsx +146 -0
- package/template/src/components/molecules/RememberMe.tsx +58 -0
- package/template/src/components/molecules/SearchBar.tsx +46 -0
- package/template/src/components/molecules/index.ts +12 -0
- package/template/src/constants/apiConstant.ts +12 -0
- package/template/src/constants/fontFamily.ts +8 -0
- package/template/src/constants/imagePath.ts +25 -0
- package/template/src/constants/index.ts +3 -0
- package/template/src/constants/storageKeys.ts +5 -0
- package/template/src/models/ApiErrorResponse.ts +19 -0
- package/template/src/models/HomeData.ts +17 -0
- package/template/src/models/User.ts +11 -0
- package/template/src/navigations/AuthStack.tsx +20 -0
- package/template/src/navigations/MainStack.tsx +19 -0
- package/template/src/navigations/Routes.tsx +22 -0
- package/template/src/navigations/navigationProps.ts +8 -0
- package/template/src/redux/hooks.ts +10 -0
- package/template/src/redux/reducers/auth.ts +43 -0
- package/template/src/redux/reducers/common.ts +24 -0
- package/template/src/redux/reducers/index.ts +31 -0
- package/template/src/redux/reducers/product.ts +37 -0
- package/template/src/redux/reducers/settings.ts +55 -0
- package/template/src/redux/store.ts +19 -0
- package/template/src/redux/types.ts +6 -0
- package/template/src/screens/Home/Home.tsx +65 -0
- package/template/src/screens/Login/Login.tsx +35 -0
- package/template/src/screens/Login/components/LoginForm.tsx +88 -0
- package/template/src/screens/Login/hooks/useLogin.ts +38 -0
- package/template/src/screens/Login/styles.ts +17 -0
- package/template/src/screens/Login/types.ts +10 -0
- package/template/src/screens/Onboarding/Onboarding.tsx +87 -0
- package/template/src/screens/Onboarding/styles.ts +25 -0
- package/template/src/screens/PostDetails/PostDetails.tsx +168 -0
- package/template/src/screens/PostDetails/styles.ts +82 -0
- package/template/src/screens/Signup/Signup.tsx +32 -0
- package/template/src/screens/Signup/components/SignupForm.tsx +113 -0
- package/template/src/screens/Signup/hooks/useSignup.ts +38 -0
- package/template/src/screens/Signup/styles.ts +18 -0
- package/template/src/screens/Signup/type.ts +12 -0
- package/template/src/screens/index.ts +5 -0
- package/template/src/services/apiService.ts +144 -0
- package/template/src/services/authService.ts +79 -0
- package/template/src/services/productService.ts +45 -0
- package/template/src/services/statusHandler.ts +17 -0
- package/template/src/styles/breakpoints.ts +11 -0
- package/template/src/styles/themes.ts +45 -0
- package/template/src/styles/unistyles.ts +25 -0
- package/template/src/translations/ar.json +47 -0
- package/template/src/translations/en.json +47 -0
- package/template/src/translations/fr.json +47 -0
- package/template/src/translations/index.ts +32 -0
- package/template/src/typings/env.d.ts +5 -0
- package/template/src/typings/global.d.ts +3 -0
- package/template/src/utils/handleLocalStorage.ts +31 -0
- package/template/src/utils/i18nHelpers.ts +20 -0
- package/template/src/utils/index.ts +66 -0
- package/template/src/utils/scaling.ts +13 -0
- package/template/src/utils/themeHelpers.ts +10 -0
- package/template/src/utils/validationForm.ts +23 -0
- package/template/src/utils/validations.ts +69 -0
- package/template/tsconfig.json +22 -0
- package/template/yarn.lock +7728 -0
- package/template.config.js +6 -0
package/template/Gemfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
9
|
+
gem 'xcodeproj', '< 1.26.0'
|
|
10
|
+
gem 'concurrent-ruby', '< 1.3.4'
|
|
11
|
+
|
|
12
|
+
# Ruby 3.4.0 has removed some libraries from the standard library.
|
|
13
|
+
gem 'bigdecimal'
|
|
14
|
+
gem 'logger'
|
|
15
|
+
gem 'benchmark'
|
|
16
|
+
gem 'mutex_m'
|
|
17
|
+
gem 'nkf'
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
CFPropertyList (3.0.9)
|
|
5
|
+
activesupport (6.1.7.10)
|
|
6
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
7
|
+
i18n (>= 1.6, < 2)
|
|
8
|
+
minitest (>= 5.1)
|
|
9
|
+
tzinfo (~> 2.0)
|
|
10
|
+
zeitwerk (~> 2.3)
|
|
11
|
+
addressable (2.9.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
13
|
+
algoliasearch (1.27.5)
|
|
14
|
+
httpclient (~> 2.8, >= 2.8.3)
|
|
15
|
+
json (>= 1.5.1)
|
|
16
|
+
atomos (0.1.3)
|
|
17
|
+
benchmark (0.5.0)
|
|
18
|
+
bigdecimal (4.1.3)
|
|
19
|
+
claide (1.1.0)
|
|
20
|
+
cocoapods (1.15.2)
|
|
21
|
+
addressable (~> 2.8)
|
|
22
|
+
claide (>= 1.0.2, < 2.0)
|
|
23
|
+
cocoapods-core (= 1.15.2)
|
|
24
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
|
25
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
|
26
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
|
27
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
|
28
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
|
29
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
|
30
|
+
colored2 (~> 3.1)
|
|
31
|
+
escape (~> 0.0.4)
|
|
32
|
+
fourflusher (>= 2.3.0, < 3.0)
|
|
33
|
+
gh_inspector (~> 1.0)
|
|
34
|
+
molinillo (~> 0.8.0)
|
|
35
|
+
nap (~> 1.0)
|
|
36
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
|
37
|
+
xcodeproj (>= 1.23.0, < 2.0)
|
|
38
|
+
cocoapods-core (1.15.2)
|
|
39
|
+
activesupport (>= 5.0, < 8)
|
|
40
|
+
addressable (~> 2.8)
|
|
41
|
+
algoliasearch (~> 1.0)
|
|
42
|
+
concurrent-ruby (~> 1.1)
|
|
43
|
+
fuzzy_match (~> 2.0.4)
|
|
44
|
+
nap (~> 1.0)
|
|
45
|
+
netrc (~> 0.11)
|
|
46
|
+
public_suffix (~> 4.0)
|
|
47
|
+
typhoeus (~> 1.0)
|
|
48
|
+
cocoapods-deintegrate (1.0.5)
|
|
49
|
+
cocoapods-downloader (2.1)
|
|
50
|
+
cocoapods-plugins (1.0.0)
|
|
51
|
+
nap
|
|
52
|
+
cocoapods-search (1.0.1)
|
|
53
|
+
cocoapods-trunk (1.6.0)
|
|
54
|
+
nap (>= 0.8, < 2.0)
|
|
55
|
+
netrc (~> 0.11)
|
|
56
|
+
cocoapods-try (1.2.0)
|
|
57
|
+
colored2 (3.1.2)
|
|
58
|
+
concurrent-ruby (1.3.3)
|
|
59
|
+
escape (0.0.4)
|
|
60
|
+
ethon (0.18.0)
|
|
61
|
+
ffi (>= 1.15.0)
|
|
62
|
+
logger
|
|
63
|
+
ffi (1.17.4)
|
|
64
|
+
fourflusher (2.3.1)
|
|
65
|
+
fuzzy_match (2.0.4)
|
|
66
|
+
gh_inspector (1.1.3)
|
|
67
|
+
httpclient (2.9.0)
|
|
68
|
+
mutex_m
|
|
69
|
+
i18n (1.14.8)
|
|
70
|
+
concurrent-ruby (~> 1.0)
|
|
71
|
+
json (2.7.6)
|
|
72
|
+
logger (1.7.0)
|
|
73
|
+
minitest (5.25.4)
|
|
74
|
+
molinillo (0.8.0)
|
|
75
|
+
mutex_m (0.3.0)
|
|
76
|
+
nanaimo (0.3.0)
|
|
77
|
+
nap (1.1.0)
|
|
78
|
+
netrc (0.11.0)
|
|
79
|
+
nkf (0.3.0)
|
|
80
|
+
public_suffix (4.0.7)
|
|
81
|
+
rexml (3.4.4)
|
|
82
|
+
ruby-macho (2.5.1)
|
|
83
|
+
typhoeus (1.6.0)
|
|
84
|
+
ethon (>= 0.18.0)
|
|
85
|
+
tzinfo (2.0.6)
|
|
86
|
+
concurrent-ruby (~> 1.0)
|
|
87
|
+
xcodeproj (1.25.1)
|
|
88
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
89
|
+
atomos (~> 0.1.3)
|
|
90
|
+
claide (>= 1.0.2, < 2.0)
|
|
91
|
+
colored2 (~> 3.1)
|
|
92
|
+
nanaimo (~> 0.3.0)
|
|
93
|
+
rexml (>= 3.3.6, < 4.0)
|
|
94
|
+
zeitwerk (2.6.18)
|
|
95
|
+
|
|
96
|
+
PLATFORMS
|
|
97
|
+
ruby
|
|
98
|
+
|
|
99
|
+
DEPENDENCIES
|
|
100
|
+
activesupport (>= 6.1.7.5, != 7.1.0)
|
|
101
|
+
benchmark
|
|
102
|
+
bigdecimal
|
|
103
|
+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
|
|
104
|
+
concurrent-ruby (< 1.3.4)
|
|
105
|
+
logger
|
|
106
|
+
mutex_m
|
|
107
|
+
nkf
|
|
108
|
+
xcodeproj (< 1.26.0)
|
|
109
|
+
|
|
110
|
+
RUBY VERSION
|
|
111
|
+
ruby 2.6.10p210
|
|
112
|
+
|
|
113
|
+
BUNDLED WITH
|
|
114
|
+
2.4.22
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
This project was created with [**new-react-native-boilerplate**](https://www.npmjs.com/package/new-react-native-boilerplate), a [React Native](https://reactnative.dev) starter with navigation, Redux Toolkit, theming and localization already set up.
|
|
2
|
+
|
|
3
|
+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before you continue.
|
|
4
|
+
|
|
5
|
+
# Getting Started
|
|
6
|
+
|
|
7
|
+
## Step 1: Install dependencies
|
|
8
|
+
|
|
9
|
+
The setup wizard already ran this for you. Run it again after you clone the project or change dependencies:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
yarn
|
|
13
|
+
yarn asset # link fonts and images
|
|
14
|
+
bundle install # install CocoaPods through Bundler (first time only)
|
|
15
|
+
yarn podinstall # install iOS pods (after native dependency changes)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Step 2: Check the `.env` file
|
|
19
|
+
|
|
20
|
+
The wizard creates a `.env` file at the project root. Update the values for your API:
|
|
21
|
+
|
|
22
|
+
```dotenv
|
|
23
|
+
ENV=DEV
|
|
24
|
+
BASE_API_URL=https://dummyjson.com
|
|
25
|
+
IMAGE_URL=https://dev-tn-file-server.s3.ap-south-1.amazonaws.com
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Step 3: Start Metro
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
yarn start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To see app console logs in the Metro terminal, use this instead:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
yarn start-logs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Step 4: Build and run your app
|
|
41
|
+
|
|
42
|
+
Keep Metro running, open a new terminal in the project root, and run one of these:
|
|
43
|
+
|
|
44
|
+
### Android
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
yarn android
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### iOS
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
yarn ios
|
|
54
|
+
|
|
55
|
+
# or on a specific simulator
|
|
56
|
+
yarn ios --simulator="iPhone 16 Pro"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If everything is set up correctly, your app opens in the Android Emulator, the iOS Simulator, or on your connected device. You can also build it directly from Android Studio or Xcode.
|
|
60
|
+
|
|
61
|
+
## Step 5: Modify your app
|
|
62
|
+
|
|
63
|
+
Open `src/App.tsx` or any screen in `src/screens/` and make a change. When you save, the app updates automatically through [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
|
|
64
|
+
|
|
65
|
+
To force a full reload, for example to reset the app's state:
|
|
66
|
+
|
|
67
|
+
- **Android**: press <kbd>R</kbd> twice, or choose **"Reload"** from the **Dev Menu**. Open it with <kbd>Ctrl</kbd> + <kbd>M</kbd> on Windows and Linux, or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> on macOS.
|
|
68
|
+
- **iOS**: press <kbd>R</kbd> in the iOS Simulator.
|
|
69
|
+
|
|
70
|
+
# Available Scripts
|
|
71
|
+
|
|
72
|
+
| Script | Description |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `yarn start` | Start Metro with a cleared cache |
|
|
75
|
+
| `yarn start-logs` | Start Metro and stream app console logs |
|
|
76
|
+
| `yarn android` | Build and run the Android app |
|
|
77
|
+
| `yarn ios` | Build and run the iOS app |
|
|
78
|
+
| `yarn podinstall` | Install iOS CocoaPods through Bundler |
|
|
79
|
+
| `yarn asset` | Link fonts and assets |
|
|
80
|
+
| `yarn test` | Run the Jest test suite |
|
|
81
|
+
| `yarn test:report` | Run tests with coverage and a JUnit report |
|
|
82
|
+
| `yarn lint` | Lint `.ts` and `.tsx` files |
|
|
83
|
+
| `yarn tsc` | Type-check the project |
|
|
84
|
+
| `yarn precommit` | Run the type check and lint in parallel |
|
|
85
|
+
| `yarn android-bundle-release` | Build an Android release bundle |
|
|
86
|
+
| `yarn android-run-release` | Run the Android release variant |
|
|
87
|
+
|
|
88
|
+
# Troubleshooting
|
|
89
|
+
|
|
90
|
+
- **Pods fail to install:** run `cd ios && bundle exec pod install --repo-update && cd ..`
|
|
91
|
+
- **`gradlew: Permission denied`:** run `chmod 755 android/gradlew`
|
|
92
|
+
- **Stale code or `.env` values:** restart Metro with `yarn start`, which already clears the cache.
|
|
93
|
+
- **Fonts or images missing:** run `yarn asset`, then rebuild the app.
|
|
94
|
+
|
|
95
|
+
For anything else, see the React Native [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page or [open an issue](https://github.com/sharmahardik59/RNBoilerplate/issues).
|
|
96
|
+
|
|
97
|
+
# Learn More
|
|
98
|
+
|
|
99
|
+
- [new-react-native-boilerplate on GitHub](https://github.com/sharmahardik59/RNBoilerplate): source code, docs and issues.
|
|
100
|
+
- [React Native website](https://reactnative.dev): learn more about React Native.
|
|
101
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started): a guided tour of React Native.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactTestRenderer from 'react-test-renderer';
|
|
7
|
+
import App from '../src/App';
|
|
8
|
+
|
|
9
|
+
test('renders correctly', async () => {
|
|
10
|
+
await ReactTestRenderer.act(() => {
|
|
11
|
+
ReactTestRenderer.create(<App />);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {fireEvent, render} from '@testing-library/react-native';
|
|
3
|
+
import CustomTextInput from '../src/components/molecules/CustomTextInput';
|
|
4
|
+
|
|
5
|
+
describe('CustomTextInput', () => {
|
|
6
|
+
test('renders correctly with placeholder', () => {
|
|
7
|
+
const {getByPlaceholderText} = render(<CustomTextInput placeholder="Enter Text" />);
|
|
8
|
+
const input = getByPlaceholderText('Enter Text');
|
|
9
|
+
expect(input).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('handles text change', () => {
|
|
13
|
+
const onChangeTextMock = jest.fn();
|
|
14
|
+
const {getByPlaceholderText} = render(
|
|
15
|
+
<CustomTextInput onChangeText={onChangeTextMock} placeholder="Enter Text" />,
|
|
16
|
+
);
|
|
17
|
+
const input = getByPlaceholderText('Enter Text');
|
|
18
|
+
fireEvent.changeText(input, 'Test Input');
|
|
19
|
+
expect(onChangeTextMock).toHaveBeenCalledWith('Test Input');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('passes additional props to TextInput', () => {
|
|
23
|
+
const {getByTestId} = render(
|
|
24
|
+
<CustomTextInput placeholder="Enter Text" testID="customTextInput" />,
|
|
25
|
+
);
|
|
26
|
+
const input = getByTestId('customTextInput');
|
|
27
|
+
expect(input.props.placeholder).toBe('Enter Text');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
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. Default is "debug", "debugOptimized".
|
|
23
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
+
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
|
|
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
|
+
/* Autolinking */
|
|
54
|
+
autolinkLibrariesWithApp()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
59
|
+
*/
|
|
60
|
+
def enableProguardInReleaseBuilds = false
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
64
|
+
*
|
|
65
|
+
* For example, to use the international variant, you can use:
|
|
66
|
+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
|
|
67
|
+
*
|
|
68
|
+
* The international variant includes ICU i18n library and necessary data
|
|
69
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
70
|
+
* give correct results when using with locales other than en-US. Note that
|
|
71
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
72
|
+
*/
|
|
73
|
+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
|
74
|
+
|
|
75
|
+
android {
|
|
76
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
77
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
78
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
79
|
+
|
|
80
|
+
namespace "com.boilerplatereactnative"
|
|
81
|
+
defaultConfig {
|
|
82
|
+
applicationId "com.boilerplatereactnative"
|
|
83
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
84
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
85
|
+
versionCode 1
|
|
86
|
+
versionName "1.0"
|
|
87
|
+
}
|
|
88
|
+
signingConfigs {
|
|
89
|
+
debug {
|
|
90
|
+
storeFile file('debug.keystore')
|
|
91
|
+
storePassword 'android'
|
|
92
|
+
keyAlias 'androiddebugkey'
|
|
93
|
+
keyPassword 'android'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
buildTypes {
|
|
97
|
+
debug {
|
|
98
|
+
signingConfig signingConfigs.debug
|
|
99
|
+
}
|
|
100
|
+
release {
|
|
101
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
102
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
103
|
+
signingConfig signingConfigs.debug
|
|
104
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
105
|
+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
dependencies {
|
|
111
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
112
|
+
implementation("com.facebook.react:react-android")
|
|
113
|
+
|
|
114
|
+
if (hermesEnabled.toBoolean()) {
|
|
115
|
+
implementation("com.facebook.react:hermes-android")
|
|
116
|
+
} else {
|
|
117
|
+
implementation jscFlavor
|
|
118
|
+
}
|
|
119
|
+
}
|
|
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,27 @@
|
|
|
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
|
+
android:usesCleartextTraffic="${usesCleartextTraffic}"
|
|
13
|
+
android:supportsRtl="true">
|
|
14
|
+
<activity
|
|
15
|
+
android:name=".MainActivity"
|
|
16
|
+
android:label="@string/app_name"
|
|
17
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
18
|
+
android:launchMode="singleTask"
|
|
19
|
+
android:windowSoftInputMode="adjustResize"
|
|
20
|
+
android:exported="true">
|
|
21
|
+
<intent-filter>
|
|
22
|
+
<action android:name="android.intent.action.MAIN" />
|
|
23
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
24
|
+
</intent-filter>
|
|
25
|
+
</activity>
|
|
26
|
+
</application>
|
|
27
|
+
</manifest>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.boilerplatereactnative
|
|
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 = "BoilerPlateReactNative"
|
|
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,27 @@
|
|
|
1
|
+
package com.boilerplatereactnative
|
|
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.ReactNativeApplicationEntryPoint.loadReactNative
|
|
8
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
9
|
+
|
|
10
|
+
class MainApplication : Application(), ReactApplication {
|
|
11
|
+
|
|
12
|
+
override val reactHost: ReactHost by lazy {
|
|
13
|
+
getDefaultReactHost(
|
|
14
|
+
context = applicationContext,
|
|
15
|
+
packageList =
|
|
16
|
+
PackageList(this).packages.apply {
|
|
17
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
18
|
+
// add(MyReactNativePackage())
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun onCreate() {
|
|
24
|
+
super.onCreate()
|
|
25
|
+
loadReactNative(this)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Copyright (C) 2014 The Android Open Source Project
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
-->
|
|
16
|
+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
|
17
|
+
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
|
18
|
+
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
|
19
|
+
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
|
20
|
+
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
<selector>
|
|
24
|
+
<!--
|
|
25
|
+
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
|
26
|
+
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
|
27
|
+
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
|
28
|
+
|
|
29
|
+
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
30
|
+
|
|
31
|
+
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
|
32
|
+
-->
|
|
33
|
+
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
34
|
+
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
|
35
|
+
</selector>
|
|
36
|
+
|
|
37
|
+
</inset>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<resources>
|
|
2
|
+
|
|
3
|
+
<!-- Base application theme. -->
|
|
4
|
+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
5
|
+
<!-- Customize your theme here. -->
|
|
6
|
+
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
|
7
|
+
</style>
|
|
8
|
+
|
|
9
|
+
</resources>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext {
|
|
3
|
+
buildToolsVersion = "37.0.0"
|
|
4
|
+
minSdkVersion = 24
|
|
5
|
+
compileSdkVersion = 37
|
|
6
|
+
targetSdkVersion = 36
|
|
7
|
+
ndkVersion = "27.1.12297006"
|
|
8
|
+
kotlinVersion = "2.2.0"
|
|
9
|
+
}
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath("com.android.tools.build:gradle")
|
|
16
|
+
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
Binary file
|