Skip to content

Commit cd30126

Browse files
committed
Update reproducer to latest React Native version
1 parent d0c998d commit cd30126

File tree

13 files changed

+290
-403
lines changed

13 files changed

+290
-403
lines changed

ReproducerApp/.prettierrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module.exports = {
22
arrowParens: 'avoid',
3-
bracketSameLine: true,
4-
bracketSpacing: false,
53
singleQuote: true,
64
trailingComma: 'all',
75
};

ReproducerApp/App.tsx

Lines changed: 8 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,23 @@
55
* @format
66
*/
77

8-
import React from 'react';
9-
import type {PropsWithChildren} from 'react';
10-
import {
11-
ScrollView,
12-
StatusBar,
13-
StyleSheet,
14-
Text,
15-
useColorScheme,
16-
View,
17-
} from 'react-native';
8+
import { NewAppScreen } from '@react-native/new-app-screen';
9+
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
1810

19-
import {
20-
Colors,
21-
DebugInstructions,
22-
Header,
23-
LearnMoreLinks,
24-
ReloadInstructions,
25-
} from 'react-native/Libraries/NewAppScreen';
26-
27-
type SectionProps = PropsWithChildren<{
28-
title: string;
29-
}>;
30-
31-
function Section({children, title}: SectionProps): React.JSX.Element {
11+
function App() {
3212
const isDarkMode = useColorScheme() === 'dark';
33-
return (
34-
<View style={styles.sectionContainer}>
35-
<Text
36-
style={[
37-
styles.sectionTitle,
38-
{
39-
color: isDarkMode ? Colors.white : Colors.black,
40-
},
41-
]}>
42-
{title}
43-
</Text>
44-
<Text
45-
style={[
46-
styles.sectionDescription,
47-
{
48-
color: isDarkMode ? Colors.light : Colors.dark,
49-
},
50-
]}>
51-
{children}
52-
</Text>
53-
</View>
54-
);
55-
}
56-
57-
function App(): React.JSX.Element {
58-
const isDarkMode = useColorScheme() === 'dark';
59-
60-
const backgroundStyle = {
61-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
62-
};
63-
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 recommendation 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%';
7413

7514
return (
76-
<View style={backgroundStyle}>
77-
<StatusBar
78-
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
79-
backgroundColor={backgroundStyle.backgroundColor}
80-
/>
81-
<ScrollView
82-
style={backgroundStyle}>
83-
<View style={{paddingRight: safePadding}}>
84-
<Header/>
85-
</View>
86-
<View
87-
style={{
88-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
89-
paddingHorizontal: safePadding,
90-
paddingBottom: safePadding,
91-
}}>
92-
<Section title="Step One">
93-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
94-
screen and then come back to see your edits.
95-
</Section>
96-
<Section title="See Your Changes">
97-
<ReloadInstructions />
98-
</Section>
99-
<Section title="Debug">
100-
<DebugInstructions />
101-
</Section>
102-
<Section title="Learn More">
103-
Read the docs to discover what to do next:
104-
</Section>
105-
<LearnMoreLinks />
106-
</View>
107-
</ScrollView>
15+
<View style={styles.container}>
16+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
17+
<NewAppScreen templateFileName="App.tsx" />
10818
</View>
10919
);
11020
}
11121

11222
const styles = StyleSheet.create({
113-
sectionContainer: {
114-
marginTop: 32,
115-
paddingHorizontal: 24,
116-
},
117-
sectionTitle: {
118-
fontSize: 24,
119-
fontWeight: '600',
120-
},
121-
sectionDescription: {
122-
marginTop: 8,
123-
fontSize: 18,
124-
fontWeight: '400',
125-
},
126-
highlight: {
127-
fontWeight: '700',
23+
container: {
24+
flex: 1,
12825
},
12926
});
13027

ReproducerApp/android/app/src/main/java/com/reproducerapp/MainApplication.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import android.app.Application
44
import com.facebook.react.PackageList
55
import com.facebook.react.ReactApplication
66
import com.facebook.react.ReactHost
7+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
78
import com.facebook.react.ReactNativeHost
89
import com.facebook.react.ReactPackage
9-
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
13-
import com.facebook.soloader.SoLoader
1412

1513
class MainApplication : Application(), ReactApplication {
1614

@@ -35,10 +33,6 @@ class MainApplication : Application(), ReactApplication {
3533

3634
override fun onCreate() {
3735
super.onCreate()
38-
SoLoader.init(this, OpenSourceMergedSoMapping)
39-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40-
// If you opted-in for the New Architecture, we load the native entry point for this app.
41-
load()
42-
}
36+
loadReactNative(this)
4337
}
4438
}

ReproducerApp/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
compileSdkVersion = 35
66
targetSdkVersion = 35
77
ndkVersion = "27.1.12297006"
8-
kotlinVersion = "2.0.21"
8+
kotlinVersion = "2.1.20"
99
}
1010
repositories {
1111
google()
Binary file not shown.

ReproducerApp/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

ReproducerApp/android/gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

ReproducerApp/android/gradlew.bat

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
@REM Copyright (c) Meta Platforms, Inc. and affiliates.
2+
@REM
3+
@REM This source code is licensed under the MIT license found in the
4+
@REM LICENSE file in the root directory of this source tree.
5+
16
@rem
27
@rem Copyright 2015 the original author or authors.
38
@rem
@@ -70,11 +75,11 @@ goto fail
7075
:execute
7176
@rem Setup the command line
7277

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
78+
set CLASSPATH=
7479

7580

7681
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
82+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7883

7984
:end
8085
@rem End local scope for the variables with windows NT shell

ReproducerApp/index.js

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

5-
import {AppRegistry} from 'react-native';
5+
import { AppRegistry } from 'react-native';
66
import App from './App';
7-
import {name as appName} from './app.json';
7+
import { name as appName } from './app.json';
88

99
AppRegistry.registerComponent(appName, () => App);

ReproducerApp/metro.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
1+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
22

33
/**
44
* Metro configuration

0 commit comments

Comments
 (0)