I am using react-native-map and it works well on ios and android.
my react native version is 0.61.2. But in ios, when I click map, then shows warning "-[RCTRootView cancelTouches]` is deprecated and will be deleted soon.".
What is this and how to remove this warning?
See this commit which is now in react-native 0.61+
Although it says deprecated, according to the conversation in this pull request it will be added back to react-native core.
You can dismiss it till the react-native team removes the warning:
console.ignoredYellowBox = ['Warning: `-[RCTRootView cancelTouches]`'];
Or you downgrade react-native to a version below 0.61.
Some libraries like react-native-gesture-handler still call the cancelTouches method. Thats why u see this warning.
I was using react-native-gesture-handler which gave this warning on debug mode and caused crashes in release builds on both android and ios. Fixed the crashes by adding import 'react-native-gesture-handler'
at the top level of index.js.
Muhammed's answer is mostly correct, however in order to stop crashes you also need to wrap the App in the React Native Gesture Handler HOC as follows:
index.js
import 'react-native-gesture-handler'
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
index.js
AppRegistry.registerComponent(appName, () => gestureHandlerRootHOC(App));
Note You must have these imports as the very first imports for the fix to work.
This is true for React Native 61.2 and react-native-gesture-handler 1.4.1
Note: The official React Native docs suggest using the YellowBox
module to ignore the warnings as. For example:
import {YellowBox} from 'react-native';
YellowBox.ignoreWarnings(['`-[RCTRootView cancelTouches]`']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With