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

Diff for: README.md

+3-2
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.\* |

Diff for: template/App.tsx

+4-1
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}>

Diff for: template/_gitignore

+1
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
#

Diff for: template/_node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

Diff for: template/android/app/build.gradle

+16-23
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
}

Diff for: template/android/app/src/main/jni/Android.mk

-48
This file was deleted.

Diff for: template/android/app/src/main/jni/CMakeLists.txt

+7
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)

Diff for: template/android/app/src/main/jni/MainApplicationModuleProvider.cpp

+9-1
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

Diff for: template/android/app/src/main/jni/MainApplicationModuleProvider.h

+1-1
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

Diff for: template/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp

+4-4
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
}

Diff for: template/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ class MainApplicationTurboModuleManagerDelegate
2121
static void registerNatives();
2222

2323
std::shared_ptr<TurboModule> getTurboModule(
24-
const std::string name,
25-
const std::shared_ptr<CallInvoker> jsInvoker) override;
24+
const std::string &name,
25+
const std::shared_ptr<CallInvoker> &jsInvoker) override;
2626
std::shared_ptr<TurboModule> getTurboModule(
27-
const std::string name,
27+
const std::string &name,
2828
const JavaTurboModule::InitParams &params) override;
2929

3030
/**
3131
* Test-only method. Allows user to verify whether a TurboModule can be
3232
* created by instances of this class.
3333
*/
34-
bool canCreateTurboModule(std::string name);
34+
bool canCreateTurboModule(const std::string &name);
3535
};
3636

3737
} // namespace react

Diff for: template/android/app/src/main/jni/MainComponentsRegistry.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <fbjni/fbjni.h>
55
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
66
#include <react/renderer/components/rncore/ComponentDescriptors.h>
7+
#include <rncli.h>
78

89
namespace facebook {
910
namespace react {
@@ -14,6 +15,9 @@ std::shared_ptr<ComponentDescriptorProviderRegistry const>
1415
MainComponentsRegistry::sharedProviderRegistry() {
1516
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
1617

18+
// Autolinked providers registered by RN CLI
19+
rncli_registerProviders(providerRegistry);
20+
1721
// Custom Fabric Components go here. You can register custom
1822
// components coming from your App or from 3rd party libraries here.
1923
//

Diff for: template/android/build.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.apache.tools.ant.taskdefs.condition.Os
2-
31
// Top-level build file where you can add configuration options common to all sub-projects/modules.
42

53
buildscript {
@@ -22,7 +20,7 @@ buildscript {
2220
mavenCentral()
2321
}
2422
dependencies {
25-
classpath("com.android.tools.build:gradle:7.1.1")
23+
classpath("com.android.tools.build:gradle:7.2.1")
2624
classpath("com.facebook.react:react-native-gradle-plugin")
2725
classpath("de.undercouch:gradle-download-task:5.0.1")
2826
// NOTE: Do not place your application dependencies here; they belong

Diff for: template/android/gradle/wrapper/gradle-wrapper.jar

285 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

Diff for: template/ios/Podfile

+14-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
44
platform :ios, '12.4'
55
install! 'cocoapods', :deterministic_uuids => false
66

7-
production = ENV["PRODUCTION"] == "1"
8-
97
target 'HelloWorld' do
108
config = use_native_modules!
119

@@ -14,10 +12,15 @@ target 'HelloWorld' do
1412

1513
use_react_native!(
1614
:path => config[:reactNativePath],
17-
# to enable hermes on iOS, change `false` to `true` and then install pods
18-
:production => production,
19-
:hermes_enabled => flags[:hermes_enabled],
15+
# Hermes is now enabled by default. Disable by setting this flag to false.
16+
# Upcoming versions of React Native may rely on get_default_flags(), but
17+
# we make it explicit here to aid in the React Native upgrade process.
18+
:hermes_enabled => true,
2019
:fabric_enabled => flags[:fabric_enabled],
20+
# Enables Flipper.
21+
#
22+
# Note that if you have use_frameworks! enabled, Flipper will not work and
23+
# you should disable the next line.
2124
:flipper_configuration => FlipperConfiguration.enabled,
2225
# An absolute path to your application root.
2326
:app_path => "#{Pod::Config.instance.installation_root}/.."
@@ -29,7 +32,12 @@ target 'HelloWorld' do
2932
end
3033

3134
post_install do |installer|
32-
react_native_post_install(installer)
35+
react_native_post_install(
36+
installer,
37+
# Set `mac_catalyst_enabled` to `true` in order to apply patches
38+
# necessary for Mac Catalyst builds
39+
:mac_catalyst_enabled => false
40+
)
3341
__apply_Xcode_12_5_M1_post_install_workaround(installer)
3442
end
3543
end

Diff for: template/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
1111
},
1212
"dependencies": {
13-
"react": "18.0.0",
14-
"react-native": "0.69.5"
13+
"react": "18.1.0",
14+
"react-native": "0.70.0"
1515
},
1616
"devDependencies": {
1717
"@babel/core": "^7.12.9",
1818
"@babel/runtime": "^7.12.5",
1919
"@react-native-community/eslint-config": "^2.0.0",
2020
"@tsconfig/react-native": "^2.0.2",
2121
"@types/jest": "^26.0.23",
22-
"@types/react-native": "^0.69.5",
22+
"@types/react-native": "^0.69.6",
2323
"@types/react-test-renderer": "^18.0.0",
24-
"@typescript-eslint/eslint-plugin": "^5.29.0",
25-
"@typescript-eslint/parser": "^5.29.0",
24+
"@typescript-eslint/eslint-plugin": "^5.36.2",
25+
"@typescript-eslint/parser": "^5.36.2",
2626
"babel-jest": "^26.6.3",
2727
"eslint": "^7.32.0",
2828
"jest": "^26.6.3",
29-
"metro-react-native-babel-preset": "^0.70.3",
30-
"react-test-renderer": "18.0.0",
31-
"typescript": "^4.4.4"
29+
"metro-react-native-babel-preset": "^0.72.1",
30+
"react-test-renderer": "18.1.0",
31+
"typescript": "^4.8.2"
3232
},
3333
"jest": {
3434
"preset": "react-native",

0 commit comments

Comments
 (0)