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

feat: enable 'handled' mode of ScrollView['keyboardShouldPersistTaps'] #1141

Merged
merged 1 commit into from
Oct 10, 2019
Merged

feat: enable 'handled' mode of ScrollView['keyboardShouldPersistTaps'] #1141

merged 1 commit into from
Oct 10, 2019

Conversation

mikehardy
Copy link
Contributor

@mikehardy mikehardy commented Sep 10, 2019

This enables tap events to go through the ScrollView and trigger onPress
on Touchable things inside the ScrollView.

So while the keyboard is showing in a TextInput inside a ScrollView and you tap a button, the button will actually tap instead of needing one tap to dismiss keyboard, and one tap on the button

You guys have a pretty concise style and my Typescript Typing skills are not very strong yet, so if there is anything stylistic about this you don't like, just let me know.

Side note: if you disregard the package-lock.json right now (e.g. by using yarn instead of npm) current master fails to compile with tsc. I'm assuming some underlying type package moved and Button and View no longer have compatible Animated Style types. Using npm install does work though and after that install a yarn build is successful, and I can transplant the src+dist directories to my project's node_modules for patch-package consumption where I can deploy my work.

@mikehardy
Copy link
Contributor Author

Okay @berickson1 - I just edited and re-pushed based on your feedback. I re-read your comment a few times about the override, and I believe my original understanding was incomplete. I believe you were saying if someone sets override it should always override (though you qualified your confidence in that - that's fine)

1- so in my re-structure I made the override a 100% thing via the 'else if' vs just 'if' as you mentioned
2- I added a comment block explaining the possible states
3- ...and simplified the boolean

Then I built it and patched it into my project and I can to see the single-tap ability to hit buttons inside scrollviews on native when I pass in 'handled' for this prop now, which makes me happy.

@berickson1
Copy link
Collaborator

LGTM - Can you also update scrollview.md with the updated properties?

This enables tap events to go through the ScrollView and trigger onPress
on Touchable things inside the ScrollView. So while the keyboard is showing
in a TextInput inside a ScrollView and you tap a button, the button will
actually tap instead of needing one tap to dismiss keyboard, and one tap
on the button
@mikehardy
Copy link
Contributor Author

Oops! forgot the docs, good catch. Just repushed

@berickson1 berickson1 merged commit ead198b into microsoft:master Oct 10, 2019
@mikehardy mikehardy deleted the keyboardShouldPersistTaps-enum branch October 10, 2019 16:13
@mikehardy
Copy link
Contributor Author

Yay! Now we just need a reactxp-2.0.0-rc.2 and I can purge my patch-package patch :-)

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

Successfully merging this pull request may close these issues.

2 participants