Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need more control over opening and closing of iOS Select component #594

Open
bogan27 opened this issue May 28, 2020 · 0 comments
Open

Need more control over opening and closing of iOS Select component #594

bogan27 opened this issue May 28, 2020 · 0 comments

Comments

@bogan27
Copy link

bogan27 commented May 28, 2020

Version

  • tcomb-form-native: 0.6.20
  • react-native: Expo SDK 36 (based on React Native 0.61.4)

Expected behaviour

Feature request: I would like the ability to either control when the Select component is open/closed, OR at least be able to prevent closing on value change (e.g. allow user to change values multiple times, or scroll long lists with pauses, without the Select automatically closing)

Actual behaviour

Whenever the value changes, the Select closes (at least on iOS). This might be ok for Selects with a small number of options, but for longer lists that require the user to scroll, it closes when they may just be pausing to move their finger or read the options that have been scrolled into view.

Steps to reproduce

  1. Create an Enum with a relatively long list of options (say, letters of the alphabet).
  2. Play around with scrolling through the options
  3. Observe that if scroll motion ever stops, the Select will close, though you might not have the final value you want

Background & Key Discussion Point:

If you look at select.ios.js, togglePicker is called anytime the value changes. In the past, there was a PR to control toggle state via props, which was partially reverted due to an anti-pattern. There have been other related issues asking for this (such as Is it possible to programmatically collapse pickers? and Select Component auto closed after rolling end in ver 0.6.20), so a solution is definitely needed.

I'm willing to do a PR for this. My question to the community: Should the solution be a simple boolean prop to prevent closing on value change (only close when the user taps again), or should Select take props for isCollapsed (which is partially does already) and onPress for making the Select component fully controllable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant