react-navigation

React Navigation | React Navigation

React Navigation은 React Native에서 화면 전환을 할 수 있도록 도와주는 라이브러리 입니다.

설치 & 사용

<aside> 💡 자세한 내용은 아래를 참고해주세요 https://reactnavigation.org/docs/getting-started/

</aside>

react-native-reanimated-carousel

GitHub - dohooo/react-native-reanimated-carousel: 🎠 React Native swiper/carousel component, fully implemented using reanimated v2, support to iOS/Android/Web. (Swiper/Carousel)

설치 & 사용

  1. 관련 모듈을 설치해줍니다

    npm install [email protected]
    expo install --npm react-native-reanimated react-native-gesture-handler
    
  2. babel.config.js 파일을 수정해줍니다

    module.exports = function (api) {
      api.cache(true);
      return {
    		...
        plugins: ["react-native-reanimated/plugin"],
      };
    };
    
  3. Babel 설정을 위해 서버를 재실행합니다

    npm start
    
  4. Carousel을 import하여 사용합니다

    import Carousel from "react-native-reanimated-carousel";
    
    ...
    return (
    	...
    <Carousel
    	  data={banners}
    	  width={Dimensions.get("window").width}
    	  height={200}
    	  autoPlay={true}
    	  sliderWidth={Dimensions.get("window").width}
    	  itemWidth={Dimensions.get("window").width}
    	  itemHeight={200}
    	  renderItem={(obj) => {
    	    return (
    	      <TouchableOpacity
    	        onPress={() => {
    	          Alert.alert("배너 클릭");
    	        }}
    	      >
    	        <Image
    	          style={styles.bannerImage}
    	          source={{ uri: `${API_URL}/${obj.item.imageUrl}` }}
    	          resizeMode="contain"
    	        />
    	      </TouchableOpacity>
    	    );
    	  }}
    />
    	...
    )