bare react-native 添加expo

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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容