最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

splash screen - What happened when I removed the `assetsbootsplash` directory created by `react-native-bootsplash` - Stack Overf

programmeradmin0浏览0评论

I am currently using packages:

  • react-native-bootsplash: 6.3.3
  • @react-navigation/native: 7.0.14
  • react-native: 0.75.4

All configuration is set up according to react-native-bootsplash's docs

ios\<my-project-name>\AppDelegate.mm

#import "AppDelegate.h"
#import "RNBootSplash.h"

#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

// other code ...

- (void)customizeRootView:(RCTRootView *)rootView {
  [super customizeRootView:rootView];
  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
}

@end

android\app\src\main\java\com\<my-project-name>\MainActivity.kt

// other import ...

import android.os.Bundle;
import com.zoontek.rnbootsplash.RNBootSplash

class MainActivity : ReactActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    RNBootSplash.init(this, R.style.BootTheme)
    super.onCreate(null)
  }

  // other methods
}

src\App.jsx

import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import BootSplash from 'react-native-bootsplash';

import RootBottomTab from './navigation/RootBottomTab';

function App() {
  const onReady = React.useCallback(
    async () => await BootSplash.hide({ fade: true }),
    [],
  );

  return (
    <NavigationContainer onReady={onReady}>
      <RootBottomTab />
    </NavigationContainer>
  );
}

export default React.memo(App);

When I run the command

npx react-native-bootsplash generate <my-logo-path> --platforms=android,ios

I see a directory assets/bootsplash is created in my project by flag --assets-output <string> with default path "assets/bootsplash". I try to remove assets/bootsplash and my app works fine, nothing wrong, at least on Android device.

I feel that assets/bootsplash is an intermediary resource. When all resources are generated by npx react-native-bootsplash generate and the process is complete. Therefore, it is not necessary to push assets/bootsplash to source control, such as GitHub.

I have some questions:

  1. Should I remove assets/bootsplash?
  2. If I remove, will it affect the ios project?

If you need any more information about my project, please let me know.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论