概述:
我使用TypeScript构建了一个NPM库,从上次更新它到现在已经将近9个月了(我没有时间)。但是,它使用以下库:
我的图书馆(react-native-ultimate-modal-picker) package.json
**:**
上面列出的所有3个库都被设置为peerDependencies
,但我不确定是否遗漏了像podfiles
这样的其他库。
"peerDependencies": {
"@react-native-community/datetimepicker": ">=3.0.0",
"@react-native-picker/picker": ">=1.8.3",
"react": "*",
"react-native": "*",
"react-native-modal": ">=11.0.0"
},
什么工作:
代码在iOS模拟器中运行时工作,但是当将my 反应-本机-最终-模态选择器添加到项目中时,它会出现错误。
错误:
Error: Invariant Violation: requireNativeComponent: "RNCPicker" was not found in the UIManager.
将NPM库导入项目:
import { DropdownList } from 'react-native-ultimate-modal-picker';
const testItems: Array<PickerValue> = [
{ label: '1', value: '1' },
];
<DropdownList
title="Test"
items={testItems}
onChange={(value: string) => console.log(value)}
/>
Github (我的图书馆目前无法工作)
https://github.com/jefelewis/react-native-ultimate-modal-picker
问题的可能原因:
podfiles
发布于 2021-09-06 16:37:34
可以尝试以下步骤:
rm -rf node_modules && yarn cache clean && yarn install
cd ios && pod install
Clean Build Folder
产品菜单中选择xCode。Run
您的应用程序直接从xCode产品菜单。发布于 2021-11-16 06:28:40
将这一行添加到podfile中:
pod 'RNCPicker', :path => './ReactComponent/node_modules/@react-native-picker/picker'
您可能需要更改到您的真正路径的路径,就像您的podfile和pod中的其他路径一样,重新安装。
发布于 2022-05-28 04:52:19
如果您使用RN高于0.60的反应-本机选择-选择,您还需要安装@react-native-community/picker
(不确定为什么它不是它的依赖项.)
npm install @react-native-community/picker
pod-install
https://stackoverflow.com/questions/67550740
复制相似问题