react-native使用自定义toast组件

yarn add react-native-easy-toast;

app.js
import Toast, {DURATION} from 'react-native-easy-toast';

const toast = useRef(null);

return( ...rest code )

使用:
useEffect(() => { toast.current?.show('加载中...', DURATION.FOREVER); setTimeout(() => { toast.current?.close(); }, 10000); }, []);

你可能感兴趣的:(react-native使用自定义toast组件)