react-native-splash-screen

react-native-splash-screen在GitHub上的地址:https://github.com/crazycodeboy/react-native-splash-screen

react native,对呀app启动屏的生成没有讲解,网上对于启动屏的讲解也是有各种各样的办法;这里讲解一下iOS和android生成启动屏,以及结合第三方插件react-native-splashScreen友好显示启动屏的步骤

  • iOS、android如何生成启动屏

在做iOS开发之前,学习锅ionic,也是一种混合开发框架,ionic和react native开发环境基本类似,对于ionic不多说,简单点讲就是ionic只用两张图片(图标,启动屏)就可以快速生成iOS和android适应各个尺寸的相应图片了。当然,如果不会使用ionic,找设计师作图就行。以后会发个链接讲一下ionic生成启动屏的步骤。

  • 安装和link react-native-splash-screen
npm i react-native-splash-screen --save
  • 安装之后需要在android和iOS上配置:
  1.  iOS配置:
  2. android配置:
  • 使用代码:
import SplashScreen from 'react-native-splash-screen'

export default class WelcomePage extends Component {

    componentDidMount() {
        // do stuff while splash screen is shown
        // After having done stuff (such as async tasks) hide the splash screen
        SplashScreen.hide();
    }
}
原文地址:https://www.cnblogs.com/xiaojun-zxj/p/8485125.html