-
-
Notifications
You must be signed in to change notification settings - Fork 271
React Native development production module workflow
MusicControl is the module name (replace it with yours)
react-native new-library MusicControl
This will create a MusicControl folder into RN Library folder.
Location: node_modules/react-native/Library/MusicControl
Go to this created folder then version it
- Remove previous reference of this 5 Removing module reference
- Open your XCode project
- Add
MusicControl.xcodeproj(node_modules/react-native/Library/MusicControl) under Library folder of your RN app project - Add
libMusicControl.a, into app settings :Build Phases>Link Binary With Librariesclick+then search and add libMusicControl. (If you forget this step your component will not be loaded into NativeModules of React Native)
react-native-music-control seems to be an arbitrary name but keep it during all config phase
app/build.gradle
compile project(':react-native-music-control')
MainActivity.java
import com.tanguyantoine.react.MusicControlPackage;
settings.gradle (:warning: use node libary package folder)
include ':react-native-music-control'
// note the projectDir
project(':react-native-music-control').projectDir = new File(rootProject.projectDir, '../node_modules/react-native/Library/MusicControl/android')
NB : here react-native-music-control is the npm package name
Same as development workflow but you should use the MusicControl.xcodeproj located under node_modules/react-native-music-control/ios folder
Same as development workflow but change you settings.gradle to this
settings.gradle (use node module package folder)
project(':react-native-music-control').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-music-control/android')
- remove reference of
MusicControl.xcodeprojinto XCode interface - remove
libMusicControl.afromBuild Phases>Link Binary With Libraries
Remove added lines in app/build.gradle, MainActivity.java and settings.gradle files