Skip to content

Commit

Permalink
Add more web props, press-event, href and target (facebook#650)
Browse files Browse the repository at this point in the history
* Press-event, href and target

* Fix typo

* Add react-native-web accessibility roles

* also add web properties to touchables

* use window scrolling

* Update src/components/ScrollView.re

Co-authored-by: Max Thirouin <git@moox.io>
  • Loading branch information
jfrolich and MoOx authored Mar 26, 2020
1 parent 2703957 commit 6cba498
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 6 deletions.
23 changes: 21 additions & 2 deletions src/components/Text.re
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ external make:
~ellipsizeMode: [@bs.string] [ | `clip | `head | `middle | `tail]=?,
~numberOfLines: int=?,
~onLayout: Event.layoutEvent => unit=?,
~onLongPress: unit => unit=?,
~onPress: unit => unit=?,
~onLongPress: Event.pressEvent => unit=?,
~onPress: Event.pressEvent => unit=?,
~pressRetentionOffset: View.edgeInsets=?,
~selectable: bool=?,
~style: Style.t=?,
Expand All @@ -69,6 +69,25 @@ external make:
~value: string=?,
~children: React.element=?,
// React Native Web Props
~rel: [@bs.string] [
| `alternate
| `author
| [@bs.as "dns-prefetch"] `dnsPrefetch
| `icon
| `license
| `next
| `pingback
| `preconnect
| `prefetch
| `preload
| `prerender
| `prev
| `search
| `stylesheet
]
=?,
~href: string=?,
~target: [@bs.string] [ | `_blank | `_self | `_parent | `_top]=?
~onMouseDown: ReactEvent.Mouse.t => unit=?,
~onMouseEnter: ReactEvent.Mouse.t => unit=?,
~onMouseLeave: ReactEvent.Mouse.t => unit=?,
Expand Down
22 changes: 21 additions & 1 deletion src/components/TouchableHighlight.re
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,27 @@ external make:
~pressRetentionOffset: View.edgeInsets=?,
~testID: string=?,
~touchSoundDisabled: bool=?,
~children: React.element=?
~children: React.element=?,
// escape hatches for react-native web:
~rel: [@bs.string] [
| `alternate
| `author
| [@bs.as "dns-prefetch"] `dnsPrefetch
| `icon
| `license
| `next
| `pingback
| `preconnect
| `prefetch
| `preload
| `prerender
| `prev
| `search
| `stylesheet
]
=?,
~href: string=?,
~target: [@bs.string] [ | `_blank | `_self | `_parent | `_top]=?
) =>
React.element =
"TouchableHighlight";
22 changes: 21 additions & 1 deletion src/components/TouchableNativeFeedback.re
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,27 @@ external make:
~pressRetentionOffset: View.edgeInsets=?,
~testID: string=?,
~touchSoundDisabled: bool=?,
~children: React.element=?
~children: React.element=?,
// escape hatches for react-native web:
~rel: [@bs.string] [
| `alternate
| `author
| [@bs.as "dns-prefetch"] `dnsPrefetch
| `icon
| `license
| `next
| `pingback
| `preconnect
| `prefetch
| `preload
| `prerender
| `prev
| `search
| `stylesheet
]
=?,
~href: string=?,
~target: [@bs.string] [ | `_blank | `_self | `_parent | `_top]=?
) =>
React.element =
"TouchableNativeFeedback";
22 changes: 21 additions & 1 deletion src/components/TouchableOpacity.re
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,27 @@ external make:
~pressRetentionOffset: View.edgeInsets=?,
~testID: string=?,
~touchSoundDisabled: bool=?,
~children: React.element=?
~children: React.element=?,
// escape hatches for react-native web:
~rel: [@bs.string] [
| `alternate
| `author
| [@bs.as "dns-prefetch"] `dnsPrefetch
| `icon
| `license
| `next
| `pingback
| `preconnect
| `prefetch
| `preload
| `prerender
| `prev
| `search
| `stylesheet
]
=?,
~href: string=?,
~target: [@bs.string] [ | `_blank | `_self | `_parent | `_top]=?
) =>
React.element =
"TouchableOpacity";
22 changes: 21 additions & 1 deletion src/components/TouchableWithoutFeedback.re
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,27 @@ external make:
~pressRetentionOffset: View.edgeInsets=?,
~testID: string=?,
~touchSoundDisabled: bool=?,
~children: React.element=?
~children: React.element=?,
// escape hatches for react-native web:
~rel: [@bs.string] [
| `alternate
| `author
| [@bs.as "dns-prefetch"] `dnsPrefetch
| `icon
| `license
| `next
| `pingback
| `preconnect
| `prefetch
| `preload
| `prerender
| `prev
| `search
| `stylesheet
]
=?,
~href: string=?,
~target: [@bs.string] [ | `_blank | `_self | `_parent | `_top]=?
) =>
React.element =
"TouchableWithoutFeedback";
10 changes: 10 additions & 0 deletions src/components/View.re
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ external make:
| `header
| `summary
| `imagebutton
| `article
| `banner
| `complementary
| `contentinfo
| `form
| `list
| `listitem
| `main
| `navigation
| `region
]
=?,
~accessibilityStates: array(AccessibilityState.t)=?,
Expand Down

0 comments on commit 6cba498

Please sign in to comment.