将浅色模式更改为深色模式时,React 本机应用程序崩溃

React native App crashes when changing into light to dark mode

我的 React 本机应用程序的系统黑暗模式在 ios 中运行良好,但在 android 中它崩溃并显示应用程序停止工作。我已附上 logcat 以供参考。

    java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
        at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
        at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
        at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:311)
        at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:920)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
        at com.onesignal.OSUtils.packageInstalledAndEnabled(OSUtils.java:275)
        at com.onesignal.OSUtils.isGMSInstalledAndEnabled(OSUtils.java:288)
        at com.onesignal.OSUtils.supportsGooglePush(OSUtils.java:330)
        at com.onesignal.OSUtils.getDeviceType(OSUtils.java:349)
        at com.onesignal.OSUtils.isAndroidDeviceType(OSUtils.java:371)
        at com.onesignal.LocationController.isGooglePlayServicesAvailable(LocationController.java:337)
        at com.onesignal.LocationController.onFocusChange(LocationController.java:325)
        at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1308)
        at com.onesignal.OSFocusHandler$Companion.onLostFocusDoWork(OSFocusHandler.kt:139)
        at com.onesignal.OSFocusHandler$OnLostFocusWorker.doWork(OSFocusHandler.kt:118)
        at androidx.work.Worker.run(Worker.java:86)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:920) 
2022-04-10 00:04:17.649 20348-21057/com.myapp E/StudioTransport: JVMTI error: 79(JVMTI_ERROR_UNMODIFIABLE_CLASS) 

非常感谢回答者

  protected void onCreate(Bundle savedInstanceState) {
    SplashScreen.show(this); 
    super.onCreate(null);
  }
Adding this in mainactivity.java saved my career