민희의 코딩일지

[React Native] setting error (Pods, twrnc) 본문

WEB FE/React Native

[React Native] setting error (Pods, twrnc)

heehminh 2024. 1. 5. 12:05
반응형

#1. ios/Pods 에러

cd ios

(Podfile이 있는 디렉토리)

sudo arch -x86_64 gem install ffi

arch -x86_64 pod install

#2. react-native에서 활용할 수 있는 tailwind.css 라이브러리

nativewind, tailwind-rn, twrnc 크게 이 세종류인것같은데, 나는 twrnc로 진행하였다. 

https://www.npmjs.com/package/twrnc?activeTab=readme

 

twrnc

simple, expressive API for tailwindcss + react-native. Latest version: 3.6.7, last published: 18 days ago. Start using twrnc in your project by running `npm i twrnc`. There are 27 other projects in the npm registry using twrnc.

www.npmjs.com

npm install twrnc 

import {View, Text} from 'react-native';
import React from 'react';
import tw from 'twrnc';

const LandingPage = () => {
  return (
    <View style={tw`flex-1 bg-[#dfdfdf] items-center justify-center`}>
      <Text style={tw`text-[#51245f] font-bold text-[20]`}>Test</Text>
    </View>
  );
};

export default LandingPage;

이 Test라는 Text에 tailwind가 적용된걸 확인할 수 있다. 

저 코드에서 배경색을 지정할 때 대괄호를 썼다. bg-[#dfdfdf] 

미리 지정해놓고 가져다쓰는것도 찾아봐야겠다 (React에서는 tailwind.config.js에 등록)

반응형

'WEB FE > React Native' 카테고리의 다른 글

[React Native] react-native-document-scanner 사용법  (0) 2024.03.18
Comments