๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

React Native

[ ReactNative ] react-native-vector-icons ์…‹ํŒ…ํ•˜๊ธฐ.

react native ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•  ๋•Œ ๋‚ด๊ฐ€ ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ์•„์ด์ฝ˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์žˆ๋‹ค.

๋ฐ”๋กœ react-native-vector-icons ์ด๋‹ค.

 

๋‹ค์–‘ํ•œ ํฐํŠธ์˜ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด์„œ ์ž์ฃผ ์• ์šฉํ•˜๋Š”๋ฐ, ์˜ˆ์ „์—๋Š” ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ link ํ•ด์ฃผ๋ฉด ๊ธˆ๋ฐฉ ์‚ฌ์šฉํ–ˆ์ง€๋งŒ

์ตœ๊ทผ ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ios๋กœ ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ๋Œ๋ฆฌ๊ณ  ์žˆ์—ˆ๋Š”๋ฐ, ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•œ ๋ถ€๋ถ„์—์„œ ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

 

unrecognized font family 'Feather'

 

๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๋ ค๋˜ ์•„์ด์ฝ˜์˜ font ๋ฅผ ์ธ์‹ํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์˜ค๋ฅ˜์˜€๋‹ค.

ํ .. ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ๋ฐฉ๋ฒ•์„ ์ฐพ์•˜๋‹ค.

 

 

์ฐธ๊ณ  ์‚ฌ์ดํŠธ : https://aboutreact.com/react-native-vector-icons/

์ „์ฒด ์•„์ด์ฝ˜ ํ™•์ธ : https://oblador.github.io/react-native-vector-icons/

 

 


 

 

์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์•„์ด์ฝ˜ ํŒŒ์ผ์„ import ํ•˜๋Š” ๋ฐฉ๋ฒ•.

ํ”„๋กœ์ ํŠธ์˜ android ํด๋”์— ๋“ค์–ด๊ฐ„๋‹ค.

์•„๋ž˜์™€ ๊ฐ™์ด android/app/src/main ์—์„œ assets/fonts ํด๋”๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

 

 

ํ”„๋กœ์ ํŠธ์˜ node_modules ํด๋”์— ๋“ค์–ด๊ฐ„๋‹ค.

react-native-vector-icons/Fonts ํด๋”์—์„œ ๋‚ด๊ฐ€ ์‚ฌ์šฉํ•  ์•„์ด์ฝ˜ ํฐํŠธ ํŒŒ์ผ์„ ์„ ํƒํ•˜์—ฌ ์œ„์—์„œ ์ƒ์„ฑํ•œ

android/app/src/main/assets/fonts ํด๋”์— Drag&Drop ํ•œ๋‹ค(๋˜๋Š” ๋ณต๋ถ™).

 

 

 

 


 

 

 

iOS์—์„œ ์•„์ด์ฝ˜ ํŒŒ์ผ์„ import ํ•˜๋Š” ๋ฐฉ๋ฒ•.

ํ”„๋กœ์ ํŠธ์˜ ios ํด๋”์— ๋“ค์–ด๊ฐ„๋‹ค.

fonts ํด๋”๋ฅผ ๋งŒ๋“ค๊ณ , ์•ˆ๋“œ๋กœ์ด๋“œ์™€ ๋™์ผํ•˜๊ฒŒ node_modules/react-native-vector-icons/Fonts ์•ˆ์— ์žˆ๋˜ ์›ํ•˜๋Š” ์•„์ด์ฝ˜ ํฐํŠธ ํŒŒ์ผ์„ ios/fonts ํด๋” ์•ˆ์— Drag&Drop ํ•œ๋‹ค(๋˜๋Š” ๋ณต๋ถ™).

 

 

 

๊ทธ๋ฆฌ๊ณ  xcode๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ์˜ ios ํŒŒ์ผ ์•ˆ์— ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์ด๋ฆ„.xcworkspace ํŒŒ์ผ์„ ์—ฐ๋‹ค.

 

 

 

 

์™ผ์ชฝ์˜ ์‚ฌ์ด๋“œ๋ฐ”์— ์žˆ๋Š” ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ๋งˆ์šฐ์Šค ์šฐํด๋ฆญํ•˜์—ฌ Add Files to "ํ”„๋กœ์ ํŠธ ์ด๋ฆ„"์„ ํด๋ฆญํ•œ๋‹ค.

 

 

 

 

 

 

 

ios์˜ fonts ํด๋”๋ฅผ ์„ ํƒํ•˜๊ณ  Create folder references ๋ฅผ ์ฒดํฌํ•œ ๋’ค Add ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ๋‹ค.

 

 

 

 

 

๋‹ค์Œ์€ info.plist ํŒŒ์ผ์— ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜,

 

 

 

VSCode ๋˜๋Š” ๋‹ค๋ฅธ ์—๋””ํ„ฐ๋ฅผ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ์˜ ios/ํ”„๋กœ์ ํŠธ์ด๋ฆ„/Info.plist ํŒŒ์ผ์— ์ง์ ‘ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ด์ค€๋‹ค. ( ios/fonts ํด๋”์— ์ถ”๊ฐ€ํ•ด์ค€ ํฐํŠธ๋“ค.)

<key>UIAppFonts</key>
	<array>
		<string>fonts/AntDesign.ttf</string>
		<string>fonts/Feather.ttf</string>
	</array>

 

 

 

 

 

๊ทธ๋ฆฌ๊ณ  ๋งˆ์ง€๋ง‰์œผ๋กœ 

cd ios && pod install && cd ..

๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์—ฌ pod install์„ ์ง„ํ–‰ํ•ด์ฃผ๊ณ  ํ”„๋กœ์ ํŠธ๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด ์•„์ด์ฝ˜์ด ์ •์ƒ์ ์œผ๋กœ ๋…ธ์ถœ๋œ๋‹ค.