diff --git a/packages/react-native-storybook/src/index.ts b/packages/react-native-storybook/src/index.ts index 024f9acb..4f48cf5d 100644 --- a/packages/react-native-storybook/src/index.ts +++ b/packages/react-native-storybook/src/index.ts @@ -1,3 +1,4 @@ export { default as getStorybook } from './getStorybook'; +export { default as isRunningVisualTests } from './isRunningVisualTests'; export { default as openStorybook } from './openStorybook'; export { default as registerStorybook } from './registerStorybook'; diff --git a/packages/react-native-storybook/src/isRunningVisualTests.ts b/packages/react-native-storybook/src/isRunningVisualTests.ts new file mode 100644 index 00000000..163fca3a --- /dev/null +++ b/packages/react-native-storybook/src/isRunningVisualTests.ts @@ -0,0 +1,7 @@ +import { NativeModules } from 'react-native'; + +const { SherloModule } = NativeModules; + +const isRunningVisualTests = SherloModule?.getConstants().initialMode === 'testing'; + +export default isRunningVisualTests;