node.js - 自动链接不适用于 react-native 0.63.4 和 react-native-localize
问题描述
我正在学习国际化如何在 React Native 上发挥作用。为此,我正在使用博览会。我正在使用这个库: https ://github.com/zoontek/react-native-localize
当我在网络浏览器上测试它时,它可以完美运行,但是当我在我的 Android 物理设备上测试它时,它就不起作用了。显然 react-native-localize 的链接不起作用。我收到此错误:
Error: react-native-localize: NativeModule.RNLocalize is null. To fix this issue try these steps:
• Run `react-native link react-native-localize` in the project root.
• Rebuild and re-run the app.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
• Check that the library was linked correctly when you used the link command by running through the manual installation instructions in the README.
• If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README.
• If none of these fix the issue, please open an issue on the Github repository: https://github.com/zoontek/react-native-localize
然后,如果我运行react-native link react-native-localize
它会显示一个警告,表明它已被弃用并且它不起作用。
在我的 package.json 上,我有这个版本的依赖本地化和 react-native:
"react-native-localize": "^2.0.1",
"react-native": "~0.63.4",
应该自动完成高于 0.60 的 react-native 链接。
如果需要任何进一步的信息,请告诉我。
解决方案
尝试通过 npx react-native run-android 命令再次运行项目。
如果您使用的是 iOS 设备,则:
cd ios && pod install npx react-native run-ios 如果仍然无法正常工作,请尝试再次安装 npm 包并按照文档进行操作。
推荐阅读
- http-proxy - 在 urllib3 中,我需要绕过代理
- codeception - Codeception:类“tests\_support\AcceptanceTester”不存在
- reactjs - React - 导航到另一个子组件时更新或重新渲染父组件
- xpath - 两个系统中 XQuery 执行的不同行为
- r - 如何在分组数据帧上使用 dplyr::across 和多参数函数?
- database - 如何在 tomcat 配置中加密 oracle ucp 数据库连接?
- laravel - 你怎么会有一个不允许将任何作业排队的队列线?(一次只允许 1 个活动作业在队列中)
- css - 图像模糊在 CSS3 中创建额外的暗线
- python - 设置与“&”的交集如何在幕后工作?
- sql - 在两个日期之间进行选择