magicismight / react-native-root-toast

react native toast like component, pure javascript solution
MIT License
2.08k stars 403 forks source link

Parent Component is re-mounted after Toast.show #84

Closed matteocollina closed 6 years ago

matteocollina commented 6 years ago

I'm using 'react-native-router-flux' as navigator, when I open a children component from Scene A as: Actions.sceneB() and in Scene B i call Toast.show("....") componentDidMount in Scene A is called and also componentDidMount in Scene B.


react-native-cli: 2.0.1 react-native: 0.55.4 react-native-root-toast: ^3.0.1

matteocollina commented 6 years ago

I found a solution! Run the Toast after some milliseconds:

setTimeout(
                function() {
                    Toast.show("Hello!" {
                        duration: Toast.durations.SHORT,
                        position: Toast.positions.BOTTOM,
                        shadow: false,
                        animation: true,
                        hideOnPress: true,
                    });
                }, 500);