@livelike/react-native
Version:
LiveLike React Native package
34 lines (32 loc) • 865 B
JavaScript
import { useState, useEffect } from 'react';
import { init } from '@livelike/javascript';
export function useInit(initArg) {
const [initResult, setInitResult] = useState({
profile: null,
loaded: false
});
// Load any resources or data that we need prior to rendering the app
useEffect(() => {
async function initLLSdk() {
try {
// SplashScreen.preventAutoHideAsync();
await init(initArg).then(profile => {
setInitResult({
profile,
loaded: true
});
});
} catch (e) {
// We might want to provide this error information to an error reporting service
console.warn(e);
setInitResult({
profile: null,
loaded: true
});
}
}
initLLSdk();
}, []);
return initResult;
}
//# sourceMappingURL=useInit.js.map