react-native-easy-toast icon indicating copy to clipboard operation
react-native-easy-toast copied to clipboard

Can't call setState

Open grobmeier opened this issue 7 years ago • 4 comments

with the example from the readme:

this.refs.toast.show('Time was added successfully.');

I get this:

ExceptionsManager.js:71 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in Toast (at ConfirmScene.js:102)
    in RCTView (at View.js:60)
    in View (at ConfirmScene.js:55)
    in ConfirmScene (created by Connect(ConfirmScene))
    in Connect(ConfirmScene) (at SceneView.js:17)

RN is version is 0.55.3

grobmeier avatar Apr 28 '18 20:04 grobmeier

Did you put the toaster view in the render method ?

render() { return ( <View style={styles.container}> ... <Toast ref="toast"/> </View> ); }

hassanamin994 avatar May 26 '18 01:05 hassanamin994

@hassanamin994 I do have the Toast in render(). Is that an issue?

t2 avatar Jun 02 '18 15:06 t2

Any updates on this?

cdunkel avatar Feb 14 '19 14:02 cdunkel

I've created a PR to address this issue:

https://github.com/crazycodeboy/react-native-easy-toast/pull/66

cdunkel avatar Feb 19 '19 16:02 cdunkel