Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On RN 61 we have errors. #81

Open
neller1 opened this issue Sep 26, 2019 · 6 comments
Open

On RN 61 we have errors. #81

neller1 opened this issue Sep 26, 2019 · 6 comments

Comments

@neller1
Copy link

neller1 commented Sep 26, 2019

Because netinfo module was deleted in RN 61 we have error:
ThreadBaseReactPackage.java:13: error: package com.facebook.react.modules.netinfo does not exist

I commented 13 and 49 strings in ThreadBaseReactPackage.java to temporary start project

@dwhitney
Copy link

I've done this, but I get a compile error

/TestNative/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:51: error: constructor RNThreadPackage in class RNThreadPackage cannot be applied to given types;
      new RNThreadPackage()
      ^
  required: ReactNativeHost,ReactPackage[]
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

FAILURE: Build failed with an exception.

I've definitely added the relevant lines to getPackages - here's a cut/paste

        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          packages.add(new RNThreadPackage(mReactNativeHost));
          return packages;
       }

Any suggestions?

@minicuper
Copy link

minicuper commented Oct 2, 2019

The same problem. Tried to use tarball version - "react-native-threads": "http://github.com/joltup/react-native-threads/tarball/master"

but it leads to the same error: "error: package com.facebook.react.modules.netinfo does not exist
import com.facebook.react.modules.netinfo.NetInfoModule;"

Do we plan to update rnt for 61? Or maybe there are alternatives?

@minicuper
Copy link

minicuper commented Oct 2, 2019

Found how to do the trick.

  1. use https://github.com/jhen0409/react-native-threads/tree/rn61 (or just remove 13 and 49 lines as in the first topic)
    yarn add http://github.com/jhen0409/react-native-threads/tarball/rn61
    or
    npm i http://github.com/jhen0409/react-native-threads/tarball/rn61

  2. manually link the package
    react-native link react-native-threads

  3. turn off linking for android (according to [Android] Support React Native v0.60 #76 and https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library)

// react-native.config.js
module.exports = {
  dependencies: {
    'react-native-threads': {
      platforms: {
        android: null, 
      },
    },
  },
};

Dirty hacks but working...

@minicuper
Copy link

So, now we have 2 issues to get 61:

  1. need to remove netinfo package (the 13, 49 lines in the ThreadBaseReactPackage.java)
  2. somehow setup auto-linking for 61 (taking into account that RNThreadPackage requires additional parameters: at least ReactNativeHost + additional native packages that should be available in the Thread)

@ihavenoface5
Copy link
Contributor

#84

@jacobp100
Copy link

I was able to fix this by adding this file to the root,

// react-native.config.js
module.exports = {
  dependencies: {
    'react-native-threads': {
      platforms: {
        android: null, 
      },
    },
  },
};

And then just following the manual linking step. I didn't need to use another repo, this one worked fine with the above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants