File tree 6 files changed +40
-11
lines changed
6 files changed +40
-11
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @stackflow/plugin-basic-ui " : patch
3
+ " @stackflow/react-ui-core " : patch
4
+ ---
5
+
6
+ fix(plugin-basic-ui,react-ui-core): prevent touch events while transitioning
Original file line number Diff line number Diff line change @@ -115,14 +115,5 @@ export const stackWrapper = recipe({
115
115
android,
116
116
cupertino,
117
117
} ,
118
- globalTransitionState : {
119
- idle : { } ,
120
- loading : {
121
- pointerEvents : "none" ,
122
- } ,
123
- paused : {
124
- pointerEvents : "none" ,
125
- } ,
126
- } ,
127
118
} ,
128
119
} ) ;
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ export const basicUIPlugin: (
61
61
className = { compact ( [
62
62
css . stackWrapper ( {
63
63
theme : initialContext ?. theme ?? _options . theme ,
64
- globalTransitionState : stack . globalTransitionState ,
65
64
} ) ,
66
65
_options . rootClassName ,
67
66
] ) . join ( " " ) }
Original file line number Diff line number Diff line change 1
- import { useActions } from "@stackflow/react" ;
1
+ import { useActions , useStack } from "@stackflow/react" ;
2
2
import {
3
3
useActivityDataAttributes ,
4
4
useLazy ,
5
5
useMounted ,
6
6
useNullableActivity ,
7
+ usePreventTouchDuringTransition ,
7
8
useStyleEffectHide ,
8
9
useStyleEffectOffset ,
9
10
useStyleEffectSwipeBack ,
@@ -194,6 +195,10 @@ const AppScreen: React.FC<AppScreenProps> = ({
194
195
}
195
196
} ;
196
197
198
+ usePreventTouchDuringTransition ( {
199
+ appScreenRef,
200
+ } ) ;
201
+
197
202
return (
198
203
< Context . Provider
199
204
value = { useMemo (
Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ export * from "./useStyleEffectOffset";
8
8
export * from "./useStyleEffectSwipeBack" ;
9
9
export * from "./useZIndexBase" ;
10
10
export * from "./useActivityDataAttributes" ;
11
+ export * from "./usePreventTouchDuringTransition" ;
Original file line number Diff line number Diff line change
1
+ import { useStack } from "@stackflow/react" ;
2
+ import { useEffect } from "react" ;
3
+
4
+ export function usePreventTouchDuringTransition ( {
5
+ appScreenRef,
6
+ } : {
7
+ appScreenRef : React . RefObject < HTMLDivElement > ;
8
+ } ) {
9
+ const { globalTransitionState } = useStack ( ) ;
10
+
11
+ useEffect ( ( ) => {
12
+ const $appScreen = appScreenRef . current ;
13
+ if ( ! $appScreen || globalTransitionState === "idle" ) {
14
+ return ;
15
+ }
16
+
17
+ const onTouchStart = ( e : TouchEvent ) => {
18
+ e . preventDefault ( ) ;
19
+ } ;
20
+
21
+ $appScreen . addEventListener ( "touchstart" , onTouchStart ) ;
22
+
23
+ return ( ) => {
24
+ $appScreen . removeEventListener ( "touchstart" , onTouchStart ) ;
25
+ } ;
26
+ } , [ globalTransitionState ] ) ;
27
+ }
You can’t perform that action at this time.
0 commit comments