cesardeazevedo / react-native-nested-scroll-view

react-native wrapper for android NestedScrollView
MIT License
88 stars 36 forks source link

Unable to resolve module `react-native/Libraries/Components/ScrollView/InternalScrollViewType` #27

Closed MichaelPote closed 6 years ago

MichaelPote commented 6 years ago

Getting the following error when I try replace a normal ScrollView with a NestedScrollView: I'm running React Native 0.55.4

Couldn't import script at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false. Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: { "originModulePath":"c:\Code\...\node_modules\react-native-nested-scroll-view\lib\NestedScrollView.js", "targetModuleName":"react-native/Libraries/Components/ScrollView/InternalScrollViewType", "message":"Unable to resolve module react-native/Libraries/Components/ScrollView/InternalScrollViewType from c:\\Code\\...\\node_modules\\react-native-nested-scroll-view\\lib\\NestedScrollView.js: Module react-native/Libraries/Components/ScrollView/InternalScrollViewType does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.","errors":[{"description":"Unable to resolve module react-native/Libraries/Components/ScrollView/InternalScrollViewType from c:\\Code\\...\\node_modules\\react-native-nested-scroll-view\\lib\\NestedScrollView.js: Module react-native/Libraries/Components/ScrollView/InternalScrollViewType does not exist in the Haste module map\n\nThis might [...]
cesardeazevedo commented 6 years ago

The last version only works with react-native 0.56.0, upgrade react-native or use an old version of this package.

cesardeazevedo commented 6 years ago

Also, make sure to correctly install the support library 25 ('com.android.support:design:25.3.1'), if you use an older version, see this comment https://github.com/cesardeazevedo/react-native-nested-scroll-view/issues/26#issuecomment-416420346

If you still having troubles, feel free to reopen the issue and post your build.gradle file

I hope it helps.

sandeepsingh91 commented 4 years ago

I'm facing this issue. Here is my build.gradle file

apply plugin: "com.android.application" import com.android.build.OutputFile

project.ext.react = [ entryFile: "index.js", enableHermes: false, // clean and rebuild if changing ]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false def enableProguardInReleaseBuilds = false def jscFlavor = 'org.webkit:android-jsc:+' def enableHermes = project.ext.react.get("enableHermes", false);

android { compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.executive"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

}

dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation "com.google.android.gms:play-services-auth:$googlePlayServicesAuthVersion" implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02' implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'com.android.support:design:25.3.1'

implementation project(':react-native-nested-scroll-view')

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' }

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply plugin: 'com.google.gms.google-services'