React-native-linear-gradient: Unimplemented View when integrated with existing Android project

Created on 3 May 2017  路  3Comments  路  Source: react-native-linear-gradient/react-native-linear-gradient

I'm getting the red border mentioned in #143 in a react-native view I've otherwise successfully integrated into a preexisting Android app. I have a mostly empty react-native activity/view with just react-native-linear-gradient and some text.

I've rebuilt, cleaned, restarted, and done every other fix mentioned in the related issues I've seen on here - the only one that I can't easily do is init a new project. I installed react-native at 0.43.3 with no upgrades and am using react-native-linear-gradient at 2.0.0. I don't see any relevant information in the app logs.

Thanks!

build.gradle

dependencies {
    compile project(':react-native-linear-gradient')

    compile 'com.android.support:appcompat-v7:23.3.0'

    compile 'com.android.support:design:23.3.0'
    compile "com.facebook.react:react-native:+"  // From node_modules
    testCompile 'junit:junit:4.12'
}

settings.gradle

include ':app'
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')

MainApplication.java

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost;

    public MainApplication() {
        mReactNativeHost = new ReactNativeHost(this) {
            @Override
            public boolean getUseDeveloperSupport() {
                return BuildConfig.DEBUG;
            }

            @Override
            protected List<ReactPackage> getPackages() {
                return Arrays.<ReactPackage>asList(
                        new MainReactPackage(),
                        new LinearGradientPackage()
                );
            }
        };
    }

    @Override
    public ReactNativeHost getReactNativeHost() {
        return mReactNativeHost;
    }
}

Most helpful comment

After set, you have to run react-native run-android/ios again, because use native module.

All 3 comments

I have the same problem. If you find a solution, please post it here.

After set, you have to run react-native run-android/ios again, because use native module.

problem with link

Was this page helpful?
0 / 5 - 0 ratings