Skip to content
Open
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
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

source "$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'")"

source "$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
20 changes: 7 additions & 13 deletions website/docs/docs/getting-started/migrating-from-community-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,15 @@ 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:

```shell title="Bundle React Native code and images build phase" {2-9}
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
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"
In `ios/<ProjectName>.xcodeproj/project.pbxproj` update the shellScript:

```ruby title="Bundle React Native code and images"
# 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` based on [this template](https://github.com/callstack/rnef/blob/main/packages/platform-ios/template/ios/react-native-xcode.sh). You can move there any custom code you previously had as part of the "Bundle React Native code and images" Build Phase in Xcode.

1. Cleanup native files:

```sh
Expand Down
Loading