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
This commit is contained in:
David Vacca 2021-11-19 15:46:33 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 437b06f397
Коммит 44143b50fd
3 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -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: {
@ -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,

Просмотреть файл

@ -807,4 +807,22 @@ public class LayoutShadowNode extends ReactShadowNodeImpl {
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
}
}

Просмотреть файл

@ -59,6 +59,9 @@ import java.util.Map;
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"))