src 폴더에 이미지 추가 (ex. src/Assets/images/splash.png)
npm i -D @bam.tech/react-native-make
xed ./ios
Launch Screen 생성 (Save as : SplashScreen)
react-native set-splash --path --resize <[contain]|cover|center> --background ""
npm i react-native-splash-screen --save
cd ios && pod install && cd ..
AppDelegate.m 수정
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h" // here
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...other code
[RNSplashScreen show]; // here
// or
//[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
return YES;
}
@end