Skip to content

App Crash on Reload with expo reloadAppAsyncΒ #2834

Open
@pvturchik

Description

Description
I used a basic example from the documentation to draw a line using the Points component. The app crashes upon attempting to reload using the reloadAppAsync() function from expo. I have not tested other examples. Note that the application may not crash on the first attempt; sometimes, it requires multiple reloads to reproduce the issue. The crash occurs both in Expo Go and in the release build (tested on iOS)

In my real project, where I render many elements using the skia library, the crash happens consistently on every reload attempt.

In the video, you can see the app flickering β€” this happens when I press the "Reload app" text. On one of the reloads, the app crashes.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-12-23.at.19.16.48.mp4

Steps to reproduce

  1. Create a new Expo project - npx create-expo-app@latest (my version is 52.0.20)
  2. Install the @shopify/react-native-skia dependency - npx expo install @shopify/react-native-skia (expo installs 1.5.0 version in my project)
  3. Use the following code in your component
import { reloadAppAsync } from 'expo';
import { Pressable, Text, View } from "react-native";
import { Canvas, Points, vec } from "@shopify/react-native-skia";

const points = [
  vec(128, 0),
  vec(168, 80),
  vec(256, 93),
  vec(192, 155),
  vec(207, 244),
  vec(128, 202),
  vec(49, 244),
  vec(64, 155),
  vec(0, 93),
  vec(88, 80),
  vec(128, 0),
];

export default function Chart() {
  function reload() {
    reloadAppAsync();
  }

  return (
    <View style={{ flex: 1, backgroundColor: '#D0D0D0' }}>
      <Canvas style={{ height: 500 }}>
        <Points
          points={points}
          mode="polygon"
          color="lightblue"
          style="stroke"
          strokeWidth={4}
        />
      </Canvas>
      <Pressable onPress={reload}>
        <Text style={{ fontSize: 24 }}>
          Reload app
        </Text>
      </Pressable>
    </View>
  );
}

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