Skip to content

Commit 44143b5

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Update ViewConfigs to support onEnter/onExit/onMove events
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
1 parent 437b06f commit 44143b5

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

Libraries/Components/View/ReactNativeViewViewConfig.js

+12
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ const ReactNativeViewConfig: ViewConfig = {
104104
topMagicTap: {
105105
registrationName: 'onMagicTap',
106106
},
107+
topPointerEnter: {
108+
registrationName: 'pointerenter',
109+
},
110+
topPointerLeave: {
111+
registrationName: 'pointerleave',
112+
},
113+
topPointerMove: {
114+
registrationName: 'pointermove',
115+
},
107116
// Events for react-native-gesture-handler (T45765076)
108117
// Remove once this library can handle JS View Configs
109118
onGestureHandlerEvent: {
@@ -192,6 +201,9 @@ const ReactNativeViewConfig: ViewConfig = {
192201
onAccessibilityAction: true,
193202
onAccessibilityEscape: true,
194203
onAccessibilityTap: true,
204+
pointerenter: true,
205+
pointerleave: true,
206+
pointermove: true,
195207
onLayout: true,
196208
onMagicTap: true,
197209
opacity: true,

ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java

+18
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,22 @@ public void setPosition(@Nullable String position) {
807807
public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) {
808808
super.setShouldNotifyOnLayout(shouldNotifyOnLayout);
809809
}
810+
811+
@ReactProp(name = "pointerenter")
812+
public void setShouldNotifyPointerEnter(boolean value) {
813+
// This method exists to inject Native View configs in RN Android VR
814+
// DO NOTHING
815+
}
816+
817+
@ReactProp(name = "pointerleave")
818+
public void setShouldNotifyPointerLeave(boolean value) {
819+
// This method exists to inject Native View configs in RN Android VR
820+
// DO NOTHING
821+
}
822+
823+
@ReactProp(name = "pointermove")
824+
public void setShouldNotifyPointerMove(boolean value) {
825+
// This method exists to inject Native View configs in RN Android VR
826+
// DO NOTHING
827+
}
810828
}

ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
return MapBuilder.builder()
6060
.put("topContentSizeChange", MapBuilder.of(rn, "onContentSizeChange"))
6161
.put("topLayout", MapBuilder.of(rn, "onLayout"))
62+
.put("topPointerEnter", MapBuilder.of(rn, "pointerenter"))
63+
.put("topPointerLeave", MapBuilder.of(rn, "pointerleave"))
64+
.put("topPointerMove", MapBuilder.of(rn, "pointermove"))
6265
.put("topLoadingError", MapBuilder.of(rn, "onLoadingError"))
6366
.put("topLoadingFinish", MapBuilder.of(rn, "onLoadingFinish"))
6467
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))

0 commit comments

Comments
 (0)