我可以在react-native中使用react-select吗?

问题描述 投票:6回答:2

我正在尝试在我的react-native应用程序中实现搜索表单。对于它,我需要像react-select或select-2这样的东西,这两个工具都是为web系统制作的,我不知道将它用于本机应用程序是否是个好主意。

我已经尝试在react-native中安装和使用它,但这似乎不起作用。

reactjs react-native react-select
2个回答
3
投票

可能最接近你想要的与React Native捆绑在一起的是http://facebook.github.io/react-native/docs/picker.html

Picker组件将为您提供iOS上的滚动内容和Android上的下拉菜单

或者也许这个第三方组件更接近你想要的:https://github.com/bulenttastan/react-native-list-popover

来自How to use React native select box


1
投票

你不能使用select2或react-select with react-native,因为它是基于DOM的,因此,它只能在navigator中工作,而不能在react-native中工作

我发现的最接近的反应本机等价物是react-native-multiple-select,你可以在https://github.com/toystars/react-native-multiple-select的github上找到它或者用它安装它

npm i react-native-multiple-select
© www.soinside.com 2019 - 2024. All rights reserved.