@livelike/react-native
Version:
LiveLike React Native package
40 lines (37 loc) • 998 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useInit = useInit;
var _react = require("react");
var _javascript = require("@livelike/javascript");
function useInit(initArg) {
const [initResult, setInitResult] = (0, _react.useState)({
profile: null,
loaded: false
});
// Load any resources or data that we need prior to rendering the app
(0, _react.useEffect)(() => {
async function initLLSdk() {
try {
// SplashScreen.preventAutoHideAsync();
await (0, _javascript.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