配置-插件/反应-本地-网络c
自动配置的配置插件 react-native-webrtc 当本地代码生成时( w)npx expo prebuild) (中文(简体) ). 上游 PR。 。 。 .
版本
确保您使用共同工作的版本 !
expo | react-native-webrtc | @config-plugins/react-native-webrtc |
|---|---|---|
| 56.0.0 (单位:千美元) | 124.0.7 (中文(简体) ) | 15.0.0 (单位:千美元) |
| 55.0.0 (简体中文) | 124.0.7 (中文(简体) ) | 14.0.0 (中文(简体) ) |
| 54.0.0 (单位:千美元) | 124.0.6 (中文(简体) ) | 13.0.0 (单位:千美元) |
| 53.0.0 (韩语) | 124.0.5 (中文(简体) ) | 12.0.0 (单位:千美元) |
| 52.0.0 (简体中文) | 124.0.4 (英语) | 10.0.0 (中文(简体) ) |
| 51.0.0 (单位:千美元) | 118.0.7 (韩语) | 9.0.0 (单位:千美元) |
| 50.0.0 (中文(简体) ) | 118.0.1 国家 | 8.0.0 (单位:千美元) |
| 49.0.0 (单位:千美元) | 111.0.3 (中文(简体) ) | 7.0.0 (单位:千美元) |
| 48.0.0 (简体中文) | 106.0.6 (中文(简体) ) | 6.0.0 (单位:千美元) |
| 47.0.0 (简体中文) | 1.106.1 国家 | 5.0.0 (单位:千美元) |
| 46.0.0 (单位:千美元) | 1.100.0 (中文(简体) ) | 4.0.0 (单位:千美元) |
| 45.0.0 (单位:千美元) | 1.100.0 (中文(简体) ) | 3.0.0 (单位:千美元) |
| 44.0.0 (单位:千美元) | 1.92.2 国家 | 2.0.0 (韩语) |
| 43.0.0 (单位:千美元) | 1.92.2 国家 | 1.0.0 (单位:千美元) |
Expo SDK 42 用途
[email protected]没用的react-native-webrtc特别是iOS生产失败。 指此软件包仅被支持于 Expo SDK + 43.
博览会安装
此软件包不能用于“ Expo Go” 应用程序, 因为 它需要自定义本地代码。 。 。 . 首先用纱线、 npm 或
npx expo install。 。 。 .
npx expo install react-native-webrtc @config-plugins/react-native-webrtc
安装此 npm 软件包后, 添加 配置插件 页:1 plugins 您的数组 app.json 或者说 app.config.js数字 :
{
"plugins": ["@config-plugins/react-native-webrtc"]
}
接下来,重建您的应用程序,如 "添加风俗本土代码" 向导.
事件目标Shim
只为SDK 50.
反应原生用途 event-target-shim@5 与不兼容 react-native-webrtc依赖 event-target-shim@6。要解决这个问题,可能需要在您的 metro.config.js 文件 :
// metro.config.js
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const resolveFrom = require("resolve-from");
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (
// If the bundle is resolving "event-target-shim" from a module that is part of "react-native-webrtc".
moduleName.startsWith("event-target-shim") &&
context.originModulePath.includes("react-native-webrtc")
) {
// Resolve event-target-shim relative to the react-native-webrtc package to use v6.
// React Native requires v5 which is not compatible with react-native-webrtc.
const eventTargetShimPath = resolveFrom(
context.originModulePath,
moduleName
);
return {
filePath: eventTargetShimPath,
type: "sourceFile",
};
}
// Ensure you call the default resolver.
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config;
API 密码
该插件为额外的定制提供了道具. 每次更换道具或插件,都需要重建(并 prebuild(原始内容存档于2018-10-10). ). 本地应用. 如果没有添加额外的属性,则使用默认值.
cameraPermission(单位:千美元)字符串: 设置iOSNSCameraUsageDescription权限消息到Info.plist默认为Allow $(PRODUCT_NAME) to access your camera。 。 。 .microphonePermission(单位:千美元)字符串: 设置iOSNSMicrophoneUsageDescription权限消息到Info.plist默认为Allow $(PRODUCT_NAME) to access your microphone。 。 。 .
app.config.js
export default {
plugins: [
[
"@config-plugins/react-native-webrtc",
{
cameraPermission: "Allow $(PRODUCT_NAME) to access your camera",
microphonePermission: "Allow $(PRODUCT_NAME) to access your microphone",
},
],
],
};
重要说明
- 对于iOS,此插件禁用所有构建的比特码(需要).
- Android , 此插件将禁用 desugaring
gradle.properties数字 :android.enableDexingArtifactTransform.desugaring=false编辑 最低部署目标改为24(从)21) 它可能会在您的应用程序中打破其他软件包!
手动设置
对于光工作流程项目,您可以遵循手动设置指南: