Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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 @@ -179,7 +179,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env.local\"\nfi\nexport CONFIG_CMD=\"dummy-workaround-value\"\nexport CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@rnef/cli/package.json')) + '/dist/src/bin.js'\")\"\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "bash -l -c \"${PROJECT_DIR}/react-native-xcode.sh\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
8 changes: 8 additions & 0 deletions packages/platform-ios/template/ios/react-native-xcode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set -e

. "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"

export CONFIG_CMD="dummy-workaround-value"
export CLI_PATH="$("$NODE_BINARY" --print "require('path').dirname(require.resolve('@rnef/cli/package.json')) + '/dist/src/bin.js'")"

. "$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
23 changes: 14 additions & 9 deletions website/docs/docs/getting-started/migrating-from-community-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,24 @@ import { PackageManagerTabs } from 'rspress/theme';
config = use_native_modules!(['npx', 'rnef', 'config', '-p', 'ios'])
```

In "Bundle React Native code and images" Build Phase in Xcode add:
In `ios/<ProjectName>.xcodeproj/project.pbxproj` update the shellScript:

```shell title="Bundle React Native code and images build phase" {2-9}
```ruby title=""
# shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "bash -l -c \"${PROJECT_DIR}/react-native-xcode.sh\"\n";
```

Next, create `ios/react-native-xcode.sh` with the below content. You can move there any custom code you previously had as part of the "Bundle React Native code and images" Build Phase in Xcode:

```shell title="ios/react-native-xcode.sh"
set -e
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
source "$PODS_ROOT/../.xcode.env"
fi
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
source "$PODS_ROOT/../.xcode.env.local"
fi

. "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"

export CONFIG_CMD="dummy-workaround-value"
export CLI_PATH="$("$NODE_BINARY" --print "require('path').dirname(require.resolve('@rnef/cli/package.json')) + '/dist/src/bin.js'")"
WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"

. "$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
```

1. Cleanup native files:
Expand Down
Loading