diff --git a/src/components/SplashScreenHider/index.js b/src/components/SplashScreenHider/index.js deleted file mode 100644 index 9bbddd2a0891a..0000000000000 --- a/src/components/SplashScreenHider/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import PropTypes from 'prop-types'; -import {useEffect} from 'react'; -import BootSplash from '@libs/BootSplash'; - -const propTypes = { - /** Splash screen has been hidden */ - onHide: PropTypes.func, -}; - -const defaultProps = { - onHide: () => {}, -}; - -function SplashScreenHider(props) { - const {onHide} = props; - - useEffect(() => { - BootSplash.hide().then(() => onHide()); - }, [onHide]); - - return null; -} - -SplashScreenHider.displayName = 'SplashScreenHider'; -SplashScreenHider.propTypes = propTypes; -SplashScreenHider.defaultProps = defaultProps; - -export default SplashScreenHider; diff --git a/src/components/SplashScreenHider/index.native.js b/src/components/SplashScreenHider/index.native.tsx similarity index 81% rename from src/components/SplashScreenHider/index.native.js rename to src/components/SplashScreenHider/index.native.tsx index 711ce9f6fb802..8c8fa2a4013fa 100644 --- a/src/components/SplashScreenHider/index.native.js +++ b/src/components/SplashScreenHider/index.native.tsx @@ -1,33 +1,22 @@ -import PropTypes from 'prop-types'; import {useCallback, useRef} from 'react'; -import {StyleSheet} from 'react-native'; +import {StyleSheet, ViewStyle} from 'react-native'; import Reanimated, {Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; import Logo from '@assets/images/new-expensify-dark.svg'; import BootSplash from '@libs/BootSplash'; import styles from '@styles/styles'; +import type SplashScreenHiderProps from './types'; -const propTypes = { - /** Splash screen has been hidden */ - onHide: PropTypes.func, -}; - -const defaultProps = { - onHide: () => {}, -}; - -function SplashScreenHider(props) { - const {onHide} = props; - +function SplashScreenHider({onHide = () => {}}: SplashScreenHiderProps) { const logoSizeRatio = BootSplash.logoSizeRatio || 1; const navigationBarHeight = BootSplash.navigationBarHeight || 0; const opacity = useSharedValue(1); const scale = useSharedValue(1); - const opacityStyle = useAnimatedStyle(() => ({ + const opacityStyle = useAnimatedStyle(() => ({ opacity: opacity.value, })); - const scaleStyle = useAnimatedStyle(() => ({ + const scaleStyle = useAnimatedStyle(() => ({ transform: [{scale: scale.value}], })); @@ -83,7 +72,5 @@ function SplashScreenHider(props) { } SplashScreenHider.displayName = 'SplashScreenHider'; -SplashScreenHider.propTypes = propTypes; -SplashScreenHider.defaultProps = defaultProps; export default SplashScreenHider; diff --git a/src/components/SplashScreenHider/index.tsx b/src/components/SplashScreenHider/index.tsx new file mode 100644 index 0000000000000..d3f5c52c1e3e2 --- /dev/null +++ b/src/components/SplashScreenHider/index.tsx @@ -0,0 +1,15 @@ +import {useEffect} from 'react'; +import BootSplash from '@libs/BootSplash'; +import type SplashScreenHiderProps from './types'; + +function SplashScreenHider({onHide = () => {}}: SplashScreenHiderProps) { + useEffect(() => { + BootSplash.hide().then(() => onHide()); + }, [onHide]); + + return null; +} + +SplashScreenHider.displayName = 'SplashScreenHider'; + +export default SplashScreenHider; diff --git a/src/components/SplashScreenHider/types.ts b/src/components/SplashScreenHider/types.ts new file mode 100644 index 0000000000000..4ea25da93290b --- /dev/null +++ b/src/components/SplashScreenHider/types.ts @@ -0,0 +1,6 @@ +type SplashScreenHiderProps = { + /** Splash screen has been hidden */ + onHide: () => void; +}; + +export default SplashScreenHiderProps;