bare react-native 添加expo

2022-04-09  本文已影响0人  朱传武

If you already have a React Native project that has been created with react-native init, ignite init, or another similar tool, we'll need to install and configure the expo package to enable you to use packages from the Expo SDK. For this, we will run npx install-expo-modules.
之后添加修改app.json

{
  "expo": {
    "scheme": "salami-slicing",
    "name": "Salami Slicing",
    "owner": "salamislicing",
    "slug": "SalamiSlicing",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",

    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.vk.salami",
      "buildNumber": "1.0.0",
      "infoPlist": {
        "NSPhotoLibraryUsageDescription": "Allow The Salami to access your photos",
        "NSCameraUsageDescription": "Allow Salami to access your camera",
        "NSMicrophoneUsageDescription": "Allow $(PRODUCT_NAME) to access your microphone",
        "NSRemindersUsageDescription": "Allow Salami to access your calender events",
        "NSCalendarsUsageDescription": "Allow The salami to access your calender events"
      }
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "permissions": [
        "android.permission.CAMERA",
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.RECORD_AUDIO",
        "android.permission.READ_CALENDAR",
        "android.permission.WRITE_CALENDAR"
      ],
      "package": "com.apollo"
    },

    "packagerOpts": {
      "config": "metro.config.js",
      "sourceExts": [
        "expo.ts",
        "expo.tsx",
        "expo.js",
        "expo.jsx",
        "ts",
        "tsx",
        "js",
        "jsx",
        "json",
        "wasm",
        "svg"
      ]
    },

    "jsEngine": "jsc"
  }
}

之后可以用expo 服务器打包,

eas build -p android
上一篇下一篇

猜你喜欢

热点阅读