Commit be7c32db authored by Afid's avatar Afid

pasang font

parent c4230eab
...@@ -11,18 +11,18 @@ import * as Localization from 'expo-localization'; ...@@ -11,18 +11,18 @@ import * as Localization from 'expo-localization';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import en from './lib/en'; import en from './lib/en';
import id from './lib/id'; import id from './lib/id';
import React, {useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Text, View } from 'react-native'; import { Text, View } from 'react-native';
import { AppLoading } from 'expo'; import { AppLoading } from 'expo';
import * as Font from 'expo-font'; import * as Font from 'expo-font';
export const lang = i18n.translations = { export const lang = i18n.translations = {
en:en, en: en,
id:id id: id
} }
export const set_lang = i18n.locale = Localization.locale; export const set_lang = i18n.locale = Localization.locale;
export const fallbacks = i18n.fallbacks = true; export const fallbacks = i18n.fallbacks = true;
const persistConfig = { const persistConfig = {
key: 'root', key: 'root',
...@@ -34,15 +34,36 @@ const store = createStore(persistReducers); ...@@ -34,15 +34,36 @@ const store = createStore(persistReducers);
const persistor = persistStore(store) const persistor = persistStore(store)
i18n.locale = Localization.locale; i18n.locale = Localization.locale;
let customFonts = {
'Gotham-Black': require('./assets/font/Gotham-Bold-700.otf'),
'Gotham-SemiBoldItalic': require('./assets/font/Gotham-BoldItalic-400.otf')
};
export default function App() { export default function App() {
return ( const [fontsLoaded, setfontsLoaded] = useState(false)
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}> const loadFont = async () => {
<NavigationContainer> await Font.loadAsync(customFonts);
<Auth /> };
</NavigationContainer>
</PersistGate> useEffect(() => {
</Provider> console.log('===> Did Mount');
); loadFont().then(_ => {
setfontsLoaded(true);
})
}, [])
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<NavigationContainer>
<Auth />
</NavigationContainer>
</PersistGate>
</Provider>
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment