首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >react-本地闪屏设置

react-本地闪屏设置
EN

Stack Overflow用户
提问于 2017-02-20 20:49:53
回答 1查看 1.7K关注 0票数 1

我尝试了许多不同的插件和指令来做闪屏,但我得到错误时,我改变或尝试设置android-manifest或我的闪屏风格,有人能帮助我一步一步准确地设置闪屏或视频作为教程吗?

我尝试了下面的链接,但当我运行-android时,我得到了错误

https://android.jlelse.eu/change-splash-screen-in-react-native-android-app-d3f99ac1ebd1#.saf96u3bp

注意:我想要安卓

EN

回答 1

Stack Overflow用户

发布于 2017-02-21 23:56:34

使用模块react- 2>In - 1> -splash-screen将其安装到您的项目上,然后将文件MainActivity.java更新为

代码语言:javascript
复制
import com.reactnativecomponent.splashscreen.RCTSplashScreen;
import android.os.Bundle;
import android.content.Intent;
in the onCreate method delete the method and copy the code below

@Override
protected void onCreate(Bundle savedInstanceState) {
RCTSplashScreen.openSplashScreen(this);  
super.onCreate(savedInstanceState);
}

在MainApplication.java文件中

代码语言:javascript
复制
import com.reactnativecomponent.splashscreen.RCTSplashScreenPackage;

replace the getPackages() method with the following


     @Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
        new VectorIconsPackage(),
        new MapsPackage(),
        new RCTSplashScreenPackage()
  );
}

现在在react本机应用程序的登录页面中

代码语言:javascript
复制
 import SplashScreen from 'react-native-smart-splash-screen'


in the lifecycle method componentWillMount() add the following as:



  componentDidMount(){
   SplashScreen.close(SplashScreen.animationType.scale, 2000, 800)
 }

如果有问题,请访问此存储库

https://github.com/UjjwalNepal/Dental

https://github.com/react-native-component/react-native-smart-splash-screen

在gradle设置中也添加上面链接中提到的依赖项,并在android/app/build.gradle中添加上面链接中提到的依赖项

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42345047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档