mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Merge pull request #3271 from inaturalist/mob-963-change-slideover-menu-to-be-a-static-page
Mob 963 change slideover menu to be a static page
This commit is contained in:
@@ -175,6 +175,30 @@ jest.mock( "components/Camera/FadeInOutView", () => {
|
||||
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 = {
|
||||
|
||||
@@ -11,14 +11,6 @@ import faker from "tests/helpers/faker";
|
||||
import { renderComponent } from "tests/helpers/render";
|
||||
import setStoreStateLayout from "tests/helpers/setStoreStateLayout";
|
||||
|
||||
jest.mock( "@react-navigation/drawer", ( ) => {
|
||||
const actualNav = jest.requireActual( "@react-navigation/drawer" );
|
||||
return {
|
||||
...actualNav,
|
||||
useDrawerStatus: jest.fn( ( ) => false )
|
||||
};
|
||||
} );
|
||||
|
||||
const initialPersistedStoreState = useStore.getState( );
|
||||
|
||||
const mockUser = factory( "LocalUser", {
|
||||
|
||||
@@ -60,7 +60,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
|
||||
testID="CustomTabBar"
|
||||
>
|
||||
<View
|
||||
accessibilityHint="Opens the side drawer menu."
|
||||
accessibilityHint="Navigates to main menu."
|
||||
accessibilityLabel="Menu"
|
||||
accessibilityRole="tab"
|
||||
accessibilityState={
|
||||
@@ -122,7 +122,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
|
||||
],
|
||||
]
|
||||
}
|
||||
testID="OPEN_DRAWER"
|
||||
testID="Menu"
|
||||
>
|
||||
<View
|
||||
style={
|
||||
|
||||
Reference in New Issue
Block a user