Skip to content

Commit

Permalink
Update ViewConfigs to support onEnter/onExit/onMove events
Browse files Browse the repository at this point in the history
Summary:
This diff updates the ViewConfigs in RN Android to add support for onEnter/onExit/onMove events.

Open questions:

- Should we just remove the override for RN VR: https://www.internalfb.com/code/ovrsource/[c82b81893393ad0c6f8c6e7f347e82bba39dc8cc]/arvr/js/libraries/reactvr/VrShellPanelLib/rn-support/setUpViewConfigOverrides.js

- Should we use w3c naming now (e.g. onPointerEnter / onPointerExit / onPointerMove) ? or should we migrate to it later? what would be the effort for VR to migrate now to onPointerEnter / onPointerExit / onPointerMove?

changelog: [Android][Changed] Add ViewConfigs to support onEnter/onExit/onMove events

Reviewed By: RSNara

Differential Revision: D32253129

fbshipit-source-id: 539d8672825c7f18f0b6a2570764a5988cd936bc
  • Loading branch information
mdvacca authored and facebook-github-bot committed Nov 19, 2021
1 parent 437b06f commit 44143b5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Libraries/Components/View/ReactNativeViewViewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ const ReactNativeViewConfig: ViewConfig = {
topMagicTap: {
registrationName: 'onMagicTap',
},
topPointerEnter: {
registrationName: 'pointerenter',
},
topPointerLeave: {
registrationName: 'pointerleave',
},
topPointerMove: {
registrationName: 'pointermove',
},
// Events for react-native-gesture-handler (T45765076)
// Remove once this library can handle JS View Configs
onGestureHandlerEvent: {
Expand Down Expand Up @@ -192,6 +201,9 @@ const ReactNativeViewConfig: ViewConfig = {
onAccessibilityAction: true,
onAccessibilityEscape: true,
onAccessibilityTap: true,
pointerenter: true,
pointerleave: true,
pointermove: true,
onLayout: true,
onMagicTap: true,
opacity: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,4 +807,22 @@ public void setPosition(@Nullable String position) {
public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) {
super.setShouldNotifyOnLayout(shouldNotifyOnLayout);
}

@ReactProp(name = "pointerenter")
public void setShouldNotifyPointerEnter(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
}

@ReactProp(name = "pointerleave")
public void setShouldNotifyPointerLeave(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
}

@ReactProp(name = "pointermove")
public void setShouldNotifyPointerMove(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
return MapBuilder.builder()
.put("topContentSizeChange", MapBuilder.of(rn, "onContentSizeChange"))
.put("topLayout", MapBuilder.of(rn, "onLayout"))
.put("topPointerEnter", MapBuilder.of(rn, "pointerenter"))
.put("topPointerLeave", MapBuilder.of(rn, "pointerleave"))
.put("topPointerMove", MapBuilder.of(rn, "pointermove"))
.put("topLoadingError", MapBuilder.of(rn, "onLoadingError"))
.put("topLoadingFinish", MapBuilder.of(rn, "onLoadingFinish"))
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))
Expand Down

0 comments on commit 44143b5

Please sign in to comment.