-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/onyx-connection-manager
- Loading branch information
Showing
385 changed files
with
11,196 additions
and
4,538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,65 @@ | ||
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native'; | ||
/* eslint-disable import/prefer-default-export, import/no-import-module-exports */ | ||
import type * as ReactNavigation from '@react-navigation/native'; | ||
import createAddListenerMock from '../../../tests/utils/createAddListenerMock'; | ||
|
||
// We only want these mocked for storybook, not jest | ||
const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; | ||
const isJestEnv = process.env.NODE_ENV === 'test'; | ||
|
||
const useTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({}); | ||
const realReactNavigation = isJestEnv ? jest.requireActual<typeof ReactNavigation>('@react-navigation/native') : (require('@react-navigation/native') as typeof ReactNavigation); | ||
|
||
const useIsFocused = isJestEnv ? realReactNavigation.useIsFocused : () => true; | ||
const useTheme = isJestEnv ? realReactNavigation.useTheme : () => ({}); | ||
|
||
const {triggerTransitionEnd, addListener} = isJestEnv | ||
? createAddListenerMock() | ||
: { | ||
triggerTransitionEnd: () => {}, | ||
addListener: () => {}, | ||
}; | ||
|
||
const useNavigation = () => ({ | ||
...realReactNavigation.useNavigation, | ||
navigate: jest.fn(), | ||
getState: () => ({ | ||
routes: [], | ||
}), | ||
addListener, | ||
}); | ||
|
||
type NativeNavigationMock = typeof ReactNavigation & { | ||
triggerTransitionEnd: () => void; | ||
}; | ||
|
||
export * from '@react-navigation/core'; | ||
export {useIsFocused, useTheme}; | ||
const Link = realReactNavigation.Link; | ||
const LinkingContext = realReactNavigation.LinkingContext; | ||
const NavigationContainer = realReactNavigation.NavigationContainer; | ||
const ServerContainer = realReactNavigation.ServerContainer; | ||
const DarkTheme = realReactNavigation.DarkTheme; | ||
const DefaultTheme = realReactNavigation.DefaultTheme; | ||
const ThemeProvider = realReactNavigation.ThemeProvider; | ||
const useLinkBuilder = realReactNavigation.useLinkBuilder; | ||
const useLinkProps = realReactNavigation.useLinkProps; | ||
const useLinkTo = realReactNavigation.useLinkTo; | ||
const useScrollToTop = realReactNavigation.useScrollToTop; | ||
export { | ||
// Overriden modules | ||
useIsFocused, | ||
useTheme, | ||
useNavigation, | ||
triggerTransitionEnd, | ||
|
||
// Theme modules are left alone | ||
Link, | ||
LinkingContext, | ||
NavigationContainer, | ||
ServerContainer, | ||
DarkTheme, | ||
DefaultTheme, | ||
ThemeProvider, | ||
useLinkBuilder, | ||
useLinkProps, | ||
useLinkTo, | ||
useScrollToTop, | ||
}; | ||
|
||
export type {NativeNavigationMock}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
const {fs} = require('memfs'); | ||
|
||
module.exports = fs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.