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

Android: Method does not override or implement a method from a supertype #14

Open
jjenzz opened this issue Aug 28, 2018 · 7 comments
Open

Comments

@jjenzz
Copy link

jjenzz commented Aug 28, 2018

When attempting to use this package on Android I am getting the following error:

TouchThroughViewPackage.java:27: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error

Environment

Environment:
  OS: macOS High Sierra 10.13.1
  Node: 8.11.1
  Yarn: 1.5.1
  npm: 5.6.0
  Watchman: Not Found
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.2 => 0.55.2
@jjenzz jjenzz changed the title Android - Method does not override or implement a method from a supertype: @Override Android: Method does not override or implement a method from a supertype Aug 28, 2018
@martsie
Copy link

martsie commented Aug 28, 2018

I think this issue is similar to what react-native-device-info faced over at react-native-device-info/react-native-device-info#213 after rn 0.44.

Can you try removing @override from line 72 of TouchThroughPackage.java? If that works send through a pull request (can use the github editor for such a small change if you'd rather not do a full checkout) and we'll get it approved and published to npm.

@jjenzz
Copy link
Author

jjenzz commented Aug 29, 2018

@martsie If I remove the @Override from line 27 of TouchThroughViewPackage.java then the error goes away but I cannot click through the TouchThroughView.

Also, I'm not a Java developer by any means but the repo version of the Java file differs from the one I have locally so I am unable to submit a PR with the change.

Repo version: https://github.com/rome2rio/react-native-touch-through-view/blob/master/android/src/main/java/com/rome2rio/android/reactnativetouchthroughview/TouchThroughViewPackage.java#L25

Versus local version:

public class TouchThroughViewPackage implements ReactPackage {
    public TouchThroughViewPackage(Activity activity) {
    } // backwards compatability

    public TouchThroughViewPackage() {
    }

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

    // I removed @Override from here but this does not exist in repo
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        TouchThroughViewManager touchThroughViewManager = new TouchThroughViewManager();
        TouchThroughWrapperManager touchThroughWrapperManager = new TouchThroughWrapperManager();

        return Arrays.<ViewManager>asList(touchThroughViewManager, touchThroughWrapperManager);
    }
}

@jjenzz
Copy link
Author

jjenzz commented Aug 31, 2018

@martsie Do you know how I make this change in the repo? It would be good to get it in so the app at least builds on Android and then I can raise a separate issue for the TouchThroughView not working on Android.

@derekblank
Copy link

@jjenzz The createJSModules() method in your local version was removed from the repo on July 10th, so you may have an older version of the library.

Also, are you using react-native-navigation?

@jjenzz
Copy link
Author

jjenzz commented Sep 14, 2018

@derekblank has that been published? An npm view react-native-touch-through-view yields:

{ name: 'react-native-touch-through-view',
  description: 'React Native Touch Through View is a simple component library that allows for scroll views and table views to scroll over interactable content without poor performing size and bounds animations.',
  'dist-tags': { latest: '0.1.4' },
  versions: [ '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4' ],
// etc...

I am on 0.1.4 and we are using react-navigation, why do you ask?

@derekblank
Copy link

derekblank commented Sep 14, 2018

@jjenzz You're right, 0.1.4 is the latest. Was curious if you were using react-native-navigation because I know it won't work with this library as-is. @simonhoss did some great work to fix some Android issues in general on a fork of this repo here, in addition to providing support for react-native-navigation. As a test, you could point your package.json there to see if it fixes things for you.

@simonhoss / @martsie - what do you think about trying another PR to pull in Simon's work? I have been using that fork in a production app for several months without issue, and can confirm that it works with both react-navigation and react-native-navigation on Android with react-native v0.56.

@simonhoss
Copy link

Hi

Pull requests to my fork are always welcome. If rome2rio are not interested anymore to maintain this project I would continue it from my fork.

Greets

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

4 participants