Water Flower
Water Flower

Reputation: 404

-[RCTRootView cancelTouches]` is deprecated and will be deleted soon in react native map

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

Answers (4)

RB RB
RB RB

Reputation: 166

console.ignoredYellowBox = true will remove all warnings

Upvotes: 0

Andrew Koster
Andrew Koster

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

MrNickel
MrNickel

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

Muhammed B. Aydemir
Muhammed B. Aydemir

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

Related Questions