앱 스플래시 화면 설정

부가 설명
이미지를 자동으로 만들어주는 라이브러리 - 디펜던시인 sharp 때문에 빌드할 때 에러 나서 고생함..-__- 쓰지말자
Tags
SplashScreen
쓰지말자-_-;;

Set the app splash screen

먼저 react-native-splash-screen을 설치하라.

사용법

import SplashScreen from 'react-native-splash-screen'; // 작업을 블라블라하고 // 스플래시 화면 내려줘야함 SplashScreen.hide();
 

이미지 요구사항

  • background transparency(배경 투명도)를 보존하기 위해 .png 파일로 준비
  • 3000px as min height and/or width
  • resize mode로 cover를 사용할 거면 1/3 정도 패딩을 추가로 둬서 원본 이미지가 잘리는 것 방지하자.
 

리사이즈 모드 3가지

notion image
 

 

양쪽 splash screen 동시 생성하기

  • open your file myProject.xcworkspace in XCode
  • right-click on your project folder > "New file..." > "Launch Screen" > "Save as: SplashScreen"
$ react-native set-splash --path <path-to-image> --resize <[contain]|cover|center> --background "<background-color>"
⚠️ path 옵션 값은 필수.
⚠️ default 배경색은 'white'
 

iOS splash screen 개별 생성하기

  • open your file myProject.xcworkspace in XCode
  • right-click on your project folder > "New file..." > "Launch Screen" > "Save as: SplashScreen"
$ react-native set-splash --platform ios --path <path-to-image>
 

android splash screen 개별 생성하기

$ react-native set-splash --platform android --path <path-to-image> --resize <[contain]|cover|center> --background ">background-color>"
⚠️ path 옵션 값은 필수.