Skip to content

Commit 5f60c77

Browse files
authored
Merge pull request Expensify#85234 from software-mansion-labs/root-tab-navigator
Introduce a Bottom Tab Navigator for Top-Level Navigation
2 parents b081f54 + 5c59005 commit 5f60c77

113 files changed

Lines changed: 3058 additions & 1701 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ const metro = {
130130
production: {
131131
plugins: [['transform-remove-console', {exclude: ['error', 'warn']}]],
132132
},
133+
test: {
134+
plugins: ['@babel/plugin-transform-dynamic-import'],
135+
},
133136
},
134137
};
135138

jest/setupAfterEnv.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import '@testing-library/react-native';
2+
import type {KeyboardEventName} from 'react-native';
3+
import {Keyboard} from 'react-native';
24
import Onyx from 'react-native-onyx';
35
import ONYXKEYS from '@src/ONYXKEYS';
46

57
jest.useRealTimers();
68

9+
// Patch Keyboard.addListener to return a subscription object with .remove() so that
10+
// @react-navigation/bottom-tabs useIsKeyboardShown hook doesn't crash on cleanup.
11+
if (Keyboard && typeof Keyboard.addListener === 'function') {
12+
const originalAddListener = Keyboard.addListener.bind(Keyboard);
13+
Keyboard.addListener = ((event: KeyboardEventName, callback: () => void) => {
14+
const subscription = originalAddListener(event, callback);
15+
if (!subscription || typeof subscription.remove !== 'function') {
16+
return {remove: jest.fn()};
17+
}
18+
return subscription;
19+
}) as typeof Keyboard.addListener;
20+
}
21+
722
// This mock must live in setupAfterEnv (not setupFiles) because @shopify/flash-list/jestSetup,
823
// imported in setup.ts, registers its own measureLayout mock. Placing ours here ensures it
924
// runs after FlashList's setup and takes precedence.

0 commit comments

Comments
 (0)