From 4606cf5a01835d2b7dc9fe88bed2deb98af62561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zi=C3=B3=C5=82kowski?= Date: Sun, 25 Aug 2024 14:46:01 +0200 Subject: [PATCH] re-add isRunningVisualTests --- packages/react-native-storybook/src/index.ts | 1 + .../react-native-storybook/src/isRunningVisualTests.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 packages/react-native-storybook/src/isRunningVisualTests.ts 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;