After starting a new project with react-native init awesomeProject, i try to restructure my project, putting index.ios.js and index
Thanks for Michael's info! I did the case for iOS and make the answer complete for both Android and iOS.
As the same as Android, the answers for development and production are different.
For Development (debug mode)
go to AppDelegate.m
set parameter jsBundleURLForBundleRoot
as the path of entry file and moduleName
as the component you registered in RN js. For example, if I want to change the entry js file to js/screen/LoginScreen.js and the component to LoginScreen, do the following:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings]
jsBundleURLForBundleRoot:@"js/screen/LoginScreen"
fallbackResource:nil];
rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"LoginScreen"
initialProperties:nil
launchOptions:launchOptions];
For Production (release mode)
for production mode, Xcode generates a jsbundle file while building. Besides what we did for debug mode, we need to tell Xcode the entry file of jsbundle.
go to the "Build Phases" tab of current target. in the "Bundle React Native code and images" phase, append your entry file to end of the shell
Info about how to run development/produc mode on iOS here