添加Firebase crashlytics后,React本机App卡在启动屏幕上吗? [英] React native App get stuck at launch screen after adding firebase crashlytics?

查看:196
本文介绍了添加Firebase crashlytics后,React本机App卡在启动屏幕上吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究React Native App,它运行正常。但是,当我导入Firebase crashlytics时,如果我再次将其删除,它会卡在启动屏幕上,但应用程序工作正常吗? / p>

我正试图在下面将index.js中的crashlytics导入

  //导入'@ react-native -firebase / crashlytics'

//从'@ react-native-firebase / crashlytics'导入{crashlytics};从 @ react-native-firebase / crashlytics中导入

的crashlytics;

请提出根本原因,解决方案或解决此问题的方法。
请让我知道是否需要更多信息来了解此问题。


感谢您的帮助。


app.js

  import从 react响应
从 react-native导入{YellowBox};
从 react-native导入{查看};
从本地基础导入{根},
从 react-native-user-inactivity中导入UserInactivity;从 mobx-react导入

{提供者};从 react-native-splash-screen中导入
SplashScreen;
从 src / routers / navigations中导入AppNavigatorRoot,{AppNavigationUtils};来自 src / store /的
进口商店;
import从 src / components / loading加载;来自 src / components / dialog的
导入对话框;
从src / api / oauth导入OAuthAPI;
import * as CoreConfig from'src / config / config';
从src / common / error导入HocErrorCatch;

index.js

  import { AppRegistry}来自 react-native; 
从 ./App导入应用;
//从‘./app.json’导入{name as appName};
//导入‘@ react-native-firebase / crashlytics’

//导入{}从‘@ react-native-firebase / crashlytics’;
//从 @ react-native-firebase / crashlytics导入crashlytics;



AppRegistry.registerComponent( xyz,()=> App);

错误日志


解决方案

我同意TommyLeong提出的观点


我不认为纯粹导入Crashlytics会使您的应用停留在
初始屏幕上



以快速修复
安装 react-native-splash-screen

App.js 中使用此代码,它应该可以解决问题

 从 react-native-splash-screen导入SplashScreen; 


//在useEffect或componentDidMount中,以您喜欢的为准
componentDidMount(){
//在显示初始屏幕时执行操作
//完成的内容(例如异步任务)隐藏启动屏幕
SplashScreen.hide();
}


I am working on React native App which is working fine. But when i import firebase crashlytics it stuck at launch screen if i remove it again app work fine?

As I am new to react i am not able to get root cause for this issue?

i am trying to import crashlytics in index.js as bellow

    //import '@react-native-firebase/crashlytics'
    or 
    //import {crashlytics} from '@react-native-firebase/crashlytics';
    or
    import crashlytics from '@react-native-firebase/crashlytics';

Please suggest root cause, solution or way to fix this issue. Please let me know if more info needed to understand this issue.

Thank you for helping.

app.js

import React from "react"
import { YellowBox } from 'react-native';
import { View } from 'react-native';
import { Root } from "native-base"
import UserInactivity from 'react-native-user-inactivity';

import { Provider } from 'mobx-react';
import SplashScreen from 'react-native-splash-screen';
import AppNavigatorRoot, { AppNavigationUtils } from "src/routers/navigations";
import store from 'src/store/';
import Loading from 'src/components/loading';
import Dialog from 'src/components/dialog';
import OAuthAPI from 'src/api/oauth';
import * as CoreConfig from 'src/config/config';
import HocErrorCatch from 'src/common/error';

index.js

import {AppRegistry} from 'react-native';
import App from './App';
// import {name as appName} from './app.json';
//import '@react-native-firebase/crashlytics'

//import {  } from '@react-native-firebase/crashlytics';
//import crashlytics from '@react-native-firebase/crashlytics';



AppRegistry.registerComponent("xyz", () => App);

error log

解决方案

I agree with this point TommyLeong made

I don't think purely importing Crashlytics will have your app stuck at splash screen


for quick fix install react-native-splash-screen
use this code inside App.js, it should solve the issue

     import SplashScreen from 'react-native-splash-screen';
    
    
    // inside useEffect or componentDidMount whichever you prefer
    componentDidMount() {
            // do stuff while splash screen is shown
            // After having done stuff (such as async tasks) hide the splash screen
            SplashScreen.hide();
    }

这篇关于添加Firebase crashlytics后,React本机App卡在启动屏幕上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆