Skip to content

Commit 1e13dcf

Browse files
authored
feat: 0.70 (#293)
* feat: 0.70 * fix: use single quote * chore: update typescript to latest
1 parent a88ec2e commit 1e13dcf

17 files changed

+78
-102
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ npx react-native init MyApp --template react-native-template-typescript
3131

3232
### Usage with older versions of React Native
3333

34-
#### e.g. `react-native@0.67.x`
34+
#### e.g. `react-native@0.69.x`
3535

3636
```sh
37-
npx react-native init MyApp --template react-native-template-typescript@6.9.*
37+
npx react-native init MyApp --template react-native-template-typescript@6.11.9
3838
```
3939

4040
See the below table to find out which version of the template to use.
@@ -43,6 +43,7 @@ See the below table to find out which version of the template to use.
4343

4444
| React Native | Template |
4545
| ------------ | -------- |
46+
| 0.70 | 6.12.\* |
4647
| 0.69 | 6.11.\* |
4748
| 0.68 | 6.10.\* |
4849
| 0.67 | 6.9.\* |

template/App.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ const App = () => {
6666

6767
return (
6868
<SafeAreaView style={backgroundStyle}>
69-
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
69+
<StatusBar
70+
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
71+
backgroundColor={backgroundStyle.backgroundColor}
72+
/>
7073
<ScrollView
7174
contentInsetAdjustmentBehavior="automatic"
7275
style={backgroundStyle}>

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/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 "helloworld_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/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(helloworld_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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ void MainApplicationTurboModuleManagerDelegate::registerNatives() {
2222

2323
std::shared_ptr<TurboModule>
2424
MainApplicationTurboModuleManagerDelegate::getTurboModule(
25-
const std::string name,
26-
const std::shared_ptr<CallInvoker> jsInvoker) {
25+
const std::string &name,
26+
const std::shared_ptr<CallInvoker> &jsInvoker) {
2727
// Not implemented yet: provide pure-C++ NativeModules here.
2828
return nullptr;
2929
}
3030

3131
std::shared_ptr<TurboModule>
3232
MainApplicationTurboModuleManagerDelegate::getTurboModule(
33-
const std::string name,
33+
const std::string &name,
3434
const JavaTurboModule::InitParams &params) {
3535
return MainApplicationModuleProvider(name, params);
3636
}
3737

3838
bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
39-
std::string name) {
39+
const std::string &name) {
4040
return getTurboModule(name, nullptr) != nullptr ||
4141
getTurboModule(name, {.moduleName = name}) != nullptr;
4242
}

0 commit comments

Comments
 (0)