I\'m working on a react-native IOS app, and this app sometimes will raise a Warning message \"setState(...) Can only update a mounted or mounting component. ...\", I underst
To disable only the setState message
The "setState(...) Can only update a mounted or mounting component." is thrown from 4 possible files :
- node_modules/react/dist/react-with-addons.js
- node_modules/react/dist/react.js
- node_modules/react/lib/ReactNoopUpdateQueue.js
- node_modules/react/lib/ReactUpdateQueue.js
I don't know which one triggered yours, but you can modify those files to not show the warning. If your concern is for your users, that is to say in release mode, then the dev flag is false which means that will not see any warning messages.
To disable all warnings
To disable the warnings, just change this in your AppDelegate.m :
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
to
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=false"];
If you're using the pre-bundled file you'll have to specify dev as false when bundling :
react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios