Skip to content

Commit 06fe159

Browse files
committed
chore: regenerarate native-cli example
1 parent ea76483 commit 06fe159

File tree

38 files changed

+2649
-4005
lines changed

38 files changed

+2649
-4005
lines changed

examples/native-cli/.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ local.properties
3333
.cxx/
3434
*.keystore
3535
!debug.keystore
36+
.kotlin/
3637

3738
# node.js
3839
#
@@ -72,6 +73,3 @@ yarn-error.log
7273
!.yarn/releases
7374
!.yarn/sdks
7475
!.yarn/versions
75-
76-
# Reassure output directory
77-
.reassure

examples/native-cli/.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
arrowParens: 'avoid',
33
bracketSameLine: true,
4+
bracketSpacing: false,
45
singleQuote: true,
56
trailingComma: 'all',
67
};

examples/native-cli/App.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
*/
77

88
import React from 'react';
9-
import type { PropsWithChildren } from 'react';
9+
import type {PropsWithChildren} from 'react';
1010
import {
11-
SafeAreaView,
1211
ScrollView,
1312
StatusBar,
1413
StyleSheet,
@@ -29,7 +28,7 @@ type SectionProps = PropsWithChildren<{
2928
title: string;
3029
}>;
3130

32-
function Section({ children, title }: SectionProps): React.JSX.Element {
31+
function Section({children, title}: SectionProps): React.JSX.Element {
3332
const isDarkMode = useColorScheme() === 'dark';
3433
return (
3534
<View style={styles.sectionContainer}>
@@ -62,19 +61,33 @@ function App(): React.JSX.Element {
6261
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
6362
};
6463

64+
/*
65+
* To keep the template simple and small we're adding padding to prevent view
66+
* from rendering under the System UI.
67+
* For bigger apps the reccomendation is to use `react-native-safe-area-context`:
68+
* https://github.com/AppAndFlow/react-native-safe-area-context
69+
*
70+
* You can read more about it here:
71+
* https://github.com/react-native-community/discussions-and-proposals/discussions/827
72+
*/
73+
const safePadding = '5%';
74+
6575
return (
66-
<SafeAreaView style={backgroundStyle}>
76+
<View style={backgroundStyle}>
6777
<StatusBar
6878
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
6979
backgroundColor={backgroundStyle.backgroundColor}
7080
/>
7181
<ScrollView
72-
contentInsetAdjustmentBehavior="automatic"
7382
style={backgroundStyle}>
74-
<Header />
83+
<View style={{paddingRight: safePadding}}>
84+
<Header/>
85+
</View>
7586
<View
7687
style={{
7788
backgroundColor: isDarkMode ? Colors.black : Colors.white,
89+
paddingHorizontal: safePadding,
90+
paddingBottom: safePadding,
7891
}}>
7992
<Section title="Step One">
8093
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
@@ -92,7 +105,7 @@ function App(): React.JSX.Element {
92105
<LearnMoreLinks />
93106
</View>
94107
</ScrollView>
95-
</SafeAreaView>
108+
</View>
96109
);
97110
}
98111

examples/native-cli/Gemfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

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'
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'

examples/native-cli/README-orig.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

examples/native-cli/__tests__/App.test.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
* @format
33
*/
44

5-
import 'react-native';
65
import React from 'react';
6+
import ReactTestRenderer from 'react-test-renderer';
77
import App from '../App';
88

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 />);
9+
test('renders correctly', async () => {
10+
await ReactTestRenderer.act(() => {
11+
ReactTestRenderer.create(<App />);
12+
});
1713
});

examples/native-cli/android/app/build.gradle

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ apply plugin: "com.facebook.react"
88
*/
99
react {
1010
/* 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")
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")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -49,6 +49,9 @@ react {
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
52+
53+
/* Autolinking */
54+
autolinkLibrariesWithApp()
5255
}
5356

5457
/**
@@ -60,23 +63,23 @@ def enableProguardInReleaseBuilds = false
6063
* The preferred build flavor of JavaScriptCore (JSC)
6164
*
6265
* For example, to use the international variant, you can use:
63-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
66+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6467
*
6568
* The international variant includes ICU i18n library and necessary data
6669
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
6770
* give correct results when using with locales other than en-US. Note that
6871
* this variant is about 6MiB larger per architecture than default.
6972
*/
70-
def jscFlavor = 'org.webkit:android-jsc:+'
73+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7174

7275
android {
7376
ndkVersion rootProject.ext.ndkVersion
7477
buildToolsVersion rootProject.ext.buildToolsVersion
7578
compileSdk rootProject.ext.compileSdkVersion
7679

77-
namespace "com.reassurenativeexample"
80+
namespace "com.reassureexample"
7881
defaultConfig {
79-
applicationId "com.reassurenativeexample"
82+
applicationId "com.reassureexample"
8083
minSdkVersion rootProject.ext.minSdkVersion
8184
targetSdkVersion rootProject.ext.targetSdkVersion
8285
versionCode 1
@@ -114,5 +117,3 @@ dependencies {
114117
implementation jscFlavor
115118
}
116119
}
117-
118-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

examples/native-cli/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme">
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
1213
<activity
1314
android:name=".MainActivity"
1415
android:label="@string/app_name"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.reassurenativeexample
1+
package com.reassureexample
22

33
import com.facebook.react.ReactActivity
44
import com.facebook.react.ReactActivityDelegate
@@ -11,7 +11,7 @@ class MainActivity : ReactActivity() {
1111
* Returns the name of the main component registered from JavaScript. This is used to schedule
1212
* rendering of the component.
1313
*/
14-
override fun getMainComponentName(): String = "ReassureNativeExample"
14+
override fun getMainComponentName(): String = "ReassureExample"
1515

1616
/**
1717
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.reassurenativeexample
1+
package com.reassureexample
22

33
import android.app.Application
44
import com.facebook.react.PackageList
@@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
99
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
1010
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
1111
import com.facebook.react.defaults.DefaultReactNativeHost
12+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
1213
import com.facebook.soloader.SoLoader
1314

1415
class MainApplication : Application(), ReactApplication {
@@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {
3435

3536
override fun onCreate() {
3637
super.onCreate()
37-
SoLoader.init(this, false)
38+
SoLoader.init(this, OpenSourceMergedSoMapping)
3839
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
3940
// If you opted-in for the New Architecture, we load the native entry point for this app.
4041
load()

0 commit comments

Comments
 (0)