Work around Android dispatchDraw crash

This commit is contained in:
Mohamed Boudra
2025-11-15 14:56:13 +01:00
parent b85deb2906
commit 320328b0ca
4 changed files with 33 additions and 7 deletions
@@ -1,5 +1,5 @@
import { useState } from "react";
import { View, Pressable, Text } from "react-native";
import { View, Pressable, Text, Platform } from "react-native";
import { usePathname, useRouter } from "expo-router";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
@@ -25,6 +25,11 @@ export function GlobalFooter() {
const { ws } = useSession();
const { controls } = useFooterControls();
const [showCreateModal, setShowCreateModal] = useState(false);
// Guard Reanimated entry/exit transitions on Android to avoid ViewGroup.dispatchDraw crashes
// tracked in react-native-reanimated#8422.
const shouldDisableEntryExitAnimations = Platform.OS === "android";
const realtimeFadeIn = shouldDisableEntryExitAnimations ? undefined : FadeIn.duration(250);
const realtimeFadeOut = shouldDisableEntryExitAnimations ? undefined : FadeOut.duration(250);
// Determine current screen type
const isAgentScreen = pathname?.startsWith("/agent/");
@@ -89,8 +94,8 @@ export function GlobalFooter() {
{isRealtimeMode && (
<Animated.View
style={styles.realtimeSection}
entering={FadeIn.duration(250)}
exiting={FadeOut.duration(250)}
entering={realtimeFadeIn}
exiting={realtimeFadeOut}
>
<RealtimeControls />
</Animated.View>