如何自定义EXPO默认的初始屏幕并隐藏本机反应

时间:2018-12-13 07:04:17

标签: react-native expo

如何自定义expo默认的初始屏幕并将其隐藏在react native中。 世博启动画面从android中的屏幕的两侧切开。尽管它在Ios上运行正常。

1 个答案:

答案 0 :(得分:2)

您可以为Android和iOS定义不同的启动画面,并且在每个范围内为不同的屏幕密度定义不同的启动画面。 resizeMode也可以提供帮助。

您可以在此处查看各种android设备的密度:    https://material.io/tools/devices/

这是我的示例app.json,具有不同的启动文件:

{
  "expo": {
    "name": "Magic App",
    "description": "All the important information about my Pet",
    "slug": "magicapp",
    "privacy": "public",
    "sdkVersion": "31.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "0.43",
    "orientation": "default",
    "icon": "./assets/images/icon.png",
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "cover",
      "backgroundColor": "#ffffff"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.yossi.magicapp",
      "splash": {
        "image": "./assets/images/splash-ios.png",
        "tabletImage": "./assets/images/splash-ios-tablet.png",
        "resizeMode": "cover",
        "backgroundColor": "#ffffff"
      }
    },
    "android": {
      "package": "com.yossi.magicapp",
      "versionCode": 1,
      "permissions": [
        "CAMERA",
        "CAMERA_ROLL",
        "READ_INTERNAL_STORAGE",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE"
      ],
      "splash": {
        "ldpi": "./assets/images/splash.png",
        "mdpi": "./assets/images/splash.png",
        "hdpi": "./assets/images/splash.png",
        "xhdpi": "./assets/images/splash.png",
        "xxhdpi": "./assets/images/splash.png",
        "xxxhdpi": "./assets/images/splash.png",
        "tabletImage": "splash-android-tablet.png",
        "resizeMode": "cover",
        "backgroundColor": "#ffffff"
      },
      "icon": "./assets/images/icon.png",
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/icon-oreo.png",
        "backgroundColor": "#15b3bf"
      }
    }
  },
  "hooks": {
    "postPublish": [
      {
        "file": "sentry-expo/upload-sourcemaps",
        "config": {
          "organization": "self-dm",
          "project": "magicapp",
          "authToken": "0ca29a9ed2e84e86bbac3e0e81b6e1ac208cf77f08ef48f9b28732d028e50cf6"
        }
      }
    ]
  }
}