Skip to content

Add touch event props #9

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

Merged
merged 2 commits into from
Jun 20, 2021
Merged

Add touch event props #9

merged 2 commits into from
Jun 20, 2021

Conversation

reck753
Copy link
Contributor

@reck753 reck753 commented Jun 13, 2021

Hi!

I added the missing touch event props:

  • onPress
  • onPressIn
  • onPressOut
  • onLongPress
  • disabled
  • delayPressIn
  • delayPressOut
  • delayLongPress

https://github.com/react-native-svg/react-native-svg#touch-events

@MoOx
Copy link
Member

MoOx commented Jun 15, 2021

Hi @reck753, thanks for this contribution! Could you adjust the onPress* to add the argument received (event).
It seems it's not correctly typed in the source https://github.com/react-native-svg/react-native-svg/blob/fa9a25d36b6f863d3148bdd5dd1ac76e91339402/src/ReactNativeSVG.web.ts#L18 but I am sure we could have something like Event.pressEvent => unit seems more accurate.

- change `onPress*` argument to `Event.pressEvent`
- change `delay*` type to `int`
@reck753
Copy link
Contributor Author

reck753 commented Jun 15, 2021

Hi @reck753, thanks for this contribution!

You are welcome!
I also adjusted the types for the delay* to int instead. I totally forgot that the value should be in milliseconds and that it doesn't make sense to be float. The type is int as well for RN pressables:
https://github.com/rescript-react-native/rescript-react-native/blob/e625be295df739f91f98b6e12855b4bcd7a6623d/src/components/TouchableOpacity.res#L23

@MoOx
Copy link
Member

MoOx commented Jun 20, 2021

Thanks!

@MoOx MoOx merged commit 0304f08 into rescript-react-native:main Jun 20, 2021
@MoOx
Copy link
Member

MoOx commented Jun 20, 2021

Released in 12.1.8

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