Reputation: 404
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?
Upvotes: 7
Views: 3756
Reputation: 1845
This was happening while using react-native-video
(whenever I clicked inside a video that was playing). I upgraded react-native-gesture-handler
to version 1.5.2 and the warning went away.
Upvotes: -1
Reputation: 426
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]`']);
Upvotes: 8
Reputation: 1015
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.
Upvotes: 19