@vkontakte/vkui 8.1.1 → 8.1.3
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/dist/components/Flex/FlexItem/FlexItem.d.ts +1 -1
- package/dist/components/Flex/FlexItem/FlexItem.d.ts.map +1 -1
- package/dist/components/Flex/FlexItem/FlexItem.js +39 -8
- package/dist/components/Flex/FlexItem/FlexItem.js.map +1 -1
- package/dist/components/NavTransitionContext/NavTransitionContext.d.ts +2 -1
- package/dist/components/NavTransitionContext/NavTransitionContext.d.ts.map +1 -1
- package/dist/components/NavTransitionContext/NavTransitionContext.js +8 -4
- package/dist/components/NavTransitionContext/NavTransitionContext.js.map +1 -1
- package/dist/components/OnboardingTooltip/OnboardingTooltip.d.ts.map +1 -1
- package/dist/components/OnboardingTooltip/OnboardingTooltip.js +2 -4
- package/dist/components/OnboardingTooltip/OnboardingTooltip.js.map +1 -1
- package/dist/components/Popper/Popper.d.ts.map +1 -1
- package/dist/components/Popper/Popper.js +6 -3
- package/dist/components/Popper/Popper.js.map +1 -1
- package/dist/components/Root/Root.d.ts.map +1 -1
- package/dist/components/Root/Root.js +29 -32
- package/dist/components/Root/Root.js.map +1 -1
- package/dist/components/View/View.d.ts.map +1 -1
- package/dist/components/View/View.js +50 -53
- package/dist/components/View/View.js.map +1 -1
- package/dist/components/View/ViewInfinite.d.ts.map +1 -1
- package/dist/components/View/ViewInfinite.js +34 -37
- package/dist/components/View/ViewInfinite.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/Flex/FlexItem/FlexItem.js +39 -9
- package/dist/cssm/components/Flex/FlexItem/FlexItem.js.map +1 -1
- package/dist/cssm/components/NavTransitionContext/NavTransitionContext.js +8 -4
- package/dist/cssm/components/NavTransitionContext/NavTransitionContext.js.map +1 -1
- package/dist/cssm/components/OnboardingTooltip/OnboardingTooltip.js +2 -4
- package/dist/cssm/components/OnboardingTooltip/OnboardingTooltip.js.map +1 -1
- package/dist/cssm/components/Popper/Popper.js +6 -3
- package/dist/cssm/components/Popper/Popper.js.map +1 -1
- package/dist/cssm/components/Root/Root.js +29 -32
- package/dist/cssm/components/Root/Root.js.map +1 -1
- package/dist/cssm/components/View/View.js +50 -53
- package/dist/cssm/components/View/View.js.map +1 -1
- package/dist/cssm/components/View/ViewInfinite.js +34 -37
- package/dist/cssm/components/View/ViewInfinite.js.map +1 -1
- package/dist/cssm/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js +4 -4
- package/dist/cssm/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js.map +1 -1
- package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.d.ts.map +1 -1
- package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js +4 -4
- package/dist/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.js.map +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/Flex/FlexItem/FlexItem.tsx +38 -11
- package/src/components/NavTransitionContext/NavTransitionContext.tsx +5 -1
- package/src/components/OnboardingTooltip/OnboardingTooltip.tsx +2 -5
- package/src/components/Popper/Popper.tsx +7 -4
- package/src/components/Root/Root.tsx +50 -52
- package/src/components/View/View.tsx +83 -89
- package/src/components/View/ViewInfinite.tsx +65 -69
- package/src/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.ts +4 -5
- package/dist/cssm/components/Flex/FlexItem/FlexItem.module.css +0 -17
- package/dist/cssm/lib/floating/LockFloatingPosition/LockFloatingPosition.js +0 -6
- package/dist/cssm/lib/floating/LockFloatingPosition/LockFloatingPosition.js.map +0 -1
- package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.d.ts +0 -6
- package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.d.ts.map +0 -1
- package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.js +0 -6
- package/dist/lib/floating/LockFloatingPosition/LockFloatingPosition.js.map +0 -1
- package/src/components/Flex/FlexItem/FlexItem.module.css +0 -17
- package/src/components/Flex/FlexItem/FlexItem.module.css.d.ts.map +0 -1
- package/src/lib/floating/LockFloatingPosition/LockFloatingPosition.tsx +0 -6
package/package.json
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
+
import { getRequiredValueByKey } from '../../../helpers/getValueByKey';
|
|
1
2
|
import { type LayoutProps, resolveLayoutProps } from '../../../lib/layouts';
|
|
2
3
|
import { warnOnce } from '../../../lib/warnOnce';
|
|
3
4
|
import { RootComponent } from '../../RootComponent/RootComponent';
|
|
4
5
|
import type { RootComponentProps } from '../../RootComponent/RootComponent';
|
|
5
|
-
import styles from './FlexItem.module.css';
|
|
6
|
-
|
|
7
|
-
const flexClassNames = {
|
|
8
|
-
grow: styles.flexGrow,
|
|
9
|
-
shrink: styles.flexShrink,
|
|
10
|
-
content: styles.flexContent,
|
|
11
|
-
fixed: styles.flexFixed,
|
|
12
|
-
};
|
|
13
6
|
|
|
14
7
|
export type FlexItemProps = RootComponentProps<HTMLElement> &
|
|
15
8
|
Pick<LayoutProps, 'alignSelf' | 'justifySelf' | 'flexBasis'> & {
|
|
@@ -24,14 +17,48 @@ export type FlexItemProps = RootComponentProps<HTMLElement> &
|
|
|
24
17
|
flex?: 'grow' | 'shrink' | 'content' | 'fixed' | undefined;
|
|
25
18
|
};
|
|
26
19
|
|
|
20
|
+
const resolveFlexProps = (flex: FlexItemProps['flex'], flexBasis: FlexItemProps['flexBasis']) => {
|
|
21
|
+
const overrideProps = flexBasis !== undefined ? { flexBasis } : {};
|
|
22
|
+
if (!flex) {
|
|
23
|
+
return overrideProps;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...getRequiredValueByKey<Pick<LayoutProps, 'flexGrow' | 'flexShrink' | 'flexBasis'>>(flex, {
|
|
27
|
+
grow: {
|
|
28
|
+
flexGrow: 1,
|
|
29
|
+
flexShrink: 0,
|
|
30
|
+
flexBasis: 'auto',
|
|
31
|
+
},
|
|
32
|
+
shrink: {
|
|
33
|
+
flexGrow: 0,
|
|
34
|
+
flexShrink: 1,
|
|
35
|
+
flexBasis: 'auto',
|
|
36
|
+
},
|
|
37
|
+
content: {
|
|
38
|
+
flexGrow: 1,
|
|
39
|
+
flexShrink: 1,
|
|
40
|
+
flexBasis: 'auto',
|
|
41
|
+
},
|
|
42
|
+
fixed: {
|
|
43
|
+
flexGrow: 0,
|
|
44
|
+
flexShrink: 0,
|
|
45
|
+
flexBasis: 'auto',
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
...overrideProps,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
27
52
|
const warn = warnOnce('Flex.Item');
|
|
28
53
|
|
|
29
|
-
export const FlexItem = ({ flex, ...restProps }: FlexItemProps): React.ReactNode => {
|
|
54
|
+
export const FlexItem = ({ flex, flexBasis, ...restProps }: FlexItemProps): React.ReactNode => {
|
|
30
55
|
if (process.env.NODE_ENV === 'development') {
|
|
31
56
|
warn('Компонент Flex.Item устарел, используйте компонент Box в качестве альтернативы.');
|
|
32
57
|
}
|
|
33
58
|
|
|
34
|
-
const
|
|
59
|
+
const flexProps = resolveFlexProps(flex, flexBasis);
|
|
60
|
+
|
|
61
|
+
const resolvedProps = resolveLayoutProps({ ...restProps, ...flexProps });
|
|
35
62
|
|
|
36
|
-
return <RootComponent
|
|
63
|
+
return <RootComponent {...resolvedProps} />;
|
|
37
64
|
};
|
|
@@ -5,22 +5,26 @@ import * as React from 'react';
|
|
|
5
5
|
|
|
6
6
|
export interface TransitionContextProps {
|
|
7
7
|
entering: boolean;
|
|
8
|
+
animating: boolean;
|
|
8
9
|
}
|
|
9
10
|
const TransitionContext = React.createContext<TransitionContextProps>({
|
|
10
11
|
entering: false,
|
|
12
|
+
animating: false,
|
|
11
13
|
});
|
|
12
14
|
export const useNavTransition = (): TransitionContextProps => React.useContext(TransitionContext);
|
|
13
15
|
|
|
14
16
|
export const NavTransitionProvider = ({
|
|
15
17
|
children,
|
|
16
18
|
entering,
|
|
19
|
+
animating,
|
|
17
20
|
}: React.PropsWithChildren<TransitionContextProps>): React.ReactNode => {
|
|
18
21
|
const parentContext = useNavTransition();
|
|
19
22
|
const contextValue = React.useMemo(
|
|
20
23
|
() => ({
|
|
21
24
|
entering: parentContext.entering || entering,
|
|
25
|
+
animating: parentContext.animating || animating,
|
|
22
26
|
}),
|
|
23
|
-
[entering, parentContext.entering],
|
|
27
|
+
[entering, animating, parentContext.entering, parentContext.animating],
|
|
24
28
|
);
|
|
25
29
|
|
|
26
30
|
return <TransitionContext.Provider value={contextValue}>{children}</TransitionContext.Provider>;
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
useFloatingMiddlewaresBootstrap,
|
|
16
16
|
usePlacementChangeCallback,
|
|
17
17
|
} from '../../lib/floating';
|
|
18
|
-
import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
|
|
19
18
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
20
19
|
import { warnOnce } from '../../lib/warnOnce';
|
|
21
20
|
import { DEFAULT_ARROW_HEIGHT, DEFAULT_ARROW_PADDING } from '../FloatingArrow/DefaultIcon';
|
|
@@ -118,7 +117,7 @@ export const OnboardingTooltip = ({
|
|
|
118
117
|
}: OnboardingTooltipProps): React.ReactNode => {
|
|
119
118
|
const generatedId = React.useId();
|
|
120
119
|
const tooltipId = idProp || generatedId;
|
|
121
|
-
const { entering } = useNavTransition();
|
|
120
|
+
const { entering, animating } = useNavTransition();
|
|
122
121
|
|
|
123
122
|
const [arrowRef, setArrowRef] = React.useState<HTMLDivElement | null>(null);
|
|
124
123
|
const [tooltipContainer, setTooltipContainer] = React.useState<HTMLElement | null>(null);
|
|
@@ -138,8 +137,6 @@ export const OnboardingTooltip = ({
|
|
|
138
137
|
overflowPadding,
|
|
139
138
|
});
|
|
140
139
|
|
|
141
|
-
const isLock = React.useContext(LockFloatingPositionContext);
|
|
142
|
-
|
|
143
140
|
const {
|
|
144
141
|
x: floatingDataX,
|
|
145
142
|
y: floatingDataY,
|
|
@@ -151,7 +148,7 @@ export const OnboardingTooltip = ({
|
|
|
151
148
|
strategy: positionStrategy,
|
|
152
149
|
...(strictPlacement !== undefined && { placement: strictPlacement }),
|
|
153
150
|
middleware: middlewares,
|
|
154
|
-
...(!
|
|
151
|
+
...(!animating && {
|
|
155
152
|
whileElementsMounted: (...args) =>
|
|
156
153
|
autoUpdateFloatingElement(...args, { elementResize: true }),
|
|
157
154
|
}),
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
usePlacementChangeCallback,
|
|
13
13
|
type VirtualElement,
|
|
14
14
|
} from '../../lib/floating';
|
|
15
|
-
import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
|
|
16
15
|
import { useReferenceHiddenChangeCallback } from '../../lib/floating/useReferenceHiddenChangeCallback';
|
|
17
16
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
18
17
|
import type { HTMLAttributesWithRootRef } from '../../types';
|
|
@@ -26,6 +25,7 @@ import {
|
|
|
26
25
|
FloatingArrow,
|
|
27
26
|
type FloatingArrowProps as FloatingArrowPropsPrivate,
|
|
28
27
|
} from '../FloatingArrow/FloatingArrow';
|
|
28
|
+
import { useNavTransition } from '../NavTransitionContext/NavTransitionContext';
|
|
29
29
|
import { RootComponent } from '../RootComponent/RootComponent';
|
|
30
30
|
import styles from './Popper.module.css';
|
|
31
31
|
|
|
@@ -138,6 +138,7 @@ export const Popper = ({
|
|
|
138
138
|
style,
|
|
139
139
|
...restProps
|
|
140
140
|
}: PopperProps): React.ReactNode => {
|
|
141
|
+
const { entering, animating } = useNavTransition();
|
|
141
142
|
const [arrowRef, setArrowRef] = React.useState<HTMLDivElement | null>(null);
|
|
142
143
|
|
|
143
144
|
const { strictPlacement, middlewares } = useFloatingMiddlewaresBootstrap({
|
|
@@ -157,8 +158,6 @@ export const Popper = ({
|
|
|
157
158
|
overflowPadding,
|
|
158
159
|
});
|
|
159
160
|
|
|
160
|
-
const isLock = React.useContext(LockFloatingPositionContext);
|
|
161
|
-
|
|
162
161
|
const {
|
|
163
162
|
x: floatingDataX,
|
|
164
163
|
y: floatingDataY,
|
|
@@ -170,7 +169,7 @@ export const Popper = ({
|
|
|
170
169
|
...(strictPlacement !== undefined && { placement: strictPlacement }),
|
|
171
170
|
...(strategyProp !== undefined && { strategy: strategyProp }),
|
|
172
171
|
middleware: middlewares,
|
|
173
|
-
...(
|
|
172
|
+
...(animating
|
|
174
173
|
? {}
|
|
175
174
|
: {
|
|
176
175
|
whileElementsMounted: (...args) => {
|
|
@@ -229,5 +228,9 @@ export const Popper = ({
|
|
|
229
228
|
</RootComponent>
|
|
230
229
|
);
|
|
231
230
|
|
|
231
|
+
if (entering) {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
|
|
232
235
|
return <AppRootPortal usePortal={usePortal}>{dropdown}</AppRootPortal>;
|
|
233
236
|
};
|
|
@@ -4,7 +4,6 @@ import * as React from 'react';
|
|
|
4
4
|
import { classNames } from '@vkontakte/vkjs';
|
|
5
5
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
6
6
|
import { useDOM } from '../../lib/dom';
|
|
7
|
-
import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
|
|
8
7
|
import { getNavId, type NavIdProps } from '../../lib/getNavId';
|
|
9
8
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
10
9
|
import { warnOnce } from '../../lib/warnOnce';
|
|
@@ -124,56 +123,55 @@ export const Root = ({
|
|
|
124
123
|
};
|
|
125
124
|
|
|
126
125
|
return (
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</LockFloatingPositionContext.Provider>
|
|
126
|
+
<RootComponent
|
|
127
|
+
{...restProps}
|
|
128
|
+
baseClassName={classNames(
|
|
129
|
+
styles.host,
|
|
130
|
+
platform === 'ios' && styles.ios,
|
|
131
|
+
transition && styles.transition,
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
{views.map((view) => {
|
|
135
|
+
const viewId = getNavId(view.props, warn);
|
|
136
|
+
if (viewId !== activeView && !(transition && viewId === prevView)) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const isTransitionTarget = transition && viewId === (isBack ? prevView : activeView);
|
|
140
|
+
const compensateScroll =
|
|
141
|
+
transition && (viewId === prevView || (isBack && viewId === activeView));
|
|
142
|
+
return (
|
|
143
|
+
<div
|
|
144
|
+
key={viewId}
|
|
145
|
+
ref={(e) => {
|
|
146
|
+
viewId && viewNodes.set(viewId, e);
|
|
147
|
+
}}
|
|
148
|
+
onAnimationEnd={isTransitionTarget ? onAnimationEnd : undefined}
|
|
149
|
+
className={classNames(
|
|
150
|
+
styles.view,
|
|
151
|
+
transition && viewId === prevView && isBack && styles.viewHideBack,
|
|
152
|
+
transition && viewId === prevView && !isBack && styles.viewHideForward,
|
|
153
|
+
transition && viewId === activeView && isBack && styles.viewShowBack,
|
|
154
|
+
transition && viewId === activeView && !isBack && styles.viewShowForward,
|
|
155
|
+
)}
|
|
156
|
+
>
|
|
157
|
+
<NavTransitionDirectionProvider isBack={isBack}>
|
|
158
|
+
<NavTransitionProvider
|
|
159
|
+
entering={transition && viewId === activeView}
|
|
160
|
+
animating={transition}
|
|
161
|
+
>
|
|
162
|
+
<div
|
|
163
|
+
className={styles.scrollCompensation}
|
|
164
|
+
style={{
|
|
165
|
+
marginTop: compensateScroll ? viewId && -(scrolls.get(viewId) ?? 0) : undefined,
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
{view}
|
|
169
|
+
</div>
|
|
170
|
+
</NavTransitionProvider>
|
|
171
|
+
</NavTransitionDirectionProvider>
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
175
|
+
</RootComponent>
|
|
178
176
|
);
|
|
179
177
|
};
|
|
@@ -5,7 +5,6 @@ import { classNames } from '@vkontakte/vkjs';
|
|
|
5
5
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
6
6
|
import { millisecondsInSecond } from '../../lib/date';
|
|
7
7
|
import { blurActiveElement, useDOM } from '../../lib/dom';
|
|
8
|
-
import { LockFloatingPositionContext } from '../../lib/floating/LockFloatingPosition/LockFloatingPosition';
|
|
9
8
|
import { getNavId, type NavIdProps } from '../../lib/getNavId';
|
|
10
9
|
import { warnOnce } from '../../lib/warnOnce';
|
|
11
10
|
import type { HTMLAttributesWithRootRef } from '../../types';
|
|
@@ -457,96 +456,91 @@ export const View = ({
|
|
|
457
456
|
|
|
458
457
|
return (
|
|
459
458
|
<NavViewIdContext.Provider value={id}>
|
|
460
|
-
<
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const marginTop = scrolls.get(panelId);
|
|
500
|
-
if (marginTop !== undefined) {
|
|
501
|
-
scrollCompensateStyle = { marginTop: -1 * marginTop };
|
|
502
|
-
}
|
|
459
|
+
<Touch
|
|
460
|
+
Component="section"
|
|
461
|
+
{...restProps}
|
|
462
|
+
className={classNames(
|
|
463
|
+
styles.host,
|
|
464
|
+
platform === 'ios' && classNames(styles.ios, 'vkuiInternalView--ios'),
|
|
465
|
+
!disableAnimation && animated && styles.animated,
|
|
466
|
+
!disableAnimation && swipingBack && styles.swipingBack,
|
|
467
|
+
disableAnimation && styles.noMotion,
|
|
468
|
+
className,
|
|
469
|
+
)}
|
|
470
|
+
onMoveX={
|
|
471
|
+
iOSSwipeBackSimulationEnabled
|
|
472
|
+
? handleTouchMoveXForIOSSwipeBackSimulation
|
|
473
|
+
: platform === 'ios'
|
|
474
|
+
? handleTouchMoveXForNativeIOSSwipeBackOrSwipeNext
|
|
475
|
+
: undefined
|
|
476
|
+
}
|
|
477
|
+
onEnd={iOSSwipeBackSimulationEnabled ? handleTouchEndForIOSSwipeBackSimulation : undefined}
|
|
478
|
+
>
|
|
479
|
+
<div className={styles.panels}>
|
|
480
|
+
{panels.map((panel) => {
|
|
481
|
+
const panelId = getNavId(panel.props, warn);
|
|
482
|
+
|
|
483
|
+
const isPanelActive = panelId === activePanel;
|
|
484
|
+
const isPanelPrev = panelId === prevPanel;
|
|
485
|
+
const isPanelNext = panelId === nextPanel;
|
|
486
|
+
const isAnimatedTarget = animated && (isBack ? isPanelPrev : isPanelNext);
|
|
487
|
+
|
|
488
|
+
const isSwipeBackPrev = panelId === swipeBackPrevPanel;
|
|
489
|
+
const isSwipeBackNext = panelId === swipeBackNextPanel;
|
|
490
|
+
const isSwipeBackTarget = swipeBackResult && isSwipeBackPrev;
|
|
491
|
+
|
|
492
|
+
let scrollCompensateStyle: React.CSSProperties | undefined = undefined;
|
|
493
|
+
|
|
494
|
+
if (isPanelPrev || (isPanelNext && isBack) || isSwipeBackPrev || isSwipeBackNext) {
|
|
495
|
+
const marginTop = scrolls.get(panelId);
|
|
496
|
+
if (marginTop !== undefined) {
|
|
497
|
+
scrollCompensateStyle = { marginTop: -1 * marginTop };
|
|
503
498
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
<
|
|
536
|
-
<
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
</div>
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return (
|
|
502
|
+
<div
|
|
503
|
+
className={classNames(
|
|
504
|
+
styles.panel,
|
|
505
|
+
|
|
506
|
+
isPanelActive && styles.panelActive,
|
|
507
|
+
isPanelPrev && styles.panelPrev,
|
|
508
|
+
isPanelNext && styles.panelNext,
|
|
509
|
+
|
|
510
|
+
isSwipeBackPrev && styles.panelSwipeBackPrev,
|
|
511
|
+
isSwipeBackNext && styles.panelSwipeBackNext,
|
|
512
|
+
swipeBackResult === 'success' && styles.panelSwipeBackSuccess,
|
|
513
|
+
swipeBackResult === 'fail' && styles.panelSwipeBackFailed,
|
|
514
|
+
)}
|
|
515
|
+
onTransitionEnd={isSwipeBackTarget ? handleSwipeBackTargetTransitionEnd : undefined}
|
|
516
|
+
onAnimationEnd={isAnimatedTarget ? handleAnimatedTargetAnimationEnd : undefined}
|
|
517
|
+
ref={(el) => {
|
|
518
|
+
panelId !== undefined && (panelNodes.current[panelId] = el);
|
|
519
|
+
}}
|
|
520
|
+
style={calcPanelSwipeStyles(isSwipeBackPrev, isSwipeBackNext)}
|
|
521
|
+
key={panelId}
|
|
522
|
+
>
|
|
523
|
+
{platform === 'ios' && (
|
|
524
|
+
<div
|
|
525
|
+
className={styles.panelOverlay}
|
|
526
|
+
style={calcPanelSwipeBackOverlayStyles(isSwipeBackNext)}
|
|
527
|
+
/>
|
|
528
|
+
)}
|
|
529
|
+
<div className={styles.panelIn} style={scrollCompensateStyle}>
|
|
530
|
+
<NavTransitionDirectionProvider isBack={swipingBack || isBack}>
|
|
531
|
+
<NavTransitionProvider
|
|
532
|
+
entering={panelId === nextPanel || panelId === swipeBackNextPanel}
|
|
533
|
+
animating={swipingBack || animated}
|
|
534
|
+
>
|
|
535
|
+
{panel}
|
|
536
|
+
</NavTransitionProvider>
|
|
537
|
+
</NavTransitionDirectionProvider>
|
|
544
538
|
</div>
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
</
|
|
549
|
-
</
|
|
539
|
+
</div>
|
|
540
|
+
);
|
|
541
|
+
})}
|
|
542
|
+
</div>
|
|
543
|
+
</Touch>
|
|
550
544
|
</NavViewIdContext.Provider>
|
|
551
545
|
);
|
|
552
546
|
};
|