Crash on startup if app is closed before splash screen.

Please provide the following:

  1. SDK Version: 40.0.1
  2. Platforms(Android/iOS/web/all): Android 10
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Uncaught Error: Attempt to invoke virtual method ‘boolean abi40_0_0.host.exp.exponent.modules.api.reanimated.NativeProxy.isAnyHandlerWaitingForEvent(java.land.String)’ on a null object reference

If the app is closed before fully loading, this error will occur
Problem occurs on a release apk as well, if the app is ended before splash loading, it will crash on next launch

See video and screenshot:

Code:

import * as React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import Animated from 'react-native-reanimated';
import BottomSheet from 'reanimated-bottom-sheet';

export default function App() {
  const renderContent = () => (
    <View
      style={{
        backgroundColor: 'white',
        padding: 16,
        height: 450,
      }}
    >
      <Text>Swipe down to close</Text>
    </View>
  );

  const sheetRef = React.useRef(null);

  return (
    <>
      <View
        style={{
          flex: 1,
          backgroundColor: 'papayawhip',
          alignItems: 'center',
          justifyContent: 'center',
        }}
      >
        <Button
          title="Open Bottom Sheet"
          onPress={() => sheetRef.current.snapTo(0)}
        />
      </View>
      <BottomSheet
        ref={sheetRef}
        snapPoints={[450, 300, 0]}
        borderRadius={10}
        renderContent={renderContent}
      />
    </>
  );
}

With newly created expo project (app.json):

{
  "expo": {
    "name": "test_app",
    "slug": "test_app",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      }
    },
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

This error is not related to the package BottomSheet from ‘reanimated-bottom-sheet’… the functionality works fine, it is an error with expo loading the reanimated package.
This occurs with other reanimated use cases

Through some research this may be related to Issue in expo 39 in start up in android sometimes or OTA updates but I’m not quite sure

Edit: this also may be related to the crash BaseExperienceActivity.lambda$consumeErrorQueue$0
java.lang.RuntimeException
at.
(BaseExperienceActivity.java:210)
at .(-java:2)