expo#AppLoading TypeScript Examples
The following examples show how to use
expo#AppLoading.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoadAssets.tsx From react-native-meetio with MIT License | 7 votes |
LoadAssets = ({ assets, fonts, children }: LoadAssetsProps) => {
const [isNavigationReady, setIsNavigationReady] = useState(!__DEV__);
const [initialState, setInitialState] = useState<InitialState | undefined>();
const ready = useLoadAssets(assets || [], fonts || {});
useEffect(() => {
const restoreState = async () => {
try {
const savedStateString = await AsyncStorage.getItem(
NAVIGATION_STATE_KEY
);
const state = savedStateString
? JSON.parse(savedStateString)
: undefined;
setInitialState(state);
} finally {
setIsNavigationReady(true);
}
};
if (!isNavigationReady) {
restoreState();
}
}, [isNavigationReady]);
const onStateChange = useCallback((state) => {
AsyncStorage.setItem(NAVIGATION_STATE_KEY, JSON.stringify(state));
}, []);
if (!ready || !isNavigationReady) {
return <AppLoading />;
}
return (
<NavigationContainer {...{ onStateChange, initialState }}>
{children}
</NavigationContainer>
);
}
Example #2
Source File: App.tsx From NLW-1.0 with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold,
});
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<>
<StatusBar
barStyle="dark-content"
backgroundColor="transparent"
translucent
/>
<Routes />
</>
);
}
Example #3
Source File: App.tsx From ecoleta with MIT License | 6 votes |
App: React.FC = () => {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold,
});
if (!fontsLoaded) return <AppLoading />;
return (
<AppProvider>
<StatusBar
barStyle="dark-content"
backgroundColor="transparent"
translucent
/>
<Routes />
</AppProvider>
);
}
Example #4
Source File: App.tsx From NextLevelWeek with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold,
});
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<>
<StatusBar
barStyle="dark-content"
backgroundColor="transparent"
translucent
/>
<Routes />
</>
);
}
Example #5
Source File: App.tsx From nlw2-proffy with MIT License | 6 votes |
export default function App() {
let [fontsLoaded] = useFonts({
Archivo_400Regular,
Archivo_700Bold,
Poppins_400Regular,
Poppins_600SemiBold,
});
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<>
<AppStack />
<StatusBar style="light" />
</>
);
}
}
Example #6
Source File: App.tsx From nlw-ecoleta with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold
});
if (!fontsLoaded) {
return <AppLoading />
}
return (
<>
<StatusBar barStyle="dark-content" />
<Routes />
</>
);
}
Example #7
Source File: App.tsx From nlw-01-omnistack with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold
});
if (!fontsLoaded) {
return <AppLoading />
}
return (
<>
<StatusBar barStyle="dark-content" backgroundColor="transparent" translucent />
<Routes />
</>
);
}
Example #8
Source File: App.tsx From nlw-02-omnistack with MIT License | 6 votes |
export default function App() {
let [fontsLoaded] = useFonts({
Archivo_400Regular,
Archivo_700Bold,
Poppins_400Regular,
Poppins_600SemiBold,
});
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<>
<AppStack />
<StatusBar style="light" />
</>
);
}
}
Example #9
Source File: App.tsx From ecoleta with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold,
});
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<>
<StatusBar
barStyle="dark-content"
backgroundColor="transparent"
translucent
/>
<Routes />
</>
);
}
Example #10
Source File: App.tsx From ecoleta with MIT License | 6 votes |
export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold
});
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<>
<StatusBar barStyle="dark-content" backgroundColor="transparent" translucent />
<Routes />
</>
);
}