react-native-safe-area-context: Build failed on RN version 0.69.1

node_modules/react-native-codegen/lib/parsers/typescript/index.js:191
        throw parsingErrors[0];
        ^

UnusedModuleTypeScriptInterfaceParserError: Module NativeSafeAreaContext.d: Unused NativeModule spec. Please load the NativeModule by calling TurboModuleRegistry.get<Spec>('<moduleName>').

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 15 (1 by maintainers)

Most upvoted comments

does anyone solved it?? am getting the same

If you start a new project with 0.69 you don’t need to do thats changes in your project. To enable new architecture on android you can, set the newArchEnabled property to true by either:

  • Changing the corresponding line inside the android/gradle.properties file.
  • Set an environment variable ORG_GRADLE_PROJECT_newArchEnabled=true
  • Invoke Gradle with -PnewArchEnabled=true

And nothing more.

If you, like us 😃, make changes from Prerequisites for Applications from official documentation for new 0.69 project, or you upgrade to 0.69 from previous versions (with new acrhitecture enabled) you need to remove from <your-project-dir>/android/app/build.gradle this lines:

apply plugin: "com.facebook.react"

react { reactRoot = rootProject.file("../node_modules/react-native/") codegenDir = rootProject.file("../node_modules/react-native-codegen/") }

And this: implementation project(":ReactAndroid")

replace with:

implementation "com.facebook.react:react-native:+"

Did you create a new project with version 0.69.1 or update an existing project with an older react-native version?

I’m using a fresh npx react-native init project.

Steps to reproduce:

  • create new project using npx react-native init
  • change to the new architecture, make sure its building correctly
  • add react-native-safe-area-context and try to rebuild with npx react-native android.
E:\projetos\reactnice\node_modules\react-native-codegen\lib\parsers\typescript\index.js:191
        throw parsingErrors[0];
        ^

UnusedModuleTypeScriptInterfaceParserError: Module NativeSafeAreaContext.d: Unused NativeModule spec. Please load the NativeModule by calling TurboModuleRegistry.get<Spec>('<moduleName>').

I suspect this is related to the react-native-code-gen Gonna try to build it w/o the lib in the project after lunch and report back.