How to solve issue “native base toast is not showing in react native modal”

Spread the love

How to solve issue “native base toast is not showing in react native modal”

If you are using native base in your project, you might encounter this issue when you want to use component native base Toast inside react native Modal component. Native base Toast

It’s very easy to fix this issue, we just need to create another class extend from native base Toast

import { Toast } from 'native-base';

class MyToast extends Toast {}

export default MyToast;

Then in the react native modal, you import it and use it just like you are using native base Toast

import MyToast from '../commons/myToast';

...

MyToast.show({
  text: I18n.t('please_select_segment'),
  buttonText: I18n.t('okay'),
  duration: 3000,
  position: 'bottom',
});

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *