React Native Picker可以在某些项目之间具有某种分隔符或分隔符吗? [英] Can a React Native Picker have some kind of divider or separator between some Items?
问题描述
在其他React Native和Native Base组件中,我已经看到,在主要的可选输入项中,您可以添加不可选择的内容,通常称为分隔符或分隔符.
In other React Native and Native Base components I've seen that among the main selectable entry items you can add non-selectable things usually called dividers or separators.
但是我在Picker组件中看不到任何东西.
I can't see anything of the kind in the Picker components however.
我正在实现类似收藏夹或排序器顶部排序的最近项之类的东西.能够在收藏夹/最近部分和主体部分之间插入一种可见的分隔线是很好的.
I'm implementing something like favourites or recent items sorted at the top of the picker. It would be nice to be able to insert a kind of visible dividing line between the favourite/recent section and the main section.
+-----------+
| Ford |
| Chevrolet |
+-----------+
| Toyota |
| Nissan |
| ... |
如果我可以在每个部分之前添加带有文本的标题,那就更好了.
It would be even nicer if I could add a heading with text before each section.
+-----------+
|==Recent===|
+-----------+
| Ford |
| Chevrolet |
+-----------+
|=The rest==|
+-----------+
| Toyota |
| Nissan |
| ... |
Picker组件提供了此功能,还是可以轻松添加呢?
Does the Picker component provide this, or can it be easily added?
推荐答案
RN的Picker
组件不提供此功能.如果要使用非常可定制的Picker
,则最好使用 https://github .com/sohobloo/react-native-modal-dropdown .我认为您可以轻松使用一个名为renderSeparator
的API道具.
The Picker
component from RN doesn't provide this out of the box. If you want to use the very customizable Picker
, you better use https://github.com/sohobloo/react-native-modal-dropdown. There is an API prop called renderSeparator
that I think you could use easily for your purpose.
这篇关于React Native Picker可以在某些项目之间具有某种分隔符或分隔符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!