Skip to content

Android crash on RN 0.84: react-native.config.js uses removed reactNativeHost #1074

Description

@myxmaster

React Native 0.84 removed ReactNativeHost in favor of ReactHost. The autolinking config in react-native.config.js hardcodes:
packageInstance: 'new RNNotificationsPackage(reactNativeHost.getApplication())'

In RN 0.84, PackageList is constructed with Application directly, so reactNativeHost is null in the generated PackageList.java, causing an immediate crash on app launch:

java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Application com.facebook.react.ReactNativeHost.getApplication()' on a null object reference
    at com.facebook.react.PackageList.getPackages(PackageList.java)

Fix: Change reactNativeHost.getApplication() to application in react-native.config.js:
packageInstance: 'new RNNotificationsPackage(application)'

application is the field that PackageList sets when constructed with the Application overload.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions