React Native ios选择器始终处于打开状态 [英] React Native ios picker is always open

查看:155
本文介绍了React Native ios选择器始终处于打开状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的屏幕上有两个选择器.每当我导航到iOS应用程序中的屏幕时,我都会发现选择器始终处于打开状态,并且所有选项都是可见的.

它在Android中工作得很好,只有在单击选择器之后,这些选项才可见.

有人可以提出解决方案以在iOS中解决此问题吗?

解决方案

在iOS上使用ActionSheet而不是Picker. https://facebook.github.io/react-native/docs/actionsheetios.html

jevakallio回答,这是iOS上的默认行为.但这不能提供良好的用户体验,因此请删除所有选择器组件,并替换为ActionSheet.

我做到了,效果很好.我之所以喜欢ActionSheet而不是jevakallio建议的其他组件,是因为它是由RN团队开发的,并且具有良好的原生感觉.建议的最后一个选项 react-native-modal-picker 也很好. /p>

I have two pickers on my screen. Whenever I navigate to the screen in iOS app I find that the pickers are always open and all options are visible.

It works perfectly fine in Android where the options are visible only after we click on the picker.

Can somebody suggest a solution to fix this in iOS?

解决方案

Use ActionSheet instead of Picker on iOS. https://facebook.github.io/react-native/docs/actionsheetios.html

As answered by jevakallio this is the default behaviour on iOS. But this doesn't give a good UX so remove all picker components and replace with ActionSheet.

I did and it works great. The reason I prefered ActionSheet over other components suggested by jevakallio because it is developed by the RN team and has a good native feeling. The last option suggested react-native-modal-picker is also very good.

这篇关于React Native ios选择器始终处于打开状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆