@seed-design/stackflow 0.0.35 → 0.0.36
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.
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const reactComposeRefs = require('@radix-ui/react-compose-refs');
|
|
7
8
|
const domUtils = require('@seed-design/dom-utils');
|
|
8
9
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
9
10
|
const React = require('react');
|
|
10
11
|
const useAppScreen = require('./useAppScreen.cjs');
|
|
11
12
|
const useAppScreenContext = require('./useAppScreenContext.cjs');
|
|
13
|
+
const reactUiCore = require('@stackflow/react-ui-core');
|
|
12
14
|
|
|
13
15
|
const AppScreenRoot = React.forwardRef((props, ref) => {
|
|
14
16
|
const {
|
|
@@ -19,6 +21,7 @@ const AppScreenRoot = React.forwardRef((props, ref) => {
|
|
|
19
21
|
onSwipeBackStart,
|
|
20
22
|
...otherProps
|
|
21
23
|
} = props;
|
|
24
|
+
const innerRef = React.useRef(null);
|
|
22
25
|
const api = useAppScreen.useAppScreen({
|
|
23
26
|
swipeBackDisplacementRatioThreshold,
|
|
24
27
|
swipeBackVelocityThreshold,
|
|
@@ -26,10 +29,13 @@ const AppScreenRoot = React.forwardRef((props, ref) => {
|
|
|
26
29
|
onSwipeBackMove,
|
|
27
30
|
onSwipeBackStart
|
|
28
31
|
});
|
|
32
|
+
reactUiCore.usePreventTouchDuringTransition({
|
|
33
|
+
appScreenRef: innerRef
|
|
34
|
+
});
|
|
29
35
|
return /* @__PURE__ */ jsxRuntime.jsx(useAppScreenContext.AppScreenProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
36
|
reactPrimitive.Primitive.div,
|
|
31
37
|
{
|
|
32
|
-
ref,
|
|
38
|
+
ref: reactComposeRefs.composeRefs(innerRef, ref),
|
|
33
39
|
"data-stackflow-component-name": "AppScreen",
|
|
34
40
|
...domUtils.mergeProps(api.activityProps, otherProps)
|
|
35
41
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
3
4
|
import { mergeProps } from '@seed-design/dom-utils';
|
|
4
5
|
import { Primitive } from '@seed-design/react-primitive';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
6
|
+
import { forwardRef, useRef } from 'react';
|
|
6
7
|
import { useAppScreen } from './useAppScreen.js';
|
|
7
8
|
import { useAppScreenContext, AppScreenProvider } from './useAppScreenContext.js';
|
|
9
|
+
import { usePreventTouchDuringTransition } from '@stackflow/react-ui-core';
|
|
8
10
|
|
|
9
11
|
const AppScreenRoot = forwardRef((props, ref) => {
|
|
10
12
|
const {
|
|
@@ -15,6 +17,7 @@ const AppScreenRoot = forwardRef((props, ref) => {
|
|
|
15
17
|
onSwipeBackStart,
|
|
16
18
|
...otherProps
|
|
17
19
|
} = props;
|
|
20
|
+
const innerRef = useRef(null);
|
|
18
21
|
const api = useAppScreen({
|
|
19
22
|
swipeBackDisplacementRatioThreshold,
|
|
20
23
|
swipeBackVelocityThreshold,
|
|
@@ -22,10 +25,13 @@ const AppScreenRoot = forwardRef((props, ref) => {
|
|
|
22
25
|
onSwipeBackMove,
|
|
23
26
|
onSwipeBackStart
|
|
24
27
|
});
|
|
28
|
+
usePreventTouchDuringTransition({
|
|
29
|
+
appScreenRef: innerRef
|
|
30
|
+
});
|
|
25
31
|
return /* @__PURE__ */ jsx(AppScreenProvider, { value: api, children: /* @__PURE__ */ jsx(
|
|
26
32
|
Primitive.div,
|
|
27
33
|
{
|
|
28
|
-
ref,
|
|
34
|
+
ref: composeRefs(innerRef, ref),
|
|
29
35
|
"data-stackflow-component-name": "AppScreen",
|
|
30
36
|
...mergeProps(api.activityProps, otherProps)
|
|
31
37
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
1
2
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
2
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
+
import { forwardRef, useRef } from "react";
|
|
4
5
|
import { useAppScreen, type UseAppScreenProps } from "./useAppScreen";
|
|
5
6
|
import { AppScreenProvider, useAppScreenContext } from "./useAppScreenContext";
|
|
7
|
+
import { usePreventTouchDuringTransition } from "@stackflow/react-ui-core";
|
|
6
8
|
|
|
7
9
|
export interface AppScreenRootProps
|
|
8
10
|
extends PrimitiveProps,
|
|
@@ -18,6 +20,7 @@ export const AppScreenRoot = forwardRef<HTMLDivElement, AppScreenRootProps>((pro
|
|
|
18
20
|
onSwipeBackStart,
|
|
19
21
|
...otherProps
|
|
20
22
|
} = props;
|
|
23
|
+
const innerRef = useRef<HTMLDivElement>(null);
|
|
21
24
|
const api = useAppScreen({
|
|
22
25
|
swipeBackDisplacementRatioThreshold,
|
|
23
26
|
swipeBackVelocityThreshold,
|
|
@@ -25,11 +28,14 @@ export const AppScreenRoot = forwardRef<HTMLDivElement, AppScreenRootProps>((pro
|
|
|
25
28
|
onSwipeBackMove,
|
|
26
29
|
onSwipeBackStart,
|
|
27
30
|
});
|
|
31
|
+
usePreventTouchDuringTransition({
|
|
32
|
+
appScreenRef: innerRef as React.RefObject<HTMLDivElement>,
|
|
33
|
+
});
|
|
28
34
|
|
|
29
35
|
return (
|
|
30
36
|
<AppScreenProvider value={api}>
|
|
31
37
|
<Primitive.div
|
|
32
|
-
ref={ref}
|
|
38
|
+
ref={composeRefs(innerRef, ref)}
|
|
33
39
|
data-stackflow-component-name="AppScreen"
|
|
34
40
|
{...mergeProps(api.activityProps, otherProps)}
|
|
35
41
|
/>
|