-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 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
1 change: 1 addition & 0 deletions
1
packages/react-native-storybook/src/getStorybook/hooks/index.ts
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 @@ | ||
export { default as useHideSplashScreen } from './useHideSplashScreen'; | ||
export { default as useOriginalMode } from './useOriginalMode'; | ||
export { default as useStoryEmitter } from './useStoryEmitter'; | ||
export { default as useTestingMode } from './useTestingMode'; |
51 changes: 51 additions & 0 deletions
51
packages/react-native-storybook/src/getStorybook/hooks/useHideSplashScreen.ts
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useEffect } from 'react'; | ||
|
||
const hideSplashScreens: (() => void)[] = []; | ||
|
||
try { | ||
const ExpoSplashScreen = require('expo-splash-screen'); | ||
|
||
hideSplashScreens.push(() => { | ||
try { | ||
ExpoSplashScreen.hide(); | ||
} catch { | ||
try { | ||
ExpoSplashScreen.hideAsync(); | ||
} catch {} | ||
} | ||
}); | ||
} catch { | ||
// No expo-splash-scree package available | ||
} | ||
|
||
try { | ||
const RNSplashScreen = require('react-native-splash-screen'); | ||
|
||
hideSplashScreens.push(() => { | ||
try { | ||
RNSplashScreen.hide(); | ||
} catch {} | ||
}); | ||
} catch { | ||
// No react-native-splash-screen package available | ||
} | ||
|
||
try { | ||
const BootSplash = require('react-native-bootsplash'); | ||
|
||
hideSplashScreens.push(() => { | ||
try { | ||
BootSplash.hide(); | ||
} catch {} | ||
}); | ||
} catch { | ||
// No react-native-bootsplash package available | ||
} | ||
|
||
export function useHideSplashScreen() { | ||
useEffect(() => { | ||
hideSplashScreens.forEach((hide) => hide()); | ||
}, []); | ||
} | ||
|
||
export default useHideSplashScreen; |