Skip to content

Commit 5bdd02c

Browse files
committed
feat: upgrade react native 0.70.6
1 parent 2d00de1 commit 5bdd02c

26 files changed

+1594
-1449
lines changed

README.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,28 @@
66

77
It is a template that you can clone and reuse for every project. It is starting point for React Native application.
88

9-
## React Native Typescript Boilerplate ( 0.69.1 )
9+
## React Native Typescript Boilerplate ( 0.70.6 )
1010

1111
consist of:
1212

13-
- react-native": "0.69.1"
14-
- "@react-native-masked-view/masked-view": "^0.2.7",
15-
- "@react-navigation/bottom-tabs": "^6.3.2",
16-
- "@react-navigation/material-top-tabs": "^6.2.2",
17-
- "@react-navigation/native": "^6.0.11",
18-
- "@react-navigation/native-stack": "^6.7.0",
19-
- "@react-navigation/stack": "^6.2.2",
20-
- "@reduxjs/toolkit": "^1.8.3",
21-
- "react": "18.0.0",
22-
- "react-native-gesture-handler": "^2.5.0",
23-
- "react-native-pager-view": "^5.4.25",
24-
- "react-native-safe-area-context": "^4.3.1",
25-
- "react-native-screens": "^3.15.0",
26-
- "react-native-tab-view": "^3.1.1",
13+
- "@react-native-masked-view/masked-view": "^0.2.8",
14+
- "@react-navigation/bottom-tabs": "^6.4.0",
15+
- "@react-navigation/material-top-tabs": "^6.3.0",
16+
- "@react-navigation/native": "^6.0.13",
17+
- "@react-navigation/native-stack": "^6.9.1",
18+
- "@reduxjs/toolkit": "^1.9.0",
19+
- "react": "18.1.0",
20+
- "react-native": "0.70.6",
21+
- "react-native-gesture-handler": "^2.8.0",
22+
- "react-native-pager-view": "^6.1.0",
23+
- "react-native-safe-area-context": "^4.4.1",
24+
- "react-native-screens": "^3.18.2",
25+
- "react-native-tab-view": "^3.3.0",
2726
- "react-native-vector-icons": "^9.2.0",
28-
- "react-redux": "^8.0.2"
27+
- "react-redux": "^8.0.5"
2928
## Requirements
3029

31-
Node 12 or greater is required. Development for iOS requires a Mac and Xcode 10 or up, and will target iOS 11 and up.
30+
Node 14 or greater is required. Development for iOS requires a Mac and Xcode 10 or up, and will target iOS 11 and up.
3231

3332
You also need to install the dependencies required by React Native.
3433
Go to the [React Native environment setup](https://reactnative.dev/docs/environment-setup), then select `React Native CLI Quickstart` tab.
@@ -68,6 +67,12 @@ Run this command `chmod 755 android/gradlew` from your root project directory
6867

6968
- Replace `USERNAME` with your PC username
7069

70+
71+
#### Error Your Ruby version is 2.6.10, but your Gemfile specified 2.7.5
72+
- install `rbenv`
73+
- run `rbenv local 2.7.5`
74+
- `export PATH="$HOME/.rbenv/bin:$PATH"`
75+
7176
### React Native Build Failed on M1 Macbook Pro / Air
7277

7378
try this solution: [How to Run and Build React Native on Macbook Pro M1 Apple Silicon](https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon)

script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
console.log("Welcome to handi.dev boilerplate");
3+
console.log("Welcome to handi.dev react native TypeScript boilerplate");

template.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
// package.json, index.json, android/, ios/
44
placeholderName: "reactNativeBoilerplate",
55

6-
titlePlaceholder: 'Handi.dev react native boilerplate',
6+
titlePlaceholder: 'Handi.dev react native typescript boilerplate',
77

88
// Directory with template
99
templateDir: "./template",

template/.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

template/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ build/
3030
local.properties
3131
*.iml
3232
*.hprof
33+
.cxx/
3334

3435
# node.js
3536
#

template/.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

template/.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ module.exports = {
44
bracketSpacing: true,
55
singleQuote: true,
66
trailingComma: 'all',
7-
};
7+
};

template/Gemfile.lock

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.5)
5+
rexml
6+
activesupport (6.1.7)
7+
concurrent-ruby (~> 1.0, >= 1.0.2)
8+
i18n (>= 1.6, < 2)
9+
minitest (>= 5.1)
10+
tzinfo (~> 2.0)
11+
zeitwerk (~> 2.3)
12+
addressable (2.8.1)
13+
public_suffix (>= 2.0.2, < 6.0)
14+
algoliasearch (1.27.5)
15+
httpclient (~> 2.8, >= 2.8.3)
16+
json (>= 1.5.1)
17+
atomos (0.1.3)
18+
claide (1.1.0)
19+
cocoapods (1.11.3)
20+
addressable (~> 2.8)
21+
claide (>= 1.0.2, < 2.0)
22+
cocoapods-core (= 1.11.3)
23+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
24+
cocoapods-downloader (>= 1.4.0, < 2.0)
25+
cocoapods-plugins (>= 1.0.0, < 2.0)
26+
cocoapods-search (>= 1.0.0, < 2.0)
27+
cocoapods-trunk (>= 1.4.0, < 2.0)
28+
cocoapods-try (>= 1.1.0, < 2.0)
29+
colored2 (~> 3.1)
30+
escape (~> 0.0.4)
31+
fourflusher (>= 2.3.0, < 3.0)
32+
gh_inspector (~> 1.0)
33+
molinillo (~> 0.8.0)
34+
nap (~> 1.0)
35+
ruby-macho (>= 1.0, < 3.0)
36+
xcodeproj (>= 1.21.0, < 2.0)
37+
cocoapods-core (1.11.3)
38+
activesupport (>= 5.0, < 7)
39+
addressable (~> 2.8)
40+
algoliasearch (~> 1.0)
41+
concurrent-ruby (~> 1.1)
42+
fuzzy_match (~> 2.0.4)
43+
nap (~> 1.0)
44+
netrc (~> 0.11)
45+
public_suffix (~> 4.0)
46+
typhoeus (~> 1.0)
47+
cocoapods-deintegrate (1.0.5)
48+
cocoapods-downloader (1.6.3)
49+
cocoapods-plugins (1.0.0)
50+
nap
51+
cocoapods-search (1.0.1)
52+
cocoapods-trunk (1.6.0)
53+
nap (>= 0.8, < 2.0)
54+
netrc (~> 0.11)
55+
cocoapods-try (1.2.0)
56+
colored2 (3.1.2)
57+
concurrent-ruby (1.1.10)
58+
escape (0.0.4)
59+
ethon (0.16.0)
60+
ffi (>= 1.15.0)
61+
ffi (1.15.5)
62+
fourflusher (2.3.1)
63+
fuzzy_match (2.0.4)
64+
gh_inspector (1.1.3)
65+
httpclient (2.8.3)
66+
i18n (1.12.0)
67+
concurrent-ruby (~> 1.0)
68+
json (2.6.2)
69+
minitest (5.16.3)
70+
molinillo (0.8.0)
71+
nanaimo (0.3.0)
72+
nap (1.1.0)
73+
netrc (0.11.0)
74+
public_suffix (4.0.7)
75+
rexml (3.2.5)
76+
ruby-macho (2.5.1)
77+
typhoeus (1.4.0)
78+
ethon (>= 0.9.0)
79+
tzinfo (2.0.5)
80+
concurrent-ruby (~> 1.0)
81+
xcodeproj (1.22.0)
82+
CFPropertyList (>= 2.3.3, < 4.0)
83+
atomos (~> 0.1.3)
84+
claide (>= 1.0.2, < 2.0)
85+
colored2 (~> 3.1)
86+
nanaimo (~> 0.3.0)
87+
rexml (~> 3.2.4)
88+
zeitwerk (2.6.6)
89+
90+
PLATFORMS
91+
ruby
92+
93+
DEPENDENCIES
94+
cocoapods (~> 1.11, >= 1.11.2)
95+
96+
RUBY VERSION
97+
ruby 2.7.5p203
98+
99+
BUNDLED WITH
100+
2.1.4

template/android/app/build.gradle

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
4+
import org.apache.tools.ant.taskdefs.condition.Os
45

56
/**
67
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -78,7 +79,7 @@ import com.android.build.OutputFile
7879
*/
7980

8081
project.ext.react = [
81-
enableHermes: false, // clean and rebuild if changing
82+
enableHermes: true, // clean and rebuild if changing
8283
]
8384

8485
apply from: "../../node_modules/react-native/react.gradle"
@@ -142,22 +143,14 @@ android {
142143
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
143144

144145
if (isNewArchitectureEnabled()) {
145-
// We configure the NDK build only if you decide to opt-in for the New Architecture.
146+
// We configure the CMake build only if you decide to opt-in for the New Architecture.
146147
externalNativeBuild {
147-
ndkBuild {
148-
arguments "APP_PLATFORM=android-21",
149-
"APP_STL=c++_shared",
150-
"NDK_TOOLCHAIN_VERSION=clang",
151-
"GENERATED_SRC_DIR=$buildDir/generated/source",
152-
"PROJECT_BUILD_DIR=$buildDir",
153-
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
154-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
155-
"NODE_MODULES_DIR=$rootDir/../node_modules"
156-
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
157-
cppFlags "-std=c++17"
158-
// Make sure this target name is the same you specify inside the
159-
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
160-
targets "reactnativetypescriptboilerplate_appmodules"
148+
cmake {
149+
arguments "-DPROJECT_BUILD_DIR=$buildDir",
150+
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
151+
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
152+
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
153+
"-DANDROID_STL=c++_shared"
161154
}
162155
}
163156
if (!enableSeparateBuildPerCPUArchitecture) {
@@ -171,8 +164,8 @@ android {
171164
if (isNewArchitectureEnabled()) {
172165
// We configure the NDK build only if you decide to opt-in for the New Architecture.
173166
externalNativeBuild {
174-
ndkBuild {
175-
path "$projectDir/src/main/jni/Android.mk"
167+
cmake {
168+
path "$projectDir/src/main/jni/CMakeLists.txt"
176169
}
177170
}
178171
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
@@ -194,15 +187,15 @@ android {
194187
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
195188

196189
// Due to a bug inside AGP, we have to explicitly set a dependency
197-
// between configureNdkBuild* tasks and the preBuild tasks.
190+
// between configureCMakeDebug* tasks and the preBuild tasks.
198191
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
199-
configureNdkBuildRelease.dependsOn(preReleaseBuild)
200-
configureNdkBuildDebug.dependsOn(preDebugBuild)
192+
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
193+
configureCMakeDebug.dependsOn(preDebugBuild)
201194
reactNativeArchitectures().each { architecture ->
202-
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
195+
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
203196
dependsOn("preDebugBuild")
204197
}
205-
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
198+
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
206199
dependsOn("preReleaseBuild")
207200
}
208201
}

template/android/app/src/main/java/com/reactnativetypescriptboilerplate/MainActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ protected String getMainComponentName() {
1616
return "reactNativeTypescriptBoilerplate";
1717
}
1818

19-
// for react-native-screens
2019
@Override
2120
protected void onCreate(Bundle savedInstanceState) {
2221
super.onCreate(null);

template/android/app/src/main/jni/Android.mk

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
# Define the library name here.
4+
project(reactnativetypescriptboilerplate_appmodules)
5+
6+
# This file includes all the necessary to let you build your application with the New Architecture.
7+
include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)

template/android/app/src/main/jni/MainApplicationModuleProvider.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#include "MainApplicationModuleProvider.h"
22

3+
#include <rncli.h>
34
#include <rncore.h>
45

56
namespace facebook {
67
namespace react {
78

89
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
9-
const std::string moduleName,
10+
const std::string &moduleName,
1011
const JavaTurboModule::InitParams &params) {
1112
// Here you can provide your own module provider for TurboModules coming from
1213
// either your application or from external libraries. The approach to follow
@@ -17,6 +18,13 @@ std::shared_ptr<TurboModule> MainApplicationModuleProvider(
1718
// return module;
1819
// }
1920
// return rncore_ModuleProvider(moduleName, params);
21+
22+
// Module providers autolinked by RN CLI
23+
auto rncli_module = rncli_ModuleProvider(moduleName, params);
24+
if (rncli_module != nullptr) {
25+
return rncli_module;
26+
}
27+
2028
return rncore_ModuleProvider(moduleName, params);
2129
}
2230

template/android/app/src/main/jni/MainApplicationModuleProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace facebook {
99
namespace react {
1010

1111
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
12-
const std::string moduleName,
12+
const std::string &moduleName,
1313
const JavaTurboModule::InitParams &params);
1414

1515
} // namespace react

0 commit comments

Comments
 (0)