lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.75k stars 498 forks source link

Fix: Scroll to TextInput on picker opening #496

Open chrispader opened 1 year ago

chrispader commented 1 year ago

Problem

When the picker gets opened, the <ScrollView /> which contains the <RNPickerSelect /> isn't responding to the modal opening.

Since using the picker should feel like using keyboard, we need to have some logic to directly scroll to the location of the <TextInput /> in the containing <ScrollView />.

Solution

I added the code needed, to allow this kind of functionality. There are two props needed:

(Lmk if you have a solution, that requires less props or is easier)

This is completely optional, so if these 2 props are not provided, the behaviour of this picker library won't change

Notices

Hope this PR brings some useful functionality.

lfkwtz commented 1 year ago

this is cool - can you fix the conflicts?

chrispader commented 1 year ago

@lfkwtz conflicts resolved 👍

chrispader commented 1 year ago

@lfkwtz just found a reliable way to measure the actual modal height, without the need to hardcode it. Let me know what you think and if everything works for you 👍

lfkwtz commented 11 months ago

looking good - able to close that coverage gap?

chrispader commented 11 months ago

looking good - able to close that coverage gap?

Not sure how, if were not able to test this lib natively on iOS... Do you have an idea?

chrispader commented 9 months ago

@lfkwtz do you think we can merge this? Absolutely no priority though..

lfkwtz commented 8 months ago

@lfkwtz do you think we can merge this? Absolutely no priority though..

i currently do not have access to merge until all checks are passed. so we'll have to work through that first.

chrispader commented 6 months ago

I'm gonna try to continue working on the tests if i get the chance any time soon...

lfkwtz commented 6 months ago

looks like the team at lawnstarter is starting to work on this a bit more so maybe they will be able to help you get this in cc @alberto-mourao-lawnstarter

chrispader commented 6 months ago

looks like the team at lawnstarter is starting to work on this a bit more so maybe they will be able to help you get this in cc @alberto-mourao-lawnstarter

ah awesome! Yea, if they could help me with fixing/setting up these tests, that would be great! thanks

chrispader commented 6 months ago

gonna resolve merge conflicts soon