Prettier was not applied to all lines of this example.
2. Not recommended usage of preventAutoHideAsync method
According to the SplashScreen Method section, preventAutoHideAsync method is recommended to be called in global scope without awaiting because otherwise this might be called too late.
However, in this example, preventAutoHideAsync is called inside of useEffect hook. So I updated this.
3. Unhandled error case
If an error occurs while fetching remote fonts, the splash screen should be hidden and the platform default font can be used rather than keep showing splash screen.
Improvements
There are 3 things that I want to improve.
1. Inconsistent style
Prettier was not applied to all lines of this example.
2. Not recommended usage of
preventAutoHideAsync
methodAccording to the SplashScreen Method section,
preventAutoHideAsync
method is recommended to be called in global scope without awaiting because otherwise this might be called too late.However, in this example,
preventAutoHideAsync
is called inside ofuseEffect
hook. So I updated this.3. Unhandled error case
If an error occurs while fetching remote fonts, the splash screen should be hidden and the platform default font can be used rather than keep showing splash screen.
Reference
https://docs.expo.dev/develop/user-interface/fonts/#minimal-example