react-native-gtkx 0.2.0-alpha.1 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/adw/widgets.generated.d.ts +4 -4
- package/dist/adw/widgets.generated.js +51 -51
- package/dist/adw/widgets.generated.js.map +1 -1
- package/dist/aliases/index.d.ts +84 -0
- package/dist/aliases/index.js +208 -0
- package/dist/aliases/index.js.map +1 -0
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.d.ts +4 -0
- package/dist/animated/index.js +6 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/types.d.ts +1 -0
- package/dist/animated/types.js.map +1 -1
- package/dist/animated/value-animation.js +17 -4
- package/dist/animated/value-animation.js.map +1 -1
- package/dist/animated/value-xy.d.ts +41 -0
- package/dist/animated/value-xy.js +90 -0
- package/dist/animated/value-xy.js.map +1 -0
- package/dist/animated/value.d.ts +9 -0
- package/dist/animated/value.js +30 -2
- package/dist/animated/value.js.map +1 -1
- package/dist/apis/host.gtkx.js +9 -12
- package/dist/apis/host.gtkx.js.map +1 -1
- package/dist/apis/index.d.ts +4 -2
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/keyboard.d.ts +60 -0
- package/dist/apis/keyboard.js +63 -0
- package/dist/apis/keyboard.js.map +1 -0
- package/dist/apis/log-box.d.ts +15 -0
- package/dist/apis/log-box.js +46 -0
- package/dist/apis/log-box.js.map +1 -0
- package/dist/apis/platform.d.ts +18 -1
- package/dist/apis/platform.js.map +1 -1
- package/dist/common/icon.d.ts +23 -0
- package/dist/common/icon.js +14 -0
- package/dist/common/icon.js.map +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +25 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/widget.d.ts +1 -22
- package/dist/common/widget.js +75 -8
- package/dist/common/widget.js.map +1 -1
- package/dist/components/animated.d.ts +73 -7
- package/dist/components/animated.js +560 -45
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +26 -0
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/driven-size.d.ts +27 -0
- package/dist/components/driven-size.js +85 -0
- package/dist/components/driven-size.js.map +1 -0
- package/dist/components/find-node-handle.d.ts +11 -0
- package/dist/components/find-node-handle.js +53 -0
- package/dist/components/find-node-handle.js.map +1 -0
- package/dist/components/flat-list.d.ts +3 -2
- package/dist/components/flat-list.js.map +1 -1
- package/dist/components/frame-scheduler.d.ts +16 -0
- package/dist/components/frame-scheduler.js +37 -0
- package/dist/components/frame-scheduler.js.map +1 -0
- package/dist/components/host-node.d.ts +7 -0
- package/dist/components/host-node.js +26 -1
- package/dist/components/host-node.js.map +1 -1
- package/dist/components/image.d.ts +6 -1
- package/dist/components/image.js +15 -4
- package/dist/components/image.js.map +1 -1
- package/dist/components/index.d.ts +11 -5
- package/dist/components/index.js +7 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +63 -0
- package/dist/components/measure.js +150 -0
- package/dist/components/measure.js.map +1 -0
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/press-event.d.ts +28 -0
- package/dist/components/press-event.js +46 -0
- package/dist/components/press-event.js.map +1 -0
- package/dist/components/pressable.d.ts +63 -7
- package/dist/components/pressable.js +165 -12
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +58 -0
- package/dist/components/rect-store.js +124 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/root.js +6 -1
- package/dist/components/root.js.map +1 -1
- package/dist/components/scroll-phase.d.ts +35 -0
- package/dist/components/scroll-phase.js +26 -0
- package/dist/components/scroll-phase.js.map +1 -0
- package/dist/components/scroll-view.d.ts +43 -3
- package/dist/components/scroll-view.js +386 -45
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/text-input.js +9 -25
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.d.ts +6 -2
- package/dist/components/text.js +68 -9
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-focus.d.ts +27 -0
- package/dist/components/use-focus.js +116 -0
- package/dist/components/use-focus.js.map +1 -0
- package/dist/components/use-layout-child.d.ts +13 -1
- package/dist/components/use-layout-child.js +205 -19
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +12 -4
- package/dist/components/view.js +25 -14
- package/dist/components/view.js.map +1 -1
- package/dist/components/virtualized-list.d.ts +45 -5
- package/dist/components/virtualized-list.js +90 -24
- package/dist/components/virtualized-list.js.map +1 -1
- package/dist/components/wheel-scroll-session.d.ts +7 -0
- package/dist/components/wheel-scroll-session.js +53 -0
- package/dist/components/wheel-scroll-session.js.map +1 -0
- package/dist/components/widget-retention.d.ts +35 -0
- package/dist/components/widget-retention.js +169 -0
- package/dist/components/widget-retention.js.map +1 -0
- package/dist/contracts.d.ts +23 -3
- package/dist/contracts.js.map +1 -1
- package/dist/dnd/context.d.ts +69 -0
- package/dist/dnd/context.js +149 -0
- package/dist/dnd/context.js.map +1 -0
- package/dist/dnd/draggable.d.ts +59 -0
- package/dist/dnd/draggable.js +149 -0
- package/dist/dnd/draggable.js.map +1 -0
- package/dist/dnd/droppable.d.ts +24 -0
- package/dist/dnd/droppable.js +74 -0
- package/dist/dnd/droppable.js.map +1 -0
- package/dist/dnd/gtk-controllers.d.ts +39 -0
- package/dist/dnd/gtk-controllers.js +110 -0
- package/dist/dnd/gtk-controllers.js.map +1 -0
- package/dist/dnd/index.d.ts +6 -0
- package/dist/dnd/index.js +31 -0
- package/dist/dnd/index.js.map +1 -0
- package/dist/dnd/order.d.ts +7 -0
- package/dist/dnd/order.js +20 -0
- package/dist/dnd/order.js.map +1 -0
- package/dist/dnd/payload.d.ts +14 -0
- package/dist/dnd/payload.js +41 -0
- package/dist/dnd/payload.js.map +1 -0
- package/dist/dnd/sortable.d.ts +49 -0
- package/dist/dnd/sortable.js +307 -0
- package/dist/dnd/sortable.js.map +1 -0
- package/dist/dnd/types.d.ts +290 -0
- package/dist/dnd/types.js +25 -0
- package/dist/dnd/types.js.map +1 -0
- package/dist/gesture-handler-compat/builder.d.ts +251 -0
- package/dist/gesture-handler-compat/builder.js +513 -0
- package/dist/gesture-handler-compat/builder.js.map +1 -0
- package/dist/gesture-handler-compat/composition.d.ts +23 -0
- package/dist/gesture-handler-compat/composition.js +111 -0
- package/dist/gesture-handler-compat/composition.js.map +1 -0
- package/dist/gesture-handler-compat/deciders.d.ts +3 -0
- package/dist/gesture-handler-compat/deciders.js +47 -0
- package/dist/gesture-handler-compat/deciders.js.map +1 -0
- package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
- package/dist/gesture-handler-compat/detector-runtime.js +374 -0
- package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
- package/dist/gesture-handler-compat/detector.d.ts +22 -0
- package/dist/gesture-handler-compat/detector.js +104 -0
- package/dist/gesture-handler-compat/detector.js.map +1 -0
- package/dist/gesture-handler-compat/fling.d.ts +24 -0
- package/dist/gesture-handler-compat/fling.js +123 -0
- package/dist/gesture-handler-compat/fling.js.map +1 -0
- package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
- package/dist/gesture-handler-compat/force-touch.js +40 -0
- package/dist/gesture-handler-compat/force-touch.js.map +1 -0
- package/dist/gesture-handler-compat/hooks.d.ts +157 -0
- package/dist/gesture-handler-compat/hooks.js +268 -0
- package/dist/gesture-handler-compat/hooks.js.map +1 -0
- package/dist/gesture-handler-compat/hover.d.ts +2 -0
- package/dist/gesture-handler-compat/hover.js +22 -0
- package/dist/gesture-handler-compat/hover.js.map +1 -0
- package/dist/gesture-handler-compat/index.d.ts +98 -0
- package/dist/gesture-handler-compat/index.js +255 -0
- package/dist/gesture-handler-compat/index.js.map +1 -0
- package/dist/gesture-handler-compat/long-press.d.ts +6 -0
- package/dist/gesture-handler-compat/long-press.js +21 -0
- package/dist/gesture-handler-compat/long-press.js.map +1 -0
- package/dist/gesture-handler-compat/manual.d.ts +2 -0
- package/dist/gesture-handler-compat/manual.js +18 -0
- package/dist/gesture-handler-compat/manual.js.map +1 -0
- package/dist/gesture-handler-compat/native.d.ts +7 -0
- package/dist/gesture-handler-compat/native.js +34 -0
- package/dist/gesture-handler-compat/native.js.map +1 -0
- package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
- package/dist/gesture-handler-compat/orchestrator.js +284 -0
- package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
- package/dist/gesture-handler-compat/pan.d.ts +23 -0
- package/dist/gesture-handler-compat/pan.js +116 -0
- package/dist/gesture-handler-compat/pan.js.map +1 -0
- package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
- package/dist/gesture-handler-compat/recognizer.js +1056 -0
- package/dist/gesture-handler-compat/recognizer.js.map +1 -0
- package/dist/gesture-handler-compat/relations.d.ts +43 -0
- package/dist/gesture-handler-compat/relations.js +128 -0
- package/dist/gesture-handler-compat/relations.js.map +1 -0
- package/dist/gesture-handler-compat/tap.d.ts +6 -0
- package/dist/gesture-handler-compat/tap.js +29 -0
- package/dist/gesture-handler-compat/tap.js.map +1 -0
- package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
- package/dist/gesture-handler-compat/touchpad.js +64 -0
- package/dist/gesture-handler-compat/touchpad.js.map +1 -0
- package/dist/gesture-handler-compat/types.d.ts +441 -0
- package/dist/gesture-handler-compat/types.js +167 -0
- package/dist/gesture-handler-compat/types.js.map +1 -0
- package/dist/gtk/controllers.d.ts +39 -0
- package/dist/gtk/controllers.js +92 -0
- package/dist/gtk/controllers.js.map +1 -0
- package/dist/gtk/index.d.ts +3 -1
- package/dist/gtk/index.js +14 -1
- package/dist/gtk/index.js.map +1 -1
- package/dist/gtk/widgets.generated.d.ts +14 -14
- package/dist/gtk/widgets.generated.js +101 -102
- package/dist/gtk/widgets.generated.js.map +1 -1
- package/dist/gtk/window-actions.d.ts +77 -0
- package/dist/gtk/window-actions.js +193 -0
- package/dist/gtk/window-actions.js.map +1 -0
- package/dist/gtkx/bridge/geometry.d.ts +15 -0
- package/dist/gtkx/bridge/geometry.js +40 -0
- package/dist/gtkx/bridge/geometry.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +7 -3
- package/dist/gtkx/bridge/index.js +12 -4
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
- package/dist/gtkx/bridge/slot-portal.js +17 -0
- package/dist/gtkx/bridge/slot-portal.js.map +1 -0
- package/dist/gtkx/bridge/svg-node.js +10 -54
- package/dist/gtkx/bridge/svg-node.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +2 -2
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/view-box.d.ts +56 -0
- package/dist/gtkx/bridge/view-box.js +394 -9
- package/dist/gtkx/bridge/view-box.js.map +1 -1
- package/dist/gtkx/bridge/widget-css.d.ts +17 -0
- package/dist/gtkx/bridge/widget-css.js +72 -0
- package/dist/gtkx/bridge/widget-css.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/driven-size.d.ts +12 -0
- package/dist/layout/driven-size.js +70 -0
- package/dist/layout/driven-size.js.map +1 -0
- package/dist/layout/engine.d.ts +17 -1
- package/dist/layout/engine.js +3 -20
- package/dist/layout/engine.js.map +1 -1
- package/dist/layout/node.d.ts +13 -0
- package/dist/layout/node.js +14 -0
- package/dist/layout/node.js.map +1 -1
- package/dist/layout/yoga.d.ts +3 -2
- package/dist/layout/yoga.js +5 -2
- package/dist/layout/yoga.js.map +1 -1
- package/dist/mcp/data/generated.d.ts +310 -91
- package/dist/mcp/data/generated.js +365 -90
- package/dist/mcp/data/generated.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/metro/index.d.ts +10 -0
- package/dist/metro/index.js +21 -12
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +47 -1
- package/dist/navigation/sidebar.js +77 -3
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/reanimated-compat/animated-ref.d.ts +32 -0
- package/dist/reanimated-compat/animated-ref.js +57 -0
- package/dist/reanimated-compat/animated-ref.js.map +1 -0
- package/dist/reanimated-compat/animation.d.ts +177 -0
- package/dist/reanimated-compat/animation.js +540 -0
- package/dist/reanimated-compat/animation.js.map +1 -0
- package/dist/reanimated-compat/color.d.ts +28 -0
- package/dist/reanimated-compat/color.js +249 -0
- package/dist/reanimated-compat/color.js.map +1 -0
- package/dist/reanimated-compat/decay.d.ts +39 -0
- package/dist/reanimated-compat/decay.js +96 -0
- package/dist/reanimated-compat/decay.js.map +1 -0
- package/dist/reanimated-compat/easing.d.ts +30 -0
- package/dist/reanimated-compat/easing.js +76 -0
- package/dist/reanimated-compat/easing.js.map +1 -0
- package/dist/reanimated-compat/hooks.d.ts +14 -0
- package/dist/reanimated-compat/hooks.js +217 -0
- package/dist/reanimated-compat/hooks.js.map +1 -0
- package/dist/reanimated-compat/index.d.ts +258 -0
- package/dist/reanimated-compat/index.js +464 -0
- package/dist/reanimated-compat/index.js.map +1 -0
- package/dist/reanimated-compat/interpolation.d.ts +18 -0
- package/dist/reanimated-compat/interpolation.js +122 -0
- package/dist/reanimated-compat/interpolation.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
- package/dist/reanimated-compat/layout-animation-config.js +78 -0
- package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
- package/dist/reanimated-compat/layout-animation-presets.js +498 -0
- package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
- package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
- package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
- package/dist/reanimated-compat/layout-animation-view.js +266 -0
- package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
- package/dist/reanimated-compat/layout-animation.d.ts +171 -0
- package/dist/reanimated-compat/layout-animation.js +469 -0
- package/dist/reanimated-compat/layout-animation.js.map +1 -0
- package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
- package/dist/reanimated-compat/layout-transitions.js +350 -0
- package/dist/reanimated-compat/layout-transitions.js.map +1 -0
- package/dist/reanimated-compat/mutable.d.ts +29 -0
- package/dist/reanimated-compat/mutable.js +139 -0
- package/dist/reanimated-compat/mutable.js.map +1 -0
- package/dist/reanimated-compat/props.d.ts +18 -0
- package/dist/reanimated-compat/props.js +111 -0
- package/dist/reanimated-compat/props.js.map +1 -0
- package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
- package/dist/reanimated-compat/scroll-handler.js +274 -0
- package/dist/reanimated-compat/scroll-handler.js.map +1 -0
- package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
- package/dist/reanimated-compat/scroll-offset.js +104 -0
- package/dist/reanimated-compat/scroll-offset.js.map +1 -0
- package/dist/reanimated-compat/style.d.ts +90 -0
- package/dist/reanimated-compat/style.js +452 -0
- package/dist/reanimated-compat/style.js.map +1 -0
- package/dist/reanimated-compat/test-timers.d.ts +28 -0
- package/dist/reanimated-compat/test-timers.js +136 -0
- package/dist/reanimated-compat/test-timers.js.map +1 -0
- package/dist/reanimated-compat/threads.d.ts +13 -0
- package/dist/reanimated-compat/threads.js +41 -0
- package/dist/reanimated-compat/threads.js.map +1 -0
- package/dist/reanimated-compat/tracking.d.ts +41 -0
- package/dist/reanimated-compat/tracking.js +106 -0
- package/dist/reanimated-compat/tracking.js.map +1 -0
- package/dist/reanimated-compat/updater-animations.d.ts +36 -0
- package/dist/reanimated-compat/updater-animations.js +273 -0
- package/dist/reanimated-compat/updater-animations.js.map +1 -0
- package/dist/responder/system.d.ts +100 -0
- package/dist/responder/system.js +304 -0
- package/dist/responder/system.js.map +1 -0
- package/dist/responder/touch-history.d.ts +10 -0
- package/dist/responder/touch-history.js +78 -0
- package/dist/responder/touch-history.js.map +1 -0
- package/dist/responder/types.d.ts +63 -0
- package/dist/responder/types.js +29 -0
- package/dist/responder/types.js.map +1 -0
- package/dist/responder/use-responder.d.ts +23 -0
- package/dist/responder/use-responder.js +317 -0
- package/dist/responder/use-responder.js.map +1 -0
- package/dist/runner/host-dev.js +4 -2
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +6 -2
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/gtkx-config-module.js +2 -2
- package/dist/sea/gtkx-config-module.js.map +1 -1
- package/dist/style/absolute-insets.d.ts +26 -0
- package/dist/style/absolute-insets.js +113 -0
- package/dist/style/absolute-insets.js.map +1 -0
- package/dist/style/animated-size.d.ts +25 -0
- package/dist/style/animated-size.js +225 -0
- package/dist/style/animated-size.js.map +1 -0
- package/dist/style/box-shadow.d.ts +7 -0
- package/dist/style/box-shadow.js +197 -0
- package/dist/style/box-shadow.js.map +1 -0
- package/dist/style/colors.d.ts +17 -0
- package/dist/style/colors.js +25 -6
- package/dist/style/colors.js.map +1 -1
- package/dist/style/imperative-css.d.ts +21 -0
- package/dist/style/imperative-css.js +63 -0
- package/dist/style/imperative-css.js.map +1 -0
- package/dist/style/index.d.ts +4 -1
- package/dist/style/index.js +4 -1
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.d.ts +5 -2
- package/dist/style/split-style.js +36 -3
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-decoration.d.ts +15 -0
- package/dist/style/text-decoration.js +26 -0
- package/dist/style/text-decoration.js.map +1 -0
- package/dist/style/visual-css.js +37 -1
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/gradient-geometry.js +2 -5
- package/dist/svg/gradient-geometry.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unsupported-export.d.ts +8 -0
- package/dist/unsupported-export.js +66 -0
- package/dist/unsupported-export.js.map +1 -0
- package/dist/vendor/react-native/pan-responder.d.ts +102 -0
- package/dist/vendor/react-native/pan-responder.js +196 -0
- package/dist/vendor/react-native/pan-responder.js.map +1 -0
- package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
- package/dist/vendor/react-native/touch-history-math.js +102 -0
- package/dist/vendor/react-native/touch-history-math.js.map +1 -0
- package/dist/vite/index.d.ts +21 -8
- package/dist/vite/index.js +127 -82
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/dist/worklets-compat/index.d.ts +4 -0
- package/dist/worklets-compat/index.js +28 -0
- package/dist/worklets-compat/index.js.map +1 -0
- package/dist/worklets-compat/surface.d.ts +110 -0
- package/dist/worklets-compat/surface.js +153 -0
- package/dist/worklets-compat/surface.js.map +1 -0
- package/package.json +25 -9
- package/types.d.ts +9 -0
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { StyleProp } from "../contracts";
|
|
3
|
+
import { type HitSlop } from "../gtkx/bridge/index";
|
|
4
|
+
import { type PressEvent } from "./press-event";
|
|
3
5
|
import { type LayoutEvent } from "./use-layout-child";
|
|
4
6
|
export type PressableStateCallbackType = {
|
|
5
7
|
pressed: boolean;
|
|
6
8
|
hovered: boolean;
|
|
9
|
+
focused: boolean;
|
|
7
10
|
};
|
|
8
|
-
export type PressEvent
|
|
9
|
-
nativeEvent: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
11
|
+
export type { NativeTouch, PressEvent } from "./press-event";
|
|
14
12
|
export type PressableProps = {
|
|
15
13
|
style?: StyleProp | ((state: PressableStateCallbackType) => StyleProp);
|
|
16
14
|
children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
|
|
@@ -20,14 +18,72 @@ export type PressableProps = {
|
|
|
20
18
|
onLongPress?: (event: PressEvent) => void;
|
|
21
19
|
onHoverIn?: () => void;
|
|
22
20
|
onHoverOut?: () => void;
|
|
21
|
+
onFocus?: () => void;
|
|
22
|
+
onBlur?: () => void;
|
|
23
|
+
/** Whether Tab and the arrow keys can reach this pressable. Defaults to
|
|
24
|
+
* true when `onPress` is set, which is react-native-web's own rule — a
|
|
25
|
+
* control you can click and cannot reach from the keyboard is an
|
|
26
|
+
* accessibility bug, and on a desktop that matters more, not less. */
|
|
27
|
+
focusable?: boolean;
|
|
23
28
|
disabled?: boolean;
|
|
24
29
|
delayLongPress?: number;
|
|
30
|
+
/** RN's hitSlop: how far OUTSIDE its bounds this pressable still counts
|
|
31
|
+
* as pressed. A number is all four edges. Limited by an ancestor that
|
|
32
|
+
* clips — a ScrollView's viewport, say — because GTK stops picking at
|
|
33
|
+
* the clip, the same constraint RN documents on Android. */
|
|
34
|
+
hitSlop?: number | Partial<HitSlop>;
|
|
35
|
+
/** RN's pressRetentionOffset: how far the pointer may drift outside the
|
|
36
|
+
* hit rect after pressing and still activate on release. Defaults to
|
|
37
|
+
* RN's own {top: 20, left: 20, right: 20, bottom: 30}. */
|
|
38
|
+
pressRetentionOffset?: number | Partial<HitSlop>;
|
|
25
39
|
onLayout?: (event: LayoutEvent) => void;
|
|
26
40
|
testID?: string;
|
|
27
41
|
};
|
|
28
|
-
export declare const Pressable: ({ style, children, onPress, onPressIn, onPressOut, onLongPress, onHoverIn, onHoverOut, disabled, delayLongPress, onLayout, testID, }: PressableProps) => React.JSX.Element;
|
|
42
|
+
export declare const Pressable: ({ style, children, onPress, onPressIn, onPressOut, onLongPress, onHoverIn, onHoverOut, onFocus, onBlur, focusable, disabled, delayLongPress, hitSlop, pressRetentionOffset, onLayout, testID, }: PressableProps) => React.JSX.Element;
|
|
29
43
|
export type TouchableOpacityProps = Omit<PressableProps, "style"> & {
|
|
30
44
|
style?: StyleProp;
|
|
31
45
|
activeOpacity?: number;
|
|
32
46
|
};
|
|
33
47
|
export declare const TouchableOpacity: ({ style, activeOpacity, ...rest }: TouchableOpacityProps) => React.JSX.Element;
|
|
48
|
+
export type TouchableHighlightProps = Omit<PressableProps, "style"> & {
|
|
49
|
+
style?: StyleProp;
|
|
50
|
+
/**
|
|
51
|
+
* RN's default is `"black"`, and its default `activeOpacity` is `0.85` — the
|
|
52
|
+
* underlay shows through the dimmed child rather than replacing it. Here the
|
|
53
|
+
* underlay IS the background, because there is no separate underlay view to
|
|
54
|
+
* put behind a child that may be opaque, so an app that wants RN's exact
|
|
55
|
+
* blend gives the child a translucent background itself.
|
|
56
|
+
*/
|
|
57
|
+
underlayColor?: string;
|
|
58
|
+
activeOpacity?: number;
|
|
59
|
+
onShowUnderlay?: () => void;
|
|
60
|
+
onHideUnderlay?: () => void;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* RN's `TouchableHighlight`: a background colour while held.
|
|
64
|
+
*
|
|
65
|
+
* Here because `@gorhom/bottom-sheet` re-exports it from its own public entry
|
|
66
|
+
* as `BottomSheetTouchable` on every platform except iOS — it is upstream's
|
|
67
|
+
* export, not an app's choice, so an app cannot avoid it. It is also an
|
|
68
|
+
* ordinary `react-native` component that this surface was simply missing.
|
|
69
|
+
*
|
|
70
|
+
* One structural difference, stated rather than papered over: RN renders a
|
|
71
|
+
* separate underlay VIEW behind the child and lowers the child's opacity onto
|
|
72
|
+
* it. Reproducing that needs a second box, and an extra box changes flex
|
|
73
|
+
* layout and what `measureLayout` is relative to — the same reason
|
|
74
|
+
* `GestureDetector` and `createAnimatedComponent` add none. So the highlight
|
|
75
|
+
* is this view's own `backgroundColor` while pressed.
|
|
76
|
+
*/
|
|
77
|
+
export declare const TouchableHighlight: ({ style, underlayColor, activeOpacity, onShowUnderlay, onHideUnderlay, onPressIn, onPressOut, ...rest }: TouchableHighlightProps) => React.JSX.Element;
|
|
78
|
+
export type TouchableWithoutFeedbackProps = PressableProps;
|
|
79
|
+
/**
|
|
80
|
+
* RN's `TouchableWithoutFeedback`: the press callbacks and nothing visual.
|
|
81
|
+
*
|
|
82
|
+
* RN's own version clones its single child rather than rendering a box, and
|
|
83
|
+
* its documentation calls that a mistake it kept for compatibility. This one
|
|
84
|
+
* renders the `Pressable` box, which is what `Pressable` already is with no
|
|
85
|
+
* `style` callback — the difference is invisible unless the child was relying
|
|
86
|
+
* on being laid out by ITS parent, and RN's own docs tell you to use
|
|
87
|
+
* `Pressable` instead for exactly that reason.
|
|
88
|
+
*/
|
|
89
|
+
export declare const TouchableWithoutFeedback: (props: PressableProps) => React.JSX.Element;
|
|
@@ -2,18 +2,46 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useLayoutEffect, useReducer, useRef, useState, } from "react";
|
|
3
3
|
import { splitStyle, StyleSheet } from "../style/index";
|
|
4
4
|
import { defaultCssRegistry } from "../style/registry.gtkx";
|
|
5
|
-
import { Gtk,
|
|
5
|
+
import { getViewBoxComponent, Gtk, setHitSlop, } from "../gtkx/bridge/index";
|
|
6
6
|
import { perfAddTime, perfCount, perfEnabled, perfNow } from "../perf";
|
|
7
7
|
import { HostNodeContext } from "./host-node";
|
|
8
|
+
import { createPressEvent, createTouch } from "./press-event";
|
|
9
|
+
import { useActivateOnKey, useFocusable, useFocusController } from "./use-focus";
|
|
8
10
|
import { useLayoutChild, useRnContainer, } from "./use-layout-child";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const NO_SLOP = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
12
|
+
/**
|
|
13
|
+
* RN's own DEFAULT_PRESS_RECT_OFFSETS, from Libraries/Pressability. The
|
|
14
|
+
* bottom edge is deliberately larger: a thumb rolls downwards off a target
|
|
15
|
+
* far more often than upwards.
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_PRESS_RECT = { top: 20, right: 20, bottom: 30, left: 20 };
|
|
18
|
+
const toRect = (value, fallback) => {
|
|
19
|
+
if (value === undefined) {
|
|
20
|
+
return fallback;
|
|
21
|
+
}
|
|
22
|
+
if (typeof value === "number") {
|
|
23
|
+
return { top: value, right: value, bottom: value, left: value };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
top: value.top ?? 0,
|
|
27
|
+
right: value.right ?? 0,
|
|
28
|
+
bottom: value.bottom ?? 0,
|
|
29
|
+
left: value.left ?? 0,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
// Coordinates arrive from GtkGestureClick in the widget's own space, which
|
|
33
|
+
// is exactly RN's locationX/locationY; createTouch translates them into the
|
|
34
|
+
// window for pageX/pageY.
|
|
35
|
+
const pressEvent = (widget, x, y) => createPressEvent(createTouch(widget, x, y));
|
|
12
36
|
// A View with a click gesture and hover tracking. State-dependent style and
|
|
13
37
|
// children follow the RN Pressable function-prop contract.
|
|
14
|
-
export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onLongPress, onHoverIn, onHoverOut, disabled = false, delayLongPress = 500, onLayout, testID, }) => {
|
|
38
|
+
export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onLongPress, onHoverIn, onHoverOut, onFocus, onBlur, focusable, disabled = false, delayLongPress = 500, hitSlop, pressRetentionOffset, onLayout, testID, }) => {
|
|
15
39
|
const widgetRef = useRef(null);
|
|
16
40
|
const [pressed, setPressed] = useState(false);
|
|
41
|
+
// Focus IS React state, unlike hover: it changes at human-decision rates
|
|
42
|
+
// (a Tab press), not at pointer-motion rates, so the fast path hover needs
|
|
43
|
+
// would be complexity with nothing to buy.
|
|
44
|
+
const [focused, setFocused] = useState(false);
|
|
17
45
|
// Hover is not React state: a boundary crossing should cost what it costs
|
|
18
46
|
// a native GtkListBox row to swap a CSS class, not a setState + render +
|
|
19
47
|
// Yoga + allocate cycle (measured: roughly 500x the latency of a native
|
|
@@ -37,8 +65,9 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
37
65
|
const state = {
|
|
38
66
|
pressed,
|
|
39
67
|
hovered: hoveredRef.current,
|
|
68
|
+
focused,
|
|
40
69
|
};
|
|
41
|
-
// Gestures are attached imperatively even though rc.
|
|
70
|
+
// Gestures are attached imperatively even though rc.3 has a declarative
|
|
42
71
|
// `controllers` slot: the controllers are wired exactly once per widget and
|
|
43
72
|
// the handlers read the latest props through a ref, so a re-render never
|
|
44
73
|
// detaches and re-adds a gesture mid-press.
|
|
@@ -79,6 +108,7 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
79
108
|
const otherState = {
|
|
80
109
|
pressed,
|
|
81
110
|
hovered: !hoveredRef.current,
|
|
111
|
+
focused,
|
|
82
112
|
};
|
|
83
113
|
const otherFlat = StyleSheet.flatten(style(otherState));
|
|
84
114
|
const otherSplit = splitStyle(otherFlat);
|
|
@@ -119,24 +149,51 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
119
149
|
}
|
|
120
150
|
longPressFired.current = false;
|
|
121
151
|
setPressed(true);
|
|
122
|
-
|
|
152
|
+
const widget = widgetRef.current;
|
|
153
|
+
onPressIn?.(pressEvent(widget, x, y));
|
|
123
154
|
if (onLongPress) {
|
|
124
155
|
clearLongPress();
|
|
125
156
|
longPressTimer.current = setTimeout(() => {
|
|
126
157
|
longPressFired.current = true;
|
|
127
|
-
|
|
158
|
+
// Timestamped when it FIRES, not when the press started — the delay
|
|
159
|
+
// is the whole point of the event.
|
|
160
|
+
onLongPress(pressEvent(widgetRef.current, x, y));
|
|
128
161
|
}, delayLongPress);
|
|
129
162
|
}
|
|
130
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* Whether a release at (x, y) — in the widget's own coordinates — still
|
|
166
|
+
* counts as pressing this control. RN's press rect is the hit rect plus
|
|
167
|
+
* pressRetentionOffset, and a release outside it is a cancel, not a
|
|
168
|
+
* press: dragging off a button to change your mind is how every toolkit
|
|
169
|
+
* works, GTK's own GtkButton included. GtkGestureClick keeps an implicit
|
|
170
|
+
* grab for the whole press, so `released` arrives here wherever the
|
|
171
|
+
* pointer ended up and the check has to be ours.
|
|
172
|
+
*/
|
|
173
|
+
const withinPressRect = (x, y) => {
|
|
174
|
+
const widget = widgetRef.current;
|
|
175
|
+
if (!widget) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
const slop = slopRef.current;
|
|
179
|
+
const retention = retentionRef.current;
|
|
180
|
+
return (x >= -(slop.left + retention.left) &&
|
|
181
|
+
y >= -(slop.top + retention.top) &&
|
|
182
|
+
x < widget.getWidth() + slop.right + retention.right &&
|
|
183
|
+
y < widget.getHeight() + slop.bottom + retention.bottom);
|
|
184
|
+
};
|
|
131
185
|
const handleReleased = (_n, x, y) => {
|
|
132
186
|
if (disabled) {
|
|
133
187
|
return;
|
|
134
188
|
}
|
|
135
189
|
clearLongPress();
|
|
136
190
|
setPressed(false);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
191
|
+
const widget = widgetRef.current;
|
|
192
|
+
// onPressOut fires either way — RN reports the end of the press whether
|
|
193
|
+
// it turned into an activation or not.
|
|
194
|
+
onPressOut?.(pressEvent(widget, x, y));
|
|
195
|
+
if (!longPressFired.current && withinPressRect(x, y)) {
|
|
196
|
+
onPress?.(pressEvent(widget, x, y));
|
|
140
197
|
}
|
|
141
198
|
};
|
|
142
199
|
const handleCancel = () => {
|
|
@@ -183,6 +240,41 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
183
240
|
handleEnter: () => applyHover(true, onHoverIn),
|
|
184
241
|
handleLeave: () => applyHover(false, onHoverOut),
|
|
185
242
|
};
|
|
243
|
+
// A pressable that can be clicked should be reachable from the keyboard;
|
|
244
|
+
// one that only hovers or lays out should not join the Tab order. That is
|
|
245
|
+
// react-native-web's rule, and it keeps every existing Pressable in this
|
|
246
|
+
// repo behaving as before unless it had an onPress to begin with.
|
|
247
|
+
useFocusable(widgetRef, focusable ?? onPress !== undefined);
|
|
248
|
+
useFocusController(widgetRef, () => {
|
|
249
|
+
setFocused(true);
|
|
250
|
+
onFocus?.();
|
|
251
|
+
}, () => {
|
|
252
|
+
setFocused(false);
|
|
253
|
+
onBlur?.();
|
|
254
|
+
});
|
|
255
|
+
// Enter and Space activate a focused control on web and on Android, so
|
|
256
|
+
// they do here. The press event is synthesised at the widget's own origin
|
|
257
|
+
// — a keyboard press has no coordinates, and RN's own handlers read
|
|
258
|
+
// locationX/Y unconditionally.
|
|
259
|
+
useActivateOnKey(widgetRef, disabled || !onPress
|
|
260
|
+
? undefined
|
|
261
|
+
: () => onPress(pressEvent(widgetRef.current, 0, 0)));
|
|
262
|
+
// Read from the gesture handlers, which are installed once and must not
|
|
263
|
+
// close over a stale prop.
|
|
264
|
+
const slopRef = useRef(NO_SLOP);
|
|
265
|
+
const retentionRef = useRef(DEFAULT_PRESS_RECT);
|
|
266
|
+
slopRef.current = toRect(hitSlop, NO_SLOP);
|
|
267
|
+
retentionRef.current = toRect(pressRetentionOffset, DEFAULT_PRESS_RECT);
|
|
268
|
+
const slop = slopRef.current;
|
|
269
|
+
useLayoutEffect(() => {
|
|
270
|
+
const widget = widgetRef.current;
|
|
271
|
+
if (!widget) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const empty = slop.top === 0 && slop.right === 0 && slop.bottom === 0 && slop.left === 0;
|
|
275
|
+
setHitSlop(widget, empty ? null : slop);
|
|
276
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
277
|
+
}, [slop.top, slop.right, slop.bottom, slop.left]);
|
|
186
278
|
useLayoutEffect(() => {
|
|
187
279
|
const widget = widgetRef.current;
|
|
188
280
|
if (!widget) {
|
|
@@ -193,6 +285,24 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
193
285
|
click.on("released", (n, x, y) => handlersRef.current.handleReleased(n, x, y));
|
|
194
286
|
click.on("cancel", () => handlersRef.current.handleCancel());
|
|
195
287
|
widget.addController(click);
|
|
288
|
+
// Hover fires from touch as well as from a mouse, and that is left
|
|
289
|
+
// alone deliberately. react-native-web filters it — `useHover` drops
|
|
290
|
+
// any event whose pointerType is "touch", because on a phone every tap
|
|
291
|
+
// would otherwise leave a view looking hovered. Three measurements say
|
|
292
|
+
// not to copy it here. GTK gives a crossing event no device at all:
|
|
293
|
+
// inside `enter` and `leave` both `get_current_event()` and
|
|
294
|
+
// `get_current_event_device()` are null, because GTK routes crossings
|
|
295
|
+
// through a path that never sets the controller's current event, so the
|
|
296
|
+
// filter would have to come from somewhere else entirely — a raw event
|
|
297
|
+
// tap on the toplevel recording the last input source, which is
|
|
298
|
+
// per-event JS work on every window for a filter nobody can check.
|
|
299
|
+
// GTK also sends a matching leave when a touch sequence ends, so the
|
|
300
|
+
// stuck phantom hover that motivates RNW's filter does not arise, and
|
|
301
|
+
// GTK's own CSS `:hover` lights up on touch — filtering would make this
|
|
302
|
+
// platform's Pressable behave unlike every widget beside it. And it
|
|
303
|
+
// cannot be verified either way here: there is no way to inject a touch
|
|
304
|
+
// on this rig (docs/research/gestures.md). Revisit with a touchscreen
|
|
305
|
+
// and a reason, not before.
|
|
196
306
|
const motion = new Gtk.EventControllerMotion();
|
|
197
307
|
motion.on("enter", () => handlersRef.current.handleEnter());
|
|
198
308
|
motion.on("leave", () => handlersRef.current.handleLeave());
|
|
@@ -202,8 +312,51 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
202
312
|
widget.removeController(motion);
|
|
203
313
|
};
|
|
204
314
|
}, []);
|
|
205
|
-
|
|
315
|
+
// The same GtkBox subclass a View renders, for its contains() override:
|
|
316
|
+
// hitSlop is a picking change and nothing in JS can substitute for one,
|
|
317
|
+
// because a press outside the widget is never delivered to it at all.
|
|
318
|
+
const PressableBox = getViewBoxComponent();
|
|
319
|
+
return (_jsx(PressableBox, { ref: widgetRef, name: testID, cssClasses: cssClass ? [cssClass] : [], children: _jsx(HostNodeContext.Provider, { value: { engine: host.engine, node, widgetRef }, children: resolvedChildren }) }));
|
|
206
320
|
};
|
|
207
321
|
// Classic RN touchable: dims itself while pressed via widget opacity.
|
|
208
322
|
export const TouchableOpacity = ({ style, activeOpacity = 0.5, ...rest }) => (_jsx(Pressable, { ...rest, style: ({ pressed }) => [style, pressed && { opacity: activeOpacity }] }));
|
|
323
|
+
/**
|
|
324
|
+
* RN's `TouchableHighlight`: a background colour while held.
|
|
325
|
+
*
|
|
326
|
+
* Here because `@gorhom/bottom-sheet` re-exports it from its own public entry
|
|
327
|
+
* as `BottomSheetTouchable` on every platform except iOS — it is upstream's
|
|
328
|
+
* export, not an app's choice, so an app cannot avoid it. It is also an
|
|
329
|
+
* ordinary `react-native` component that this surface was simply missing.
|
|
330
|
+
*
|
|
331
|
+
* One structural difference, stated rather than papered over: RN renders a
|
|
332
|
+
* separate underlay VIEW behind the child and lowers the child's opacity onto
|
|
333
|
+
* it. Reproducing that needs a second box, and an extra box changes flex
|
|
334
|
+
* layout and what `measureLayout` is relative to — the same reason
|
|
335
|
+
* `GestureDetector` and `createAnimatedComponent` add none. So the highlight
|
|
336
|
+
* is this view's own `backgroundColor` while pressed.
|
|
337
|
+
*/
|
|
338
|
+
export const TouchableHighlight = ({ style, underlayColor = "black", activeOpacity, onShowUnderlay, onHideUnderlay, onPressIn, onPressOut, ...rest }) => (_jsx(Pressable, { ...rest, onPressIn: (event) => {
|
|
339
|
+
onShowUnderlay?.();
|
|
340
|
+
onPressIn?.(event);
|
|
341
|
+
}, onPressOut: (event) => {
|
|
342
|
+
onHideUnderlay?.();
|
|
343
|
+
onPressOut?.(event);
|
|
344
|
+
}, style: ({ pressed }) => [
|
|
345
|
+
style,
|
|
346
|
+
pressed && {
|
|
347
|
+
backgroundColor: underlayColor,
|
|
348
|
+
...(activeOpacity === undefined ? null : { opacity: activeOpacity }),
|
|
349
|
+
},
|
|
350
|
+
] }));
|
|
351
|
+
/**
|
|
352
|
+
* RN's `TouchableWithoutFeedback`: the press callbacks and nothing visual.
|
|
353
|
+
*
|
|
354
|
+
* RN's own version clones its single child rather than rendering a box, and
|
|
355
|
+
* its documentation calls that a mistake it kept for compatibility. This one
|
|
356
|
+
* renders the `Pressable` box, which is what `Pressable` already is with no
|
|
357
|
+
* `style` callback — the difference is invisible unless the child was relying
|
|
358
|
+
* on being laid out by ITS parent, and RN's own docs tell you to use
|
|
359
|
+
* `Pressable` instead for exactly that reason.
|
|
360
|
+
*/
|
|
361
|
+
export const TouchableWithoutFeedback = (props) => (_jsx(Pressable, { ...props }));
|
|
209
362
|
//# sourceMappingURL=pressable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/components/pressable.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,cAAc,EACd,cAAc,GAEf,MAAM,oBAAoB,CAAA;AAwB3B,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAc,EAAE,CAAC,CAAC;IACxD,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;CACtB,CAAC,CAAA;AAEF,4EAA4E;AAC5E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,cAAc,GAAG,GAAG,EACpB,QAAQ,EACR,MAAM,GACS,EAAE,EAAE;IACnB,MAAM,SAAS,GAAG,MAAM,CAAiB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AAE,YAE9C,gBAAgB,GACQ,GACpB,CACV,CAAA;AACH,CAAC,CAAA;AAOD,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,aAAa,GAAG,GAAG,EACnB,GAAG,IAAI,EACe,EAAE,EAAE,CAAC,CAC3B,KAAC,SAAS,OACJ,IAAI,EACR,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,GACtE,CACH,CAAA","sourcesContent":["import {\n useLayoutEffect,\n useReducer,\n useRef,\n useState,\n type ReactNode,\n} from \"react\"\nimport { splitStyle, StyleSheet } from \"../style/index\"\nimport { defaultCssRegistry } from \"../style/registry.gtkx\"\nimport type { StyleProp } from \"../contracts\"\nimport { Gtk, GtkBox } from \"../gtkx/bridge/index\"\nimport { perfAddTime, perfCount, perfEnabled, perfNow } from \"../perf\"\nimport { HostNodeContext } from \"./host-node\"\nimport {\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\nexport type PressableStateCallbackType = {\n pressed: boolean\n hovered: boolean\n}\n\nexport type PressEvent = { nativeEvent: { x: number; y: number } }\n\nexport type PressableProps = {\n style?: StyleProp | ((state: PressableStateCallbackType) => StyleProp)\n children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode)\n onPress?: (event: PressEvent) => void\n onPressIn?: (event: PressEvent) => void\n onPressOut?: (event: PressEvent) => void\n onLongPress?: (event: PressEvent) => void\n onHoverIn?: () => void\n onHoverOut?: () => void\n disabled?: boolean\n delayLongPress?: number\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst pressEvent = (x: number, y: number): PressEvent => ({\n nativeEvent: { x, y },\n})\n\n// A View with a click gesture and hover tracking. State-dependent style and\n// children follow the RN Pressable function-prop contract.\nexport const Pressable = ({\n style,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n onHoverIn,\n onHoverOut,\n disabled = false,\n delayLongPress = 500,\n onLayout,\n testID,\n}: PressableProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const [pressed, setPressed] = useState(false)\n // Hover is not React state: a boundary crossing should cost what it costs\n // a native GtkListBox row to swap a CSS class, not a setState + render +\n // Yoga + allocate cycle (measured: roughly 500x the latency of a native\n // row at rest, see docs/research/scroll-performance.md, task 007).\n // `hoveredRef` is the single source of truth, read directly at render\n // time — safe here because this component already mutates\n // `handlersRef.current` in the render body below, so render was never\n // React-DOM-pure to begin with. `forceRender` is used only for the two\n // cases that genuinely need a real render: `children` reads `hovered`,\n // or hovering would itself change layout (not just paint).\n const hoveredRef = useRef(false)\n const [, forceRender] = useReducer((n: number) => n + 1, 0)\n const longPressTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const longPressFired = useRef(false)\n // TEMPORARY perf instrumentation (task 007, see\n // docs/research/scroll-performance.md): timestamp the native enter/leave\n // signal so hover's real signal-to-applied latency can be reported —\n // synchronously for the fast path below, after the resulting commit for\n // the slow one. perf.ts hooks are no-ops unless GTKX_PERF=1.\n const hoverSignalAt = useRef<number | null>(null)\n\n const state: PressableStateCallbackType = {\n pressed,\n hovered: hoveredRef.current,\n }\n\n // Gestures are attached imperatively even though rc.2 has a declarative\n // `controllers` slot: the controllers are wired exactly once per widget and\n // the handlers read the latest props through a ref, so a re-render never\n // detaches and re-adds a gesture mid-press.\n const handlersRef = useRef({\n handlePressed: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleReleased: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleCancel: (): void => {},\n handleEnter: (): void => {},\n handleLeave: (): void => {},\n })\n const resolvedStyle = typeof style === \"function\" ? style(state) : style\n const resolvedChildren =\n typeof children === \"function\" ? children(state) : children\n\n const { host, node, cssClass, flat } = useLayoutChild(widgetRef, {\n style: resolvedStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n\n // Hover fast path: when `children` does not read state, hovering can\n // never change what is rendered — only `style` might. Precompute the CSS\n // class for the OTHER hover value so the native enter/leave handlers\n // below can swap classes directly on the widget, with no React involved\n // at all. If hovering would also change LAYOUT (rare — every hover style\n // in this codebase's own examples is background/border) that swap is\n // unsafe, since a real reflow is required; fall back to the ordinary\n // render in that case, exactly as before this change.\n let hoverOnClass: string | null = null\n let hoverOffClass: string | null = null\n let canSwapHoverClass = typeof children !== \"function\"\n if (canSwapHoverClass && typeof style === \"function\") {\n const otherState: PressableStateCallbackType = {\n pressed,\n hovered: !hoveredRef.current,\n }\n const otherFlat = StyleSheet.flatten(style(otherState))\n const otherSplit = splitStyle(otherFlat)\n const currentLayout = splitStyle(flat).layout\n if (JSON.stringify(currentLayout) !== JSON.stringify(otherSplit.layout)) {\n // Hovering resizes or repositions this widget — a CSS class alone\n // cannot do that, it needs Yoga. Fall back to a real render.\n canSwapHoverClass = false\n } else {\n const otherClass = defaultCssRegistry.getClassName(otherSplit.visual)\n hoverOnClass = hoveredRef.current ? cssClass : otherClass\n hoverOffClass = hoveredRef.current ? otherClass : cssClass\n }\n }\n\n // TEMPORARY perf instrumentation (task 007): runs after every commit, so\n // it always lands right after whatever render the SLOW hover path\n // triggered. A no-op when no hover signal is pending (the common case:\n // renders triggered by anything else, or the fast path above, which\n // measures itself synchronously) or when GTKX_PERF is unset.\n useLayoutEffect(() => {\n if (!perfEnabled || hoverSignalAt.current === null) {\n return\n }\n perfAddTime(\"pressable.hoverApply\", perfNow() - hoverSignalAt.current)\n perfCount(\"pressable.hoverFullCycle\")\n hoverSignalAt.current = null\n })\n\n const clearLongPress = (): void => {\n if (longPressTimer.current !== null) {\n clearTimeout(longPressTimer.current)\n longPressTimer.current = null\n }\n }\n\n const handlePressed = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n longPressFired.current = false\n setPressed(true)\n onPressIn?.(pressEvent(x, y))\n if (onLongPress) {\n clearLongPress()\n longPressTimer.current = setTimeout(() => {\n longPressFired.current = true\n onLongPress(pressEvent(x, y))\n }, delayLongPress)\n }\n }\n\n const handleReleased = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n clearLongPress()\n setPressed(false)\n onPressOut?.(pressEvent(x, y))\n if (!longPressFired.current) {\n onPress?.(pressEvent(x, y))\n }\n }\n\n const handleCancel = (): void => {\n clearLongPress()\n setPressed(false)\n }\n\n // Applies a hover transition: fires the RN callback, then either swaps\n // the precomputed CSS class directly on the widget (fast path) or forces\n // the ordinary render (slow path) — see the `canSwapHoverClass` block\n // above for which one applies this render.\n const applyHover = (next: boolean, fire: (() => void) | undefined): void => {\n const t0 = perfEnabled ? perfNow() : 0\n hoveredRef.current = next\n fire?.()\n if (!canSwapHoverClass) {\n if (perfEnabled) {\n hoverSignalAt.current = t0\n perfCount(\"pressable.hoverEvent\")\n }\n forceRender()\n return\n }\n const widget = widgetRef.current\n const applyClass = next ? hoverOnClass : hoverOffClass\n const removeClass = next ? hoverOffClass : hoverOnClass\n if (widget && hoverOnClass !== hoverOffClass) {\n if (removeClass) {\n widget.removeCssClass(removeClass)\n }\n if (applyClass) {\n widget.addCssClass(applyClass)\n }\n }\n if (perfEnabled) {\n perfAddTime(\"pressable.hoverApply\", perfNow() - t0)\n perfCount(\"pressable.hoverEvent\")\n perfCount(\"pressable.hoverFast\")\n }\n }\n\n handlersRef.current = {\n handlePressed,\n handleReleased,\n handleCancel,\n handleEnter: () => applyHover(true, onHoverIn),\n handleLeave: () => applyHover(false, onHoverOut),\n }\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const click = new Gtk.GestureClick()\n click.on(\"pressed\", (n: number, x: number, y: number) =>\n handlersRef.current.handlePressed(n, x, y),\n )\n click.on(\"released\", (n: number, x: number, y: number) =>\n handlersRef.current.handleReleased(n, x, y),\n )\n click.on(\"cancel\", () => handlersRef.current.handleCancel())\n widget.addController(click)\n\n const motion = new Gtk.EventControllerMotion()\n motion.on(\"enter\", () => handlersRef.current.handleEnter())\n motion.on(\"leave\", () => handlersRef.current.handleLeave())\n widget.addController(motion)\n\n return () => {\n widget.removeController(click)\n widget.removeController(motion)\n }\n }, [])\n\n return (\n <GtkBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {resolvedChildren}\n </HostNodeContext.Provider>\n </GtkBox>\n )\n}\n\nexport type TouchableOpacityProps = Omit<PressableProps, \"style\"> & {\n style?: StyleProp\n activeOpacity?: number\n}\n\n// Classic RN touchable: dims itself while pressed via widget opacity.\nexport const TouchableOpacity = ({\n style,\n activeOpacity = 0.5,\n ...rest\n}: TouchableOpacityProps) => (\n <Pressable\n {...rest}\n style={({ pressed }) => [style, pressed && { opacity: activeOpacity }]}\n />\n)\n"]}
|
|
1
|
+
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/components/pressable.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EACL,mBAAmB,EACnB,GAAG,EAEH,UAAU,GAEX,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EACL,cAAc,EACd,cAAc,GAEf,MAAM,oBAAoB,CAAA;AA6C3B,MAAM,OAAO,GAAY,EAA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AE;QACnB,cAAc,EAAE,EAAE,CAAA;QAClB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,EACD,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;QACpB,cAAc,EAAE,EAAE,CAAA;QAClB,UAAU,EAAE,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC,EACD,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QACtB,KAAK;QACL,OAAO,IAAI;YACT,eAAe,EAAE,aAAa;YAC9B,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;SACrE;KACF,GACD,CACH,CAAA;AAID;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,CACjE,KAAC,SAAS,OAAK,KAAK,GAAI,CACzB,CAAA","sourcesContent":["import {\n useLayoutEffect,\n useReducer,\n useRef,\n useState,\n type ReactNode,\n} from \"react\"\nimport { splitStyle, StyleSheet } from \"../style/index\"\nimport { defaultCssRegistry } from \"../style/registry.gtkx\"\nimport type { StyleProp } from \"../contracts\"\nimport {\n getViewBoxComponent,\n Gtk,\n GtkBox,\n setHitSlop,\n type HitSlop,\n} from \"../gtkx/bridge/index\"\nimport { perfAddTime, perfCount, perfEnabled, perfNow } from \"../perf\"\nimport { HostNodeContext } from \"./host-node\"\nimport { createPressEvent, createTouch, type PressEvent } from \"./press-event\"\nimport { useActivateOnKey, useFocusable, useFocusController } from \"./use-focus\"\nimport {\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\n// react-native-web's own Pressable state is `{focused, hovered, pressed}`.\n// `hovered` was already a documented extension here for that reason;\n// `focused` is the same move, and it is what lets a row draw the focus ring\n// `outlineWidth`/`outlineColor` made drawable.\nexport type PressableStateCallbackType = {\n pressed: boolean\n hovered: boolean\n focused: boolean\n}\n\nexport type { NativeTouch, PressEvent } from \"./press-event\"\n\nexport type PressableProps = {\n style?: StyleProp | ((state: PressableStateCallbackType) => StyleProp)\n children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode)\n onPress?: (event: PressEvent) => void\n onPressIn?: (event: PressEvent) => void\n onPressOut?: (event: PressEvent) => void\n onLongPress?: (event: PressEvent) => void\n onHoverIn?: () => void\n onHoverOut?: () => void\n onFocus?: () => void\n onBlur?: () => void\n /** Whether Tab and the arrow keys can reach this pressable. Defaults to\n * true when `onPress` is set, which is react-native-web's own rule — a\n * control you can click and cannot reach from the keyboard is an\n * accessibility bug, and on a desktop that matters more, not less. */\n focusable?: boolean\n disabled?: boolean\n delayLongPress?: number\n /** RN's hitSlop: how far OUTSIDE its bounds this pressable still counts\n * as pressed. A number is all four edges. Limited by an ancestor that\n * clips — a ScrollView's viewport, say — because GTK stops picking at\n * the clip, the same constraint RN documents on Android. */\n hitSlop?: number | Partial<HitSlop>\n /** RN's pressRetentionOffset: how far the pointer may drift outside the\n * hit rect after pressing and still activate on release. Defaults to\n * RN's own {top: 20, left: 20, right: 20, bottom: 30}. */\n pressRetentionOffset?: number | Partial<HitSlop>\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst NO_SLOP: HitSlop = { top: 0, right: 0, bottom: 0, left: 0 }\n\n/**\n * RN's own DEFAULT_PRESS_RECT_OFFSETS, from Libraries/Pressability. The\n * bottom edge is deliberately larger: a thumb rolls downwards off a target\n * far more often than upwards.\n */\nconst DEFAULT_PRESS_RECT: HitSlop = { top: 20, right: 20, bottom: 30, left: 20 }\n\nconst toRect = (\n value: number | Partial<HitSlop> | undefined,\n fallback: HitSlop,\n): HitSlop => {\n if (value === undefined) {\n return fallback\n }\n if (typeof value === \"number\") {\n return { top: value, right: value, bottom: value, left: value }\n }\n return {\n top: value.top ?? 0,\n right: value.right ?? 0,\n bottom: value.bottom ?? 0,\n left: value.left ?? 0,\n }\n}\n\n// Coordinates arrive from GtkGestureClick in the widget's own space, which\n// is exactly RN's locationX/locationY; createTouch translates them into the\n// window for pageX/pageY.\nconst pressEvent = (\n widget: Gtk.Widget | null,\n x: number,\n y: number,\n): PressEvent => createPressEvent(createTouch(widget, x, y))\n\n// A View with a click gesture and hover tracking. State-dependent style and\n// children follow the RN Pressable function-prop contract.\nexport const Pressable = ({\n style,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n onHoverIn,\n onHoverOut,\n onFocus,\n onBlur,\n focusable,\n disabled = false,\n delayLongPress = 500,\n hitSlop,\n pressRetentionOffset,\n onLayout,\n testID,\n}: PressableProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const [pressed, setPressed] = useState(false)\n // Focus IS React state, unlike hover: it changes at human-decision rates\n // (a Tab press), not at pointer-motion rates, so the fast path hover needs\n // would be complexity with nothing to buy.\n const [focused, setFocused] = useState(false)\n // Hover is not React state: a boundary crossing should cost what it costs\n // a native GtkListBox row to swap a CSS class, not a setState + render +\n // Yoga + allocate cycle (measured: roughly 500x the latency of a native\n // row at rest, see docs/research/scroll-performance.md, task 007).\n // `hoveredRef` is the single source of truth, read directly at render\n // time — safe here because this component already mutates\n // `handlersRef.current` in the render body below, so render was never\n // React-DOM-pure to begin with. `forceRender` is used only for the two\n // cases that genuinely need a real render: `children` reads `hovered`,\n // or hovering would itself change layout (not just paint).\n const hoveredRef = useRef(false)\n const [, forceRender] = useReducer((n: number) => n + 1, 0)\n const longPressTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const longPressFired = useRef(false)\n // TEMPORARY perf instrumentation (task 007, see\n // docs/research/scroll-performance.md): timestamp the native enter/leave\n // signal so hover's real signal-to-applied latency can be reported —\n // synchronously for the fast path below, after the resulting commit for\n // the slow one. perf.ts hooks are no-ops unless GTKX_PERF=1.\n const hoverSignalAt = useRef<number | null>(null)\n\n const state: PressableStateCallbackType = {\n pressed,\n hovered: hoveredRef.current,\n focused,\n }\n\n // Gestures are attached imperatively even though rc.3 has a declarative\n // `controllers` slot: the controllers are wired exactly once per widget and\n // the handlers read the latest props through a ref, so a re-render never\n // detaches and re-adds a gesture mid-press.\n const handlersRef = useRef({\n handlePressed: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleReleased: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleCancel: (): void => {},\n handleEnter: (): void => {},\n handleLeave: (): void => {},\n })\n const resolvedStyle = typeof style === \"function\" ? style(state) : style\n const resolvedChildren =\n typeof children === \"function\" ? children(state) : children\n\n const { host, node, cssClass, flat } = useLayoutChild(widgetRef, {\n style: resolvedStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n\n // Hover fast path: when `children` does not read state, hovering can\n // never change what is rendered — only `style` might. Precompute the CSS\n // class for the OTHER hover value so the native enter/leave handlers\n // below can swap classes directly on the widget, with no React involved\n // at all. If hovering would also change LAYOUT (rare — every hover style\n // in this codebase's own examples is background/border) that swap is\n // unsafe, since a real reflow is required; fall back to the ordinary\n // render in that case, exactly as before this change.\n let hoverOnClass: string | null = null\n let hoverOffClass: string | null = null\n let canSwapHoverClass = typeof children !== \"function\"\n if (canSwapHoverClass && typeof style === \"function\") {\n const otherState: PressableStateCallbackType = {\n pressed,\n hovered: !hoveredRef.current,\n focused,\n }\n const otherFlat = StyleSheet.flatten(style(otherState))\n const otherSplit = splitStyle(otherFlat)\n const currentLayout = splitStyle(flat).layout\n if (JSON.stringify(currentLayout) !== JSON.stringify(otherSplit.layout)) {\n // Hovering resizes or repositions this widget — a CSS class alone\n // cannot do that, it needs Yoga. Fall back to a real render.\n canSwapHoverClass = false\n } else {\n const otherClass = defaultCssRegistry.getClassName(otherSplit.visual)\n hoverOnClass = hoveredRef.current ? cssClass : otherClass\n hoverOffClass = hoveredRef.current ? otherClass : cssClass\n }\n }\n\n // TEMPORARY perf instrumentation (task 007): runs after every commit, so\n // it always lands right after whatever render the SLOW hover path\n // triggered. A no-op when no hover signal is pending (the common case:\n // renders triggered by anything else, or the fast path above, which\n // measures itself synchronously) or when GTKX_PERF is unset.\n useLayoutEffect(() => {\n if (!perfEnabled || hoverSignalAt.current === null) {\n return\n }\n perfAddTime(\"pressable.hoverApply\", perfNow() - hoverSignalAt.current)\n perfCount(\"pressable.hoverFullCycle\")\n hoverSignalAt.current = null\n })\n\n const clearLongPress = (): void => {\n if (longPressTimer.current !== null) {\n clearTimeout(longPressTimer.current)\n longPressTimer.current = null\n }\n }\n\n const handlePressed = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n longPressFired.current = false\n setPressed(true)\n const widget = widgetRef.current\n onPressIn?.(pressEvent(widget, x, y))\n if (onLongPress) {\n clearLongPress()\n longPressTimer.current = setTimeout(() => {\n longPressFired.current = true\n // Timestamped when it FIRES, not when the press started — the delay\n // is the whole point of the event.\n onLongPress(pressEvent(widgetRef.current, x, y))\n }, delayLongPress)\n }\n }\n\n /**\n * Whether a release at (x, y) — in the widget's own coordinates — still\n * counts as pressing this control. RN's press rect is the hit rect plus\n * pressRetentionOffset, and a release outside it is a cancel, not a\n * press: dragging off a button to change your mind is how every toolkit\n * works, GTK's own GtkButton included. GtkGestureClick keeps an implicit\n * grab for the whole press, so `released` arrives here wherever the\n * pointer ended up and the check has to be ours.\n */\n const withinPressRect = (x: number, y: number): boolean => {\n const widget = widgetRef.current\n if (!widget) {\n return false\n }\n const slop = slopRef.current\n const retention = retentionRef.current\n return (\n x >= -(slop.left + retention.left) &&\n y >= -(slop.top + retention.top) &&\n x < widget.getWidth() + slop.right + retention.right &&\n y < widget.getHeight() + slop.bottom + retention.bottom\n )\n }\n\n const handleReleased = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n clearLongPress()\n setPressed(false)\n const widget = widgetRef.current\n // onPressOut fires either way — RN reports the end of the press whether\n // it turned into an activation or not.\n onPressOut?.(pressEvent(widget, x, y))\n if (!longPressFired.current && withinPressRect(x, y)) {\n onPress?.(pressEvent(widget, x, y))\n }\n }\n\n const handleCancel = (): void => {\n clearLongPress()\n setPressed(false)\n }\n\n // Applies a hover transition: fires the RN callback, then either swaps\n // the precomputed CSS class directly on the widget (fast path) or forces\n // the ordinary render (slow path) — see the `canSwapHoverClass` block\n // above for which one applies this render.\n const applyHover = (next: boolean, fire: (() => void) | undefined): void => {\n const t0 = perfEnabled ? perfNow() : 0\n hoveredRef.current = next\n fire?.()\n if (!canSwapHoverClass) {\n if (perfEnabled) {\n hoverSignalAt.current = t0\n perfCount(\"pressable.hoverEvent\")\n }\n forceRender()\n return\n }\n const widget = widgetRef.current\n const applyClass = next ? hoverOnClass : hoverOffClass\n const removeClass = next ? hoverOffClass : hoverOnClass\n if (widget && hoverOnClass !== hoverOffClass) {\n if (removeClass) {\n widget.removeCssClass(removeClass)\n }\n if (applyClass) {\n widget.addCssClass(applyClass)\n }\n }\n if (perfEnabled) {\n perfAddTime(\"pressable.hoverApply\", perfNow() - t0)\n perfCount(\"pressable.hoverEvent\")\n perfCount(\"pressable.hoverFast\")\n }\n }\n\n handlersRef.current = {\n handlePressed,\n handleReleased,\n handleCancel,\n handleEnter: () => applyHover(true, onHoverIn),\n handleLeave: () => applyHover(false, onHoverOut),\n }\n\n // A pressable that can be clicked should be reachable from the keyboard;\n // one that only hovers or lays out should not join the Tab order. That is\n // react-native-web's rule, and it keeps every existing Pressable in this\n // repo behaving as before unless it had an onPress to begin with.\n useFocusable(widgetRef, focusable ?? onPress !== undefined)\n useFocusController(\n widgetRef,\n () => {\n setFocused(true)\n onFocus?.()\n },\n () => {\n setFocused(false)\n onBlur?.()\n },\n )\n // Enter and Space activate a focused control on web and on Android, so\n // they do here. The press event is synthesised at the widget's own origin\n // — a keyboard press has no coordinates, and RN's own handlers read\n // locationX/Y unconditionally.\n useActivateOnKey(\n widgetRef,\n disabled || !onPress\n ? undefined\n : () => onPress(pressEvent(widgetRef.current, 0, 0)),\n )\n\n // Read from the gesture handlers, which are installed once and must not\n // close over a stale prop.\n const slopRef = useRef(NO_SLOP)\n const retentionRef = useRef(DEFAULT_PRESS_RECT)\n slopRef.current = toRect(hitSlop, NO_SLOP)\n retentionRef.current = toRect(pressRetentionOffset, DEFAULT_PRESS_RECT)\n\n const slop = slopRef.current\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const empty =\n slop.top === 0 && slop.right === 0 && slop.bottom === 0 && slop.left === 0\n setHitSlop(widget, empty ? null : slop)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [slop.top, slop.right, slop.bottom, slop.left])\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const click = new Gtk.GestureClick()\n click.on(\"pressed\", (n: number, x: number, y: number) =>\n handlersRef.current.handlePressed(n, x, y),\n )\n click.on(\"released\", (n: number, x: number, y: number) =>\n handlersRef.current.handleReleased(n, x, y),\n )\n click.on(\"cancel\", () => handlersRef.current.handleCancel())\n widget.addController(click)\n\n // Hover fires from touch as well as from a mouse, and that is left\n // alone deliberately. react-native-web filters it — `useHover` drops\n // any event whose pointerType is \"touch\", because on a phone every tap\n // would otherwise leave a view looking hovered. Three measurements say\n // not to copy it here. GTK gives a crossing event no device at all:\n // inside `enter` and `leave` both `get_current_event()` and\n // `get_current_event_device()` are null, because GTK routes crossings\n // through a path that never sets the controller's current event, so the\n // filter would have to come from somewhere else entirely — a raw event\n // tap on the toplevel recording the last input source, which is\n // per-event JS work on every window for a filter nobody can check.\n // GTK also sends a matching leave when a touch sequence ends, so the\n // stuck phantom hover that motivates RNW's filter does not arise, and\n // GTK's own CSS `:hover` lights up on touch — filtering would make this\n // platform's Pressable behave unlike every widget beside it. And it\n // cannot be verified either way here: there is no way to inject a touch\n // on this rig (docs/research/gestures.md). Revisit with a touchscreen\n // and a reason, not before.\n const motion = new Gtk.EventControllerMotion()\n motion.on(\"enter\", () => handlersRef.current.handleEnter())\n motion.on(\"leave\", () => handlersRef.current.handleLeave())\n widget.addController(motion)\n\n return () => {\n widget.removeController(click)\n widget.removeController(motion)\n }\n }, [])\n\n // The same GtkBox subclass a View renders, for its contains() override:\n // hitSlop is a picking change and nothing in JS can substitute for one,\n // because a press outside the widget is never delivered to it at all.\n const PressableBox = getViewBoxComponent() as typeof GtkBox\n return (\n <PressableBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {resolvedChildren}\n </HostNodeContext.Provider>\n </PressableBox>\n )\n}\n\nexport type TouchableOpacityProps = Omit<PressableProps, \"style\"> & {\n style?: StyleProp\n activeOpacity?: number\n}\n\n// Classic RN touchable: dims itself while pressed via widget opacity.\nexport const TouchableOpacity = ({\n style,\n activeOpacity = 0.5,\n ...rest\n}: TouchableOpacityProps) => (\n <Pressable\n {...rest}\n style={({ pressed }) => [style, pressed && { opacity: activeOpacity }]}\n />\n)\n\nexport type TouchableHighlightProps = Omit<PressableProps, \"style\"> & {\n style?: StyleProp\n /**\n * RN's default is `\"black\"`, and its default `activeOpacity` is `0.85` — the\n * underlay shows through the dimmed child rather than replacing it. Here the\n * underlay IS the background, because there is no separate underlay view to\n * put behind a child that may be opaque, so an app that wants RN's exact\n * blend gives the child a translucent background itself.\n */\n underlayColor?: string\n activeOpacity?: number\n onShowUnderlay?: () => void\n onHideUnderlay?: () => void\n}\n\n/**\n * RN's `TouchableHighlight`: a background colour while held.\n *\n * Here because `@gorhom/bottom-sheet` re-exports it from its own public entry\n * as `BottomSheetTouchable` on every platform except iOS — it is upstream's\n * export, not an app's choice, so an app cannot avoid it. It is also an\n * ordinary `react-native` component that this surface was simply missing.\n *\n * One structural difference, stated rather than papered over: RN renders a\n * separate underlay VIEW behind the child and lowers the child's opacity onto\n * it. Reproducing that needs a second box, and an extra box changes flex\n * layout and what `measureLayout` is relative to — the same reason\n * `GestureDetector` and `createAnimatedComponent` add none. So the highlight\n * is this view's own `backgroundColor` while pressed.\n */\nexport const TouchableHighlight = ({\n style,\n underlayColor = \"black\",\n activeOpacity,\n onShowUnderlay,\n onHideUnderlay,\n onPressIn,\n onPressOut,\n ...rest\n}: TouchableHighlightProps) => (\n <Pressable\n {...rest}\n onPressIn={(event) => {\n onShowUnderlay?.()\n onPressIn?.(event)\n }}\n onPressOut={(event) => {\n onHideUnderlay?.()\n onPressOut?.(event)\n }}\n style={({ pressed }) => [\n style,\n pressed && {\n backgroundColor: underlayColor,\n ...(activeOpacity === undefined ? null : { opacity: activeOpacity }),\n },\n ]}\n />\n)\n\nexport type TouchableWithoutFeedbackProps = PressableProps\n\n/**\n * RN's `TouchableWithoutFeedback`: the press callbacks and nothing visual.\n *\n * RN's own version clones its single child rather than rendering a box, and\n * its documentation calls that a mistake it kept for compatibility. This one\n * renders the `Pressable` box, which is what `Pressable` already is with no\n * `style` callback — the difference is invisible unless the child was relying\n * on being laid out by ITS parent, and RN's own docs tell you to use\n * `Pressable` instead for exactly that reason.\n */\nexport const TouchableWithoutFeedback = (props: PressableProps) => (\n <Pressable {...props} />\n)\n"]}
|
|
@@ -9,10 +9,68 @@ export type StoredOffset = {
|
|
|
9
9
|
dx: number;
|
|
10
10
|
dy: number;
|
|
11
11
|
matrix: Transform2D | null;
|
|
12
|
+
/**
|
|
13
|
+
* The box an animated SIZE is currently driving this child to, or null when
|
|
14
|
+
* nothing is. Composed here rather than written over the committed rect for
|
|
15
|
+
* the reason the `dx`/`dy` above are: the committed rect belongs to the
|
|
16
|
+
* engine and is rewritten by any flush, and an animation must not lose a
|
|
17
|
+
* frame to one that had nothing to do with it.
|
|
18
|
+
*/
|
|
19
|
+
driven: DrivenBox | null;
|
|
12
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* A partial rect: every field the animation is NOT driving stays null and the
|
|
23
|
+
* engine's committed value is used instead.
|
|
24
|
+
*
|
|
25
|
+
* Partial rather than whole so that nothing can go stale. The animated node
|
|
26
|
+
* overrides only the axis being driven — its origin and its other axis keep
|
|
27
|
+
* following the engine, so a window resize mid-animation moves it exactly as
|
|
28
|
+
* it moves everything else. Its descendants override the whole rect, which is
|
|
29
|
+
* safe for the same reason: those are relative to the node, and re-laying its
|
|
30
|
+
* subtree out is precisely what decides them.
|
|
31
|
+
*/
|
|
32
|
+
export type DrivenBox = {
|
|
33
|
+
x: number | null;
|
|
34
|
+
y: number | null;
|
|
35
|
+
width: number | null;
|
|
36
|
+
height: number | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Told when a child's committed rect changes, which is the only moment a
|
|
40
|
+
* layout transition can know it has something to animate: a moved child is
|
|
41
|
+
* exactly a child whose engine rect is not the one it had.
|
|
42
|
+
*
|
|
43
|
+
* A WeakMap plus a counter rather than a Map, because the key is a widget and
|
|
44
|
+
* an observer must never be the reason one stays alive; the counter is what
|
|
45
|
+
* keeps `setStoredRect` free (one integer compare) for the overwhelming
|
|
46
|
+
* majority of children, which have no observer.
|
|
47
|
+
*/
|
|
48
|
+
export type RectObserver = (next: StoredRect, previous: StoredRect | undefined) => void;
|
|
49
|
+
/** Subscribes to `widget`'s committed rect. Returns the unsubscribe. */
|
|
50
|
+
export declare const observeStoredRect: (widget: object, observer: RectObserver) => (() => void);
|
|
13
51
|
export declare const setStoredRect: (widget: object, rect: StoredRect) => void;
|
|
14
52
|
export declare const getStoredRect: (widget: object) => StoredRect | undefined;
|
|
15
53
|
export declare const setStoredOffset: (widget: object, dx: number, dy: number, matrix?: Transform2D | null) => void;
|
|
54
|
+
export declare const setStoredDrivenBox: (widget: object, box: DrivenBox) => void;
|
|
55
|
+
export declare const clearStoredDrivenBox: (widget: object) => void;
|
|
56
|
+
/**
|
|
57
|
+
* The box an animation is currently driving this widget to, if any. Read by
|
|
58
|
+
* the container's own `measure` as well as by its parent's `allocate`, so the
|
|
59
|
+
* widget's size request agrees with the size it is being given.
|
|
60
|
+
*/
|
|
61
|
+
export declare const getStoredDrivenBox: (widget: object) => DrivenBox | undefined;
|
|
62
|
+
export declare const setStoredLayoutOffset: (widget: object, dx: number, dy: number) => void;
|
|
63
|
+
export declare const clearStoredLayoutOffset: (widget: object) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Where a layout transition currently has this child, relative to the rect
|
|
66
|
+
* the engine gave it. Read when a transition is INTERRUPTED by another one:
|
|
67
|
+
* the new run has to start from where the child is being drawn, not from
|
|
68
|
+
* where it was before the first run began.
|
|
69
|
+
*/
|
|
70
|
+
export declare const getStoredLayoutOffset: (widget: object) => {
|
|
71
|
+
dx: number;
|
|
72
|
+
dy: number;
|
|
73
|
+
};
|
|
16
74
|
export declare const getStoredOffset: (widget: object) => StoredOffset;
|
|
17
75
|
/**
|
|
18
76
|
* Stores a child's whole RN `transform` array, split the way the allocate
|