Toast component for both platform Android and iOS.
Using scalessec/Toast on iOS
and android.widget.Toast on Android.
This project inspired by scalessec/Toast, remobile/react-native-toast
$ yarn add rn-x-toast
$ cd ios && pod install
$ npx react-native run-ios
$ npx react-native run-android
import React from 'react'
import { TouchableOpacity } from 'react-native'
import Toast from 'rn-x-toast';
type DurationType = 'LONG' | 'DEFAULT' | 'SHORT'
/*
Duration(seconds) to show Toast: LONG = 3.5, DEFAULT = 2, SHORT = 1
*/
function SomeComponent() {
const doToast = () => {
Toast.showToastCenter('Toast some message in the center', 'LONG');
// Toast.showToastTop();
// Toast.showToastBottom();
}
return (
<TouchableOpacity onPress={doToast}>
<Text>{"Press Me To Toast"}</Text>
</TouchableOpacity>
)
}
export default SomeComponent
- Toast on IOS with small icon/image on the head-left of message
- Toast message can be use with fontstyle/fontsize/fontweight/fontfamily/...otherTextStyles
contact: https://t.me/minhnh1996