반응형
라이브러리 공식문서
https://www.npmjs.com/package/react-native-root-toast?activeTab=readme
react-native-root-toast
react native toast like component, pure javascript solution. Latest version: 4.0.1, last published: 4 months ago. Start using react-native-root-toast in your project by running `npm i react-native-root-toast`. There are 89 other projects in the npm registr
www.npmjs.com
기본 사용법에서 텍스트 넣는 자리에 컴포넌트 바로 넣으면 됨!
import Button from "@/components/common/Button";
import React from "react";
import { Image, Text, View } from "react-native";
import Toast from "react-native-root-toast";
export default function HomeScreen() {
const showToastWithImage = () => {
Toast.show(
<View
style={{
flexDirection: "row",
alignItems: "center",
backgroundColor: "white",
padding: 10,
borderRadius: 5 }}
>
<Image
source={require("@/assets/images/img.gif")}
style={{ width: 50, height: 50, marginRight: 10 }}
/>
<Text>This is a toast with a GIF!</Text>
</View>,
{
duration: Toast.durations.LONG,
position: Toast.positions.BOTTOM,
shadow: true,
animation: true,
hideOnPress: true,
delay: 0,
},
);
};
return <Button text="Toast with GIF" onPress={showToastWithImage} />;
}
반응형
'React Native' 카테고리의 다른 글
| npx expo run:android fails: Plugin [id: 'expo-module-gradle-plugin'] was not found in any of the following sources: 에러 해결 (0) | 2025.08.13 |
|---|---|
| app build에 대하여 (1) | 2025.08.06 |
| [RN] expo Stack과 Tabs의 차이 이전화면으로 뒤로 가기 안되는 이유 (0) | 2025.07.07 |
| yarn local package 만드는 법 (1) | 2025.05.29 |
| [expo] expo-camera를 이용해서 바코드 스캔 구현하기 (0) | 2025.04.29 |