Skip to content

Commit c397b8b

Browse files
committed
fix: don't hardcode mixed template to run with new architecture
1 parent bc57344 commit c397b8b

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

packages/create-react-native-library/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ async function create(argv: yargs.Arguments<any>) {
476476
type: example,
477477
dest: folder,
478478
projectName: options.project.name,
479-
isNewArch: options.project.turbomodule,
479+
architecture,
480480
});
481481

482482
spinner.text = 'Copying files';

packages/create-react-native-library/src/utils/generateExampleApp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ export default async function generateExampleApp({
3535
type,
3636
dest,
3737
projectName,
38-
isNewArch,
38+
architecture,
3939
}: {
4040
type: 'expo' | 'native';
4141
dest: string;
4242
projectName: string;
43-
isNewArch: boolean;
43+
architecture: 'turbo' | 'mixed' | 'legacy';
4444
}) {
4545
const directory = path.join(dest, 'example');
4646
const args =
@@ -97,7 +97,7 @@ export default async function generateExampleApp({
9797

9898
// Temporary until autolinking is fixed on iOS
9999
// https://github.com/facebook/react-native/commit/a5622165c198ac6e7ffff5883d4f269a2c974f2e
100-
if (isNewArch) {
100+
if (architecture === 'turbo' || architecture === 'mixed') {
101101
scripts.postinstall = 'patch-package';
102102

103103
Object.assign(devDependencies, PACKAGES_TO_ADD_NEW_ARCH);
@@ -109,7 +109,7 @@ export default async function generateExampleApp({
109109
);
110110

111111
// If the library is on new architecture, enable new arch for iOS and Android
112-
if (isNewArch) {
112+
if (architecture === 'turbo') {
113113
// Android
114114
// Change newArchEnabled=false to newArchEnabled=true in example/android/gradle.properties
115115
const gradleProperties = await fs.readFile(

packages/create-react-native-library/templates/common/CONTRIBUTING.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,21 @@ yarn example ios
3535
```
3636

3737
<% if (project.architecture == 'mixed') { -%>
38-
By default, the example is configured to build with the new architecture. To build with the old architecture, you can change the following:
38+
By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following:
39+
40+
1. For Android, run:
41+
42+
```sh
43+
ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android
44+
```
45+
46+
2. For iOS, run:
47+
48+
```sh
49+
RCT_NEW_ARCH_ENABLED=1 yarn example pods
50+
yarn example ios
51+
```
3952

40-
1. For Android, change `newArchEnabled=true` to `newArchEnabled=false` in `example/android/gradle.properties`.
41-
2. For iOS, change `ENV['RCT_NEW_ARCH_ENABLED'] = '1'` to `ENV['RCT_NEW_ARCH_ENABLED'] = '0'` in `example/ios/Podfile`.
4253
<% } -%>
4354
<% if (!project.native) { -%>
4455
To run the example app on Web:

0 commit comments

Comments
 (0)