Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .changeset/cool-hairs-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rock-js/platform-apple-helpers': patch
'rock-docs': patch
---

fix: ensure RCT_USE_RN_DEP and RCT_USE_PREBUILT_RNCORE are only set for RN 0.81"
19 changes: 16 additions & 3 deletions packages/platform-apple-helpers/src/lib/utils/pods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
cacheManager,
color,
colorLink,
getReactNativeVersion,
logger,
RockError,
spawn,
Expand Down Expand Up @@ -103,6 +104,7 @@ async function runPodInstall(options: {
newArch: boolean;
useBundler: boolean;
brownfield?: boolean;
projectRoot: string;
}) {
if (!options.useBundler) {
await validatePodCommand(options.sourceDir);
Expand All @@ -116,16 +118,25 @@ async function runPodInstall(options: {
const shouldHandleRepoUpdate = options?.shouldHandleRepoUpdate || true;
const loader = spinner({ indicator: 'timer' });
loader.start('Installing CocoaPods dependencies');

const reactNativeVersion = await getReactNativeVersion(options.projectRoot);
const isReactNative81OrHigher =
reactNativeVersion.localeCompare('0.81.0', undefined, {
numeric: true,
sensitivity: 'base',
}) >= 0;
const command = options.useBundler ? 'bundle' : 'pod';
const args = options.useBundler ? ['exec', 'pod', 'install'] : ['install'];
try {
await spawn(command, args, {
env: {
RCT_NEW_ARCH_ENABLED: options.newArch ? '1' : '0',
RCT_IGNORE_PODS_DEPRECATION: '1',
RCT_USE_RN_DEP: process.env['RCT_USE_RN_DEP'] || '1',
RCT_USE_PREBUILT_RNCORE: process.env['RCT_USE_PREBUILT_RNCORE'] || '1',
RCT_USE_RN_DEP:
process.env['RCT_USE_RN_DEP'] || isReactNative81OrHigher ? '1' : '0',
RCT_USE_PREBUILT_RNCORE:
process.env['RCT_USE_PREBUILT_RNCORE'] || isReactNative81OrHigher
? '1'
: '0',
...(options.brownfield && { USE_FRAMEWORKS: 'static' }),
...(process.env['USE_THIRD_PARTY_JSC'] && {
USE_THIRD_PARTY_JSC: process.env['USE_THIRD_PARTY_JSC'],
Expand All @@ -152,6 +163,7 @@ async function runPodInstall(options: {
newArch: options.newArch,
useBundler: options.useBundler,
brownfield: options.brownfield,
projectRoot: options.projectRoot,
});
} else {
throw new RockError(
Expand Down Expand Up @@ -212,6 +224,7 @@ async function installPods(options: {
newArch: options.newArch,
useBundler,
brownfield: options.brownfield,
projectRoot: options.projectRoot,
});
}

Expand Down
10 changes: 5 additions & 5 deletions website/src/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ The `build:ios` command builds your iOS app for simulators, devices, or distribu

The `build:ios` command supports the following environmental variables that are passed to `pod` command that installs CocoaPods dependencies:

| Variable | Description | Default |
| ------------------------- | ------------------------------------------------------------- | ------- |
| `RCT_USE_RN_DEP` | Use prebuilt React Native dependencies for faster compilation | `1` |
| `RCT_USE_PREBUILT_RNCORE` | Use prebuilt React Native core for faster compilation | `1` |
| `USE_THIRD_PARTY_JSC` | Use JavaScriptCore instead of Hermes for JavaScript execution | `0` |
| Variable | Description | Default |
| ------------------------- | -------------------------------------------------------------------------------------------- | ------- |
| `RCT_USE_RN_DEP` | Use prebuilt React Native dependencies for faster compilation (only for React Native v0.81+) | `1` |
| `RCT_USE_PREBUILT_RNCORE` | Use prebuilt React Native core for faster compilation (only for React Native v0.81+) | `1` |
| `USE_THIRD_PARTY_JSC` | Use JavaScriptCore instead of Hermes for JavaScript execution | `0` |

To change these variables, you can prefix the `build:ios` command with environmental variables. For example, to use prebuilt React Native dependencies and core for faster compilation, you can use the following command:

Expand Down
Loading