-
Notifications
You must be signed in to change notification settings - Fork 906
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
☂️ Umbrella: Autolinking #288
Comments
CC: @orta @alloy @Salakar @bartolkaruza - you would be the best to fill in iOS / Android parts with technical explanation behind each of the approaches. Don't want to take this pleasure out from you. |
Updated the JS / iOS side from https://docs.google.com/document/d/1WzMYo3Nv0jkrP30_BGLX7gNFaaiLEsdWxX-znMM0yBE/edit#heading=h.78ighmioc9n1 |
Please consider making this a must for 0.60 As mentioned in react-native-community/discussions-and-proposals#64 (comment), Cocoapods right now is painful on version upgrades. |
My PR has been updated to the latest changes now, #258 |
And it's merged! Now testing and documentation time :) |
Opening this issue as an umbrella to discuss implementation details that are common to all platforms and track progress.
For rationale, please read this issue: react-native-community/discussions-and-proposals#96
Check this tweet with video for a demo.
PRs:
link
use new configuration #281The work can be split into 3 parts, one that touches CLI itself (JavaScript), one for CocoaPods-related changes (iOS) and one for Gradle changes (Android).
You can check the approach and rationale behind each of these approaches below.
JavaScript
Make a React Native package act like a normal JS dependency, but with some added conventions for configuring the native toolchains and the native source files.
Both platforms run react-native config to grab all of the RN packages, i.e. CocoaPods or the Gradle plugins never dives into node_modules itself.
This ensures consistent settings for iOS and Android and allows react-native config to update the implementation of how to source this information (be it specified filenames, entries in the module’s package.json, etc).
iOS
The Podfile used in your project includes an extra function
use_native_modules!
which gets the a list of native dependencies from the commandreact-native config
and:node_modules
)This means that all libraries need to ship a Podspec in the root of their folder to work seamlessly. This references the native code that your library depends on, and notes any of its other native dependencies.
The implementation ensures that a library is imported only once, so if you need to have a custom
pod
directive then including it above the functionuse_native_modules!
.Script Phases
A project which wants to add an Xcode script phase to a user's app can use the custom support in iOS auto-linking via custom settings in either the project's
package.json
under"react-native"
or via areact-native.config.js
file in the root.The options for the build phase are passed more-or-less directly to the
Podfile
viabuild_phase
. Here's an example of adding the settings in yourpackage.json
:"path"
is an extra provided to simplify storing the scripts in your repo, it sets"script"
for you. You can see all available options here.Android
/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java
.The text was updated successfully, but these errors were encountered: