[ReactNative] 스플래시 화면

양정훈·2022년 6월 16일
0
  1. src 폴더에 이미지 추가 (ex. src/Assets/images/splash.png)

    • 가로 세로 3000px 이상
  2. npm i -D @bam.tech/react-native-make

  3. xed ./ios

  4. Launch Screen 생성 (Save as : SplashScreen)

  5. react-native set-splash --path --resize <[contain]|cover|center> --background ""

  6. npm i react-native-splash-screen --save

  7. cd ios && pod install && cd ..

  8. 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

0개의 댓글