简体   繁体   中英

I want to implement Toast into my react native app

import Toast from 'react-native-simple-toast';

I am using this library to use react-native toast,but this library is giving error every time.

please suggest me a library that could work. I need to implement Toast in my app.

import Toast from 'react-native-simple-toast';

Toast.show(`PLAY SERVICES NOT AVAILABLE`, Toast.LONG)

Try with this. if not work then let me know which type of error you got?

You can also use Platform base like this

if(Platform.OS == 'ios'){
   Toast.show(`PLAY SERVICES NOT AVAILABLE`, Toast.LONG)
}else{
   ToastAndroid.showWithGravityAndOffset('PLAY SERVICES NOT AVAILABLE',ToastAndroid.LONG, ToastAndroid.BOTTOM, 25,50)
}
import Toast from 'react-native-toast-message';

function SomeComponent() {
  React.useEffect(() => {
    Toast.show({
      text1: 'Hello',
      text2: 'This is some something 👋'
    });
  }, []);

  return <View />;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM