[RN Library ๐Ÿ“š] rn ์Šคํ”Œ๋ž˜์‹œ ์Šคํฌ๋ฆฐ 1. react-native-make๋กœ App, Splash ์ด๋ฏธ์ง€ ์ถ”์ถœํ•˜๊ธฐ

๋„๋””ยท2020๋…„ 8์›” 5์ผ
6

RN Library ๐Ÿ“š

๋ชฉ๋ก ๋ณด๊ธฐ
2/12

๋„ํ•˜!
์˜ค๋Š˜์€.. react-native-splash-screen๊ณผ react-native-make ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด์„œ
react native ํ”„๋กœ์ ํŠธ์˜ ์Šคํ”Œ๋ž˜์‰ฌ ์Šคํฌ๋ฆฐ์„ ์ปจํŠธ๋กค ํ•ด๋ณด๋ ค ํ•œ๋‹ค.

์ด๋ฒˆ ์ž‘์—…์˜ ํฐ ๋‹จ๊ณ„๋Š” ์ด๋Ÿฌํ•˜๋‹ค.

  1. react-native-make๋กœ App, Splash ์ด๋ฏธ์ง€ ์ถ”์ถœํ•˜๊ธฐ
  2. react-native-splash-screen์œผ๋กœ ๋ญ˜ ํ•œ๋‹ค.

react-native-make๋กœ App, Splash ์ด๋ฏธ์ง€ ์ถ”์ถœํ•˜๊ธฐ

react-native-make ๋ฐ”๋กœ๊ฐ€๊ธฐ

ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ๋งŽ์€ ๋„์›€์„ ๋ฐ›๊ณ  ์žˆ๋Š” ๊ฐœ๋ฐœ์ž ์•ผ์ฟ ์ž๋‹˜์˜ ๋ธ”๋กœ๊ทธ์—์„œ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.

์•ผ์ฟ ์ž๋‹˜์€ react-native-make๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ App ์•„์ด์ฝ˜๊ณผ Splash ์ด๋ฏธ์ง€๋ฅผ ์ถ”์ถœํ•˜์—ฌ ์‚ฌ์šฉํ•˜์‹œ๋˜๋ฐ,
๋‚˜๋Š” app ์•„์ด์ฝ˜์ด ์ด๋ฏธ ์„ธํŒ… ๋˜์–ด์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ์ง€๊ธˆ ํ•„์š”ํ•œ Splash ์ด๋ฏธ์ง€๋ฅผ ์ถ”์ถœํ•˜๋Š”๋ฐ๋งŒ ์‚ฌ์šฉ๋‹ˆ, splash ๊ด€๋ จ ์„ค๋ช…๋งŒ ๋„ฃ๊ฒ ๋‹ค. ๊ดœํžˆ ์ฝ”๋“œ๋ฅผ ์œ„๋ถ€ํ„ฐ ์ฐจ๋ก€๋Œ€๋กœ ๋”ฐ๋ผ ํ•˜๋‹ค๊ฐ€ ๊ดœํ•œ ์˜ค๋ฅ˜๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ์œผ๋‹ˆ ๋ง์ด๋‹ค.

์‹œ์ž‘!

๐Ÿฅ• ์•„๋ž˜ ๋ช…๋ น์–ด๋กœ react-native-make๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

yarn add -D @bam.tech/react-native-make
// or
npm i -D @bam.tech/react-native-make

๐Ÿฅ• Splash ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒฝ์šฐ

iOS์—์„œ Splash ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„  Splash ์ด๋ฏธ์ง€์šฉ Storyboard๊ฐ€ ํ•„์š”ํ•˜๋‹ค. ๋งŒ๋“ค์–ด๋ณด์ž

ํ”„๋กœ์ ํŠธ์—์„œ ์•„๋ž˜์™€ ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์ณ์„œ xcode๋ฅผ ์—ด์ž

xed ./ios

ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ์šฐํด๋ฆญํ•ด์„œ New File...์„ ์„ ํƒํ•œ๋‹ค.

์•„๋ž˜์™€ ๊ฐ™์€ ํ™”๋ฉด์—์„œ, ์˜ค๋ฅธ์ชฝ ํ•˜๋‹จ์˜ Launch Screen์„ ์„ ํƒํ•˜๊ณ  Next ๋ฒ„ํŠผ์„ ์„ ํƒํ•œ๋‹ค.

์•„๋ž˜์™€ ๊ฐ™์€ ํ™”๋ฉด์ด ๋‚˜์˜ค๋ฉด, Save As์— SplashScreen์„ ์ž…๋ ฅํ•˜๊ณ  ์˜ค๋ฅธ์ชฝ ํ•˜๋‹จ์˜ Create ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ Splash ์ด๋ฏธ์ง€์šฉ Storyboard๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

๊ทธ๋Ÿฌ๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ํ™”๋ฉด์ด ๋œฌ๋‹ค!

์งœ์ž”!

์ง€๊ธˆ๊นŒ์ง„ Splash์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด iOS์šฉ storyboard๋ฅผ ์ƒ์„ฑํ–ˆ๊ณ ,
์ด์ œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ณ์„œ Splash์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•ด๋ณธ๋‹ค.
Splash ์ด๋ฏธ์ง€๋ฅผ ์œ„ํ•ด์„  3000*3000 ์‚ฌ์ด์ฆˆ์˜ png ํŒŒ์ผ์ด ํ•„์š”ํ•˜๋‹ค.

react-native set-splash --path [path-to-image] --resize [contain|cover|center] --background ["background-color"]

// react-native set-splash --path ./src/img/splash.png --resize center --background "#FFFFFF"

์ฝ”๋“œ ์ค‘๊ฐ„์— center๋กœ ๋˜์–ด์žˆ๋Š” resize ์˜ต์…˜์˜ ๊ธฐ๋ณธ๊ฐ’์€ contain ์ด๋‹ค.
์—ฌ๊ธฐ๋ฅผ ๊ฐ€๋ณด๋ฉด ์ž์„ธํžˆ ์˜ˆ์‹œ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

๐Ÿฅ• Splash ์„ธํŒ…์˜ ๊ฒฐ๊ณผ๋ฌผ - Android

์œ„์—์„œ ์ž‘์„ฑํ•œ

react-native set-splash --path ./src/img/splash.png --resize center --background "#FFFFFF"

์ด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๋‚˜๋ฉด

์ด๋ ‡๊ฒŒ ์ฝ”๋“œ๊ฐ€ ๋ฐ”๋€Œ์–ด ์žˆ๋‹ค. ์˜๊ตฟ
์ž์„ธํžˆ ์–ด๋–ป๊ฒŒ ์Šคํ”Œ๋ž˜์‹œ์ด๋ฏธ์ง€๊ฐ€ ๋‚˜์˜ฌ์ง€ ํƒ์ƒ‰ํ•ด๋ณด์ž

ํ•ด๋‹น ์œ„์น˜์˜ ํŒŒ์ผ์„ ํด๋ฆญํ•˜๋‹ˆ

์ด๋ ‡๊ฒŒ ์–ด๋งˆ์–ด๋งˆํ•˜๊ฒŒ ๋ณด์ด๋Š” ์Šคํ”Œ๋ž˜์‹œ ํ™”๋ฉด์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

์—ฌ๊ธฐ์„œ ์•ฑ์„ run ์‹œ์ผœ๋ณด๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜ฌ ์ˆ˜ ์žˆ๋‹ค.

error: resource style/SplashScreen_SplashTheme.. ๋ธ”๋ผ๋ธ”๋ผ

๊ทธ๋ ‡๋‹ค๋ฉด ์•„๋ž˜ ์ฝ”๋“œ๋กœ react-native-splash-screen ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‹ค์šด ๋ฐ›์•„์ฃผ์ž. (์—๋Ÿฌ ์ฐธ๊ณ )

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

๐Ÿฅ• Splash ์„ธํŒ…์˜ ๊ฒฐ๊ณผ๋ฌผ - iOS

react-native set-splash --path ./src/img/splash.png --resize contain --background "#FFFFFF"

src/img/splash.png ํŒŒ์ผ์„ ํ† ๋Œ€๋กœ xcode์— ์ด๋Ÿฐ์‹์œผ๋กœ ์Šคํ”Œ๋ž˜์‰ฌ ์ด๋ฏธ์ง€๊ฐ€ ๋„์–ด์ง€๊ฒŒ ๋œ๋‹ค. ๋†€๋ž๊ฒŒ๋„

xcode์•ˆ์—์„œ ์‚ฌ์ด์ฆˆ, ์œ„์น˜์กฐ์ •์ด ์•„์ฃผ์•„์ฃผ ๊ฐ„๋‹จํ•˜๋‹ค ใ… ใ…œใ… 
์ •๋ง ๋ˆˆ๋ฌผ๋‚˜๊ฒŒ ๊ณ ๋ง™๋‹ค...

๋Š” ์•„๋‹ˆ๋‹ค. ์ตœ๋Œ€ํ•œ ๊ฑด๋“ค์—ฌ์ฃผ์ง€ ์•Š๊ธฐ๋กœ ํ•˜์ž. ๊ธฐ๊ธฐ๋งˆ๋‹ค ๋‹ค๋ฅด๊ฒŒ ๋ณด์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ์ด๊ฒƒ์ €๊ฒƒ ๊ฑด๋“ค์—ฌ๋ณด๋ฉด์„œ ๋‹ค๋ฅธ ๊ธฐ๊ธฐ๋“ค์—๊ฒŒ์„  ์–ด๋–ป๊ฒŒ ๋ณด์ด์ง€ ํ…Œ์ŠคํŠธํ•ด๋ณผ ๊ฒƒ!

์ฐธ๊ณ ๋กœ ์ด๋Ÿฐ ํŒŒ์ผ๋“ค์ด ์ถ”๊ฐ€๊ฐ€ ๋˜์—ˆ๋‹ค. ํŒŒ์ผ์— ์–ด๋–ค ๋‚ด์šฉ์ด ์ถ”๊ฐ€๋˜์—ˆ๋Š”์ง€๋Š” ์ผ๋‹จ ์ƒ๋žต.

๊ทธ ๋‹ค์Œ ๋‹จ๊ณ„ react-native-splash-screen๋กœ ๋„˜์–ด๊ฐ€๋ณด์ž.

profile
์ถฉ์ „์ค‘..๐Ÿค”

2๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2020๋…„ 11์›” 18์ผ

react-native-make ๋ชจ๋“ˆ์€ ์ด๋ฏธ์ง€ ๋ฝ‘๊ณ  ์ œ๊ฑฐํ•ด๋„ ๋ ๋ ค๋‚˜์š”?

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ