Error React-Nactivate-Esture-Handler in version React-Native 0.60.0

Asked

Viewed 1,892 times

4

Guys, I have a problem with React Navigation after the last update of React-Native for version 0.60.0

The react-native-gesture-handler is not compatible because of a autolink that the new version of React-Native has.

I’ve searched everything that is forum and I haven’t seen anyone with the solution, to run my project after installing the react-native-gesture-handler.

Here’s what I did to make it clear:

I created the project with:

react-native init PROJETO;

I installed the React-navigation:

yarn add react-navigation 

(Obs: I tried with NPM too)

I installed the react-native-gesture-handler:

yarn add react-native-gesture-handler 

(Obs: also with NPM);

Linkei, as the manual says:

react-native link react-native-gesture-handler

I made the necessary changes to Mainactivity.java, also according to the manual.

But when I run the project:

react-native run-android

Makes the mistake:

error React Native CLI uses autolinking for native dependencies, but the following
  modules are linked manually:

react-native-gesture-handler (
  to unlink run: "react-native unlink react-native-gesture-handler")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. 
Going forward, you can unlink this dependency via "react-native unlink " and it 
  will be included in your app automatically. 
If a library isn't compatible with autolinking, disregard this message and notify 
  the library maintainers. 

My dependencies are like this:

"dependencies": {
    "react": "16.8.6",
    "react-native": "0.60.0",
    "react-native-gesture-handler": "^1.3.0",
    "react-navigation": "^3.11.0"
  }

If anyone knows the solution, help me, VLW !!!

4 answers

4


React-Native-Gesture-Handler supports autolinking on Android but the problem is that it is not yet compatible with Androidx.

  1. Undo the Link (if you have) of the project manually

    react-native unlink react-native-gesture-handler

  2. Install the Jetifier

    yarn add jetifier -D ou npm install --save-dev jetifier

    The Jetifier (https://www.npmjs.com/package/jetifier) helps make the library compatible with your Androidx project by converting all dependency packages to build time.

  3. Now open the project’s package.json file and add this line in the Scripts section:

    "postinstall": "npx jetify" inserir a descrição da imagem aqui

  4. Now run npm install or Yarn. You will see something similar on the console inserir a descrição da imagem aqui

  5. Make the adjustments in Mainactivity.java, comfort the steps of the official documentation https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#android

SOURCE: https://medium.com/@jeancabral/https-medium-com-rocketseat-using-React-Native-Gesture-Handler-com-a-versao-0-60-do-React-Native-17b4ec8343bb

3

2

Taken from the link: How can I disable autolinking for Unsupported library?

How can I disable autolinking from an unsupported library?

During the transition period, some packages may not support autolinking on certain platforms. To disable autolinking of a package, update the input dependencies of React-Native.config.js to look like this:

// react-native.config.js
module.exports = {
  dependencies: {
    'some-unsupported-package': {
      platforms: {
        android: null, // disabilitar na plataforma Android, outras plataformas ainda utilizaram o autolink se fornecido.
      },
    },
  },
};

As I said in the question comment there is an open request for this problem https://github.com/kmagiera/react-native-gesture-handler/.

I haven’t yet ventured into this world of React-Native, but I hope the links posted here can help you out. = P

2

I had this same problem. I tried everything and nothing worked, and the worst was the slowness and high memory consumption when I tried to give the start.

The solution I found was to go back to version 0.59.9, now everything is working smoothly.

I’m creating the project like this:

react-native init --version 0.59.9 nomeprojeto
  • It didn’t work that way either, unfortunately, I’ll try other ways. I think that when installing version 0.59.9, other dependencies are being updated, and are conflicting with React-Native-Gesture-Handler, in addition to React-Native.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.