1
AppDelegate.m
파일이 react-native-navigation의 예에 따라 변경됩니다. 반응 네이티브가 더 이상 index.ios
파일을 생성하지 않기 때문에 index.ios
을 index
으로 변경했습니다. 스플래시 화면에서 앱이 멈춤 반응 네이티브 탐색
jsCodeLocation =[[RCTBundleURLProvidersharedSettings]jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import "RCCManager.h"
#import <React/RCTRootView.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];
return YES;
}
@end
는 이제 응용 프로그램은 기본 반응에 의해 디스플레이 프로젝트 이름 아래 구동되는 시작 화면에 붙어있다. 당신이 핸들러에서 응용 프로그램을 시작하려고하는 것처럼
function onPressLearnMore() {
Navigation.startSingleScreenApp({
screen: {
screen: 'app.screens.HomeScreen', // unique ID registered with Navigation.registerScreen
title: 'Welcome', // title of the screen as appears in the nav bar (optional)
navigatorStyle: {}, // override the navigator style for the screen, see "Styling the navigator" below (optional)
navigatorButtons: {} // override the nav buttons for the screen, see "Adding buttons to the navigator" below (optional)
},
passProps: {}, // simple serializable object that will pass as props to all top screens (optional)
animationType: 'slide-down' // optional, add transition animation to root change: 'none', 'slide-down', 'fade'
});
console.log("Hello");
}
환경
react-native-cli: 2.0.1
react-native: 0.49.3