Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable jetifier for generated native examples #563

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,30 +172,44 @@ export default async function generateExampleApp({
spaces: 2,
});

// If the library is on new architecture, enable new arch for iOS and Android
if (arch === 'new') {
// Android
// Change newArchEnabled=false to newArchEnabled=true in example/android/gradle.properties
const gradleProperties = await fs.readFile(
if (type === 'native') {
let gradleProperties = await fs.readFile(
path.join(directory, 'android', 'gradle.properties'),
'utf8'
);

await fs.writeFile(
path.join(directory, 'android', 'gradle.properties'),
gradleProperties.replace('newArchEnabled=false', 'newArchEnabled=true')
// Disable Jetifier.
// Remove this when the app template is updated.
gradleProperties = gradleProperties.replace(
'android.enableJetifier=true',
'android.enableJetifier=false'
);

// iOS
// Add ENV['RCT_NEW_ARCH_ENABLED'] = 1 on top of example/ios/Podfile
const podfile = await fs.readFile(
path.join(directory, 'ios', 'Podfile'),
'utf8'
);
// If the library is on new architecture, enable new arch for iOS and Android
if (arch === 'new') {
// iOS
// Add ENV['RCT_NEW_ARCH_ENABLED'] = 1 on top of example/ios/Podfile
const podfile = await fs.readFile(
path.join(directory, 'ios', 'Podfile'),
'utf8'
);

await fs.writeFile(
path.join(directory, 'ios', 'Podfile'),
"ENV['RCT_NEW_ARCH_ENABLED'] = '1'\n\n" + podfile
);

// Android
// Change newArchEnabled=false to newArchEnabled=true in example/android/gradle.properties
gradleProperties = gradleProperties.replace(
'newArchEnabled=false',
'newArchEnabled=true'
);
}

await fs.writeFile(
path.join(directory, 'ios', 'Podfile'),
"ENV['RCT_NEW_ARCH_ENABLED'] = '1'\n\n" + podfile
path.join(directory, 'android', 'gradle.properties'),
gradleProperties
);
}
}