【发布时间】:2019-07-12 08:11:38
【问题描述】:
我在我的 react native 项目 (v0.6) 中安装了 react-native-localization。库还不支持自动链接器,所以我需要在 react-native.config.js 中为 iOS 和 Android 禁用它。
我已经尝试在 react-native.config.js 中添加依赖项。之后,我执行了react-native link react-native-localization 命令并构建了一个应用程序。
这是我的 react-native.config.js 文件:
'use strict';
const ios = require('@react-native-community/cli-platform-ios');
const android = require('@react-native-community/cli-platform-android');
module.exports = {
dependencies: {
'react-native-localization': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
ios: null,
},
},
},
commands: [...ios.commands, ...android.commands],
platforms: {
ios: {
linkConfig: ios.linkConfig,
projectConfig: ios.projectConfig,
dependencyConfig: ios.dependencyConfig,
},
android: {
linkConfig: android.linkConfig,
projectConfig: android.projectConfig,
dependencyConfig: android.dependencyConfig,
},
},
/**
* Used when running RNTester (with React Native from source)
*/
reactNativePath: '.',
project: {
ios: {
project: './RNTester/RNTester.xcodeproj',
},
android: {
sourceDir: './RNTester',
},
},
};
模拟器中的错误说: "请检查您的配置。您是否运行了 'react-native link'?
【问题讨论】:
-
您是否也尝试过
cd ios和pod install? -
非常感谢。我在哪里可以找到有关它的信息?昨天,我花了大约 3 小时来让它工作......
标签: react-native react-native-ios