“RNCSafeAreaView” was not found in the UIManager

前端 未结 6 1421
难免孤独
难免孤独 2021-02-13 09:56

I try to open a bundle, but when the android is running it shows the next message

2020-01-05 23:15:45.366 26210-26210/com.note.principal W/.note.princi

6条回答
  •  故里飘歌
    2021-02-13 10:39

    I was searched and found the next,

    first, you need to clean the project

    Second import modules at project

    include ':app'
    rootProject.name='Notes'
    
    
    include ':hermes-engine'
    project(':hermes-engine').projectDir = new File(rootProject.projectDir, '../node_modules/hermes-engine/android/')
    
    include ':react-native-gesture-handler'
    project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
    
    include ':react-native-linear-gradient'
    project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
    
    include ':react-native-linear-gradient'
    project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
    
    include ':react-native-safe-area-context'
    project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-safe-area-context/android')
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation "com.facebook.react:react-native:+"
        implementation 'com.android.support:support-annotations:27.1.1'
        implementation project(':react-native-gesture-handler')
        implementation project(':react-native-linear-gradient')
        implementation project(':react-native-safe-area-context')
    
        if (enableHermes) {
            implementation project(':hermes-engine')
            debugImplementation files(hermesPath + "hermes-debug.aar")
            releaseImplementation files(hermesPath + "hermes-release.aar")
        } else {
            implementation jscFlavor
        }
    }
    
    
     override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            SoLoader.init(this, false)
            mReactRootView = ReactRootView(this)
            mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(application)
                .setCurrentActivity(this)
                .setApplication(application)
                .setBundleAssetName("index.android.bundle")
                .addPackage(MainReactPackage())
                .addPackage(RNGestureHandlerPackage())
                .addPackage(LinearGradientPackage())
                .addPackage(SafeAreaContextPackage())
                .addPackage(SDKCorePackage())
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build()
            // The string here (e.g. "MyReactNativeApp") has to match
            // the string in AppRegistry.registerComponent() in index.js
            mReactRootView.startReactApplication(mReactInstanceManager, "Notes", null)
    
            setContentView(mReactRootView)
    
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                if (!Settings.canDrawOverlays(this)) {
                    val intent = Intent(
                            Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                            Uri.parse("package:$packageName")
                    )
                    startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE)
                }
            }
        }
    

    i will hope that it will be useful, also this link helped me

    react-native-safe-area-context

提交回复
热议问题