diff --git a/SHARE_EXTENSION_VIEW.md b/SHARE_EXTENSION_VIEW.md index 2d45daa..8d2e04b 100644 --- a/SHARE_EXTENSION_VIEW.md +++ b/SHARE_EXTENSION_VIEW.md @@ -74,6 +74,29 @@ Open your Share Extension's `Info.plist` and add the following: Feel free to change the values in ReactShareViewBackgroundColor to whatever you want. +## Bundle JS code and assets in your Share Extension + +If you're planning to run builds outside the simulator, or to make Release builds, add a `Run Script Phase` to your Share Extension target: + +- Go to your Share Extension target's `Build Phases` settings + +- Add a new `Build Phase` and select `New Run Script Phase` + +- Rename it to `Bundle React Native code and images` + +- Leave the shell as `/bin/sh` and paste the following as the script: + +```shell +export NODE_BINARY=node +../node_modules/react-native/scripts/react-native-xcode.sh +``` + +- Drag it behind `[CP] Copy Pods Resources` + +You should end up with something like this: + +![Share Extension Build Phases](screenshots/Xcode-08.png) + ## Register Component Finally, in your `index.js` file, register the component you want to render in your Share Extension view: diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 8072f7e..83f4fac 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -296,7 +296,7 @@ PODS: - React-Core (= 0.63.2) - React-cxxreact (= 0.63.2) - React-jsi (= 0.63.2) - - RNShareMenu (4.1.1): + - RNShareMenu (4.1.3): - React - Yoga (1.14.0) - YogaKit (1.18.1): @@ -460,10 +460,10 @@ SPEC CHECKSUMS: React-RCTText: 1b6773e776e4b33f90468c20fe3b16ca3e224bb8 React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce - RNShareMenu: 4f28793dcd211436f6bd9a3cabcb6a4affe4674c + RNShareMenu: 916e2500637b7b6f02ac50b5cb4f3fb027efe98d Yoga: 7740b94929bbacbddda59bf115b5317e9a161598 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 4db4707d47936b02c7a08163786e29882429c694 +PODFILE CHECKSUM: f5882acce3ccb72d524e52d64e8194cbbb00bbb5 COCOAPODS: 1.9.3 diff --git a/example/ios/Test.xcodeproj/project.pbxproj b/example/ios/Test.xcodeproj/project.pbxproj index 497a06d..a266dd4 100644 --- a/example/ios/Test.xcodeproj/project.pbxproj +++ b/example/ios/Test.xcodeproj/project.pbxproj @@ -484,6 +484,7 @@ A05E9B1524CD9F670028C21E /* Sources */, A05E9B1624CD9F670028C21E /* Frameworks */, A05E9B1724CD9F670028C21E /* Resources */, + A0CD534224D41C2E0057D341 /* Bundle React Native code and images */, 3DF0B84700E3F2C28A6EBDE1 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -606,7 +607,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; }; 0C2F043F22AA696165077FA2 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; @@ -746,6 +747,24 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Test-TestTests/Pods-Test-TestTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; + A0CD534224D41C2E0057D341 /* Bundle React Native code and images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Bundle React Native code and images"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; + }; DE1711632D695F6EF19AF198 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/screenshots/Xcode-08.png b/screenshots/Xcode-08.png new file mode 100644 index 0000000..93f79fa Binary files /dev/null and b/screenshots/Xcode-08.png differ