diff --git a/e2e/sharedFlows/switchPowerMode.js b/e2e/sharedFlows/switchPowerMode.js
index fc9ef91d6..6f1940a30 100644
--- a/e2e/sharedFlows/switchPowerMode.js
+++ b/e2e/sharedFlows/switchPowerMode.js
@@ -7,6 +7,8 @@ const TIMEOUT = 10_000;
export default async function switchPowerMode() {
const menuButton = element( by.id( "OPEN_MENU" ) );
+ // Temporarily disable synchronization to work around fade animation timing
+ // issues that can cause Detox to wait indefinitely for animations to complete
await device.disableSynchronization();
await waitFor( menuButton ).toBeVisible().withTimeout( TIMEOUT );
await menuButton.tap( { x: 0, y: 0 } );
diff --git a/src/navigation/BottomTabNavigator/index.tsx b/src/navigation/BottomTabNavigator/index.tsx
index fbf83c2b0..d2949fc9e 100644
--- a/src/navigation/BottomTabNavigator/index.tsx
+++ b/src/navigation/BottomTabNavigator/index.tsx
@@ -18,8 +18,6 @@ const Tab = createBottomTabNavigator( );
const BottomTabs = ( ) => {
const renderTabBar = ( props: BottomTabBarProps ) => ;
- const isTest = process.env.JEST_WORKER_ID !== undefined;
-
// DEVELOPERS: do you need to add any screens here? All the rest of our screens live in
// NoBottomTabStackNavigator, TabStackNavigator, or LoginStackNavigator
@@ -33,9 +31,7 @@ const BottomTabs = ( ) => {
lazy: true,
freezeOnBlur: true,
headerShown: false,
- animation: isTest
- ? "none"
- : "fade"
+ animation: "fade"
}}
>
{
return jest.fn( ( ) => React.createElement( View, null ) );
} );
+// Mock @react-navigation/bottom-tabs to disable animations in Jest tests
+// This prevents the act() warnings caused by fade animations triggering state updates
+jest.mock( "@react-navigation/bottom-tabs", () => {
+ const React = require( "react" );
+ const actual = jest.requireActual( "@react-navigation/bottom-tabs" );
+ const createBottomTabNavigator = () => {
+ const Tab = actual.createBottomTabNavigator();
+ const OriginalNavigator = Tab.Navigator;
+ Tab.Navigator = function Navigator( props ) {
+ const { screenOptions, ...restProps } = props;
+ // Override animation to "none" for both function and object screenOptions
+ const modifiedScreenOptions = typeof screenOptions === "function"
+ ? route => ( { ...screenOptions( route ), animation: "none" } )
+ : { ...screenOptions, animation: "none" };
+ return React.createElement(
+ OriginalNavigator,
+ { ...restProps, screenOptions: modifiedScreenOptions }
+ );
+ };
+ return Tab;
+ };
+ return { ...actual, createBottomTabNavigator };
+} );
+
// this silences console methods in jest tests, to make them less noisy
// and easier to debug. uncomment if you want to silence them
global.console = {