@momo-kits/foundation 0.163.1-beta.3 → 0.163.1-sp.2
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/Application/StackScreen.tsx +1 -0
- package/Layout/Screen.tsx +7 -32
- package/package.json +1 -1
package/Layout/Screen.tsx
CHANGED
|
@@ -25,10 +25,7 @@ import {
|
|
|
25
25
|
View,
|
|
26
26
|
ViewProps,
|
|
27
27
|
} from 'react-native';
|
|
28
|
-
import {
|
|
29
|
-
useSharedValue,
|
|
30
|
-
withTiming,
|
|
31
|
-
} from 'react-native-reanimated';
|
|
28
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
32
29
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
33
30
|
import { ApplicationContext, ScreenContext } from '../Context';
|
|
34
31
|
import Navigation from '../Application/Navigation';
|
|
@@ -166,13 +163,6 @@ export interface ScreenProps extends ViewProps {
|
|
|
166
163
|
trackingParams?: ScreenTrackingParams;
|
|
167
164
|
}
|
|
168
165
|
|
|
169
|
-
/**
|
|
170
|
-
* Scroll distance (px) over which the animated search header collapses from its
|
|
171
|
-
* expanded to its docked state — the input range consumed by `HeaderExtendHeader`
|
|
172
|
-
* and the settle threshold in `handleScrollEnd`.
|
|
173
|
-
*/
|
|
174
|
-
const SEARCH_HEADER_COLLAPSE_DISTANCE = 100;
|
|
175
|
-
|
|
176
166
|
const Screen = forwardRef(
|
|
177
167
|
(
|
|
178
168
|
{
|
|
@@ -202,8 +192,8 @@ const Screen = forwardRef(
|
|
|
202
192
|
ref: any,
|
|
203
193
|
) => {
|
|
204
194
|
const screenRef = useRef<View | ScrollView>(null);
|
|
205
|
-
const { width: widthDevice
|
|
206
|
-
const { theme } = useContext(ApplicationContext);
|
|
195
|
+
const { width: widthDevice } = useWindowDimensions();
|
|
196
|
+
const { theme, navigator } = useContext(ApplicationContext);
|
|
207
197
|
const screen: any = useContext(ScreenContext);
|
|
208
198
|
const insets = useSafeAreaInsets();
|
|
209
199
|
const heightHeader = useHeaderHeight();
|
|
@@ -242,7 +232,8 @@ const Screen = forwardRef(
|
|
|
242
232
|
}, [customAnimatedValue, internalShared]);
|
|
243
233
|
|
|
244
234
|
const currentTint = useRef<string | undefined>(undefined);
|
|
245
|
-
|
|
235
|
+
|
|
236
|
+
const isTab = !!screen?.bottomTab;
|
|
246
237
|
|
|
247
238
|
let handleScroll;
|
|
248
239
|
let Component: any = View;
|
|
@@ -657,23 +648,9 @@ const Screen = forwardRef(
|
|
|
657
648
|
onScroll={handleScroll}
|
|
658
649
|
onScrollEndDrag={handleScrollEnd}
|
|
659
650
|
scrollEventThrottle={16}
|
|
660
|
-
style={[
|
|
661
|
-
Styles.flex,
|
|
662
|
-
!scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
663
|
-
]}
|
|
651
|
+
style={[Styles.flex]}
|
|
664
652
|
contentContainerStyle={[
|
|
665
653
|
scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
666
|
-
// The animated search header collapses as the body scrolls. When the
|
|
667
|
-
// body is short (e.g. no search history) the ScrollView is barely
|
|
668
|
-
// scrollable, so overscroll bounce feeds the scroll-driven animation
|
|
669
|
-
// and the input jitters on its way up to the header. A ScrollView
|
|
670
|
-
// frame can never exceed the window, so forcing the content to be at
|
|
671
|
-
// least one screen plus the collapse distance guarantees the animation
|
|
672
|
-
// always has room to complete smoothly, independent of body content.
|
|
673
|
-
scrollable &&
|
|
674
|
-
inputSearchProps && {
|
|
675
|
-
minHeight: heightDevice + SEARCH_HEADER_COLLAPSE_DISTANCE,
|
|
676
|
-
},
|
|
677
654
|
scrollViewProps?.contentContainerStyle,
|
|
678
655
|
]}
|
|
679
656
|
>
|
|
@@ -687,9 +664,7 @@ const Screen = forwardRef(
|
|
|
687
664
|
<FloatingButton
|
|
688
665
|
{...floatingButtonProps}
|
|
689
666
|
animatedValue={sharedValue}
|
|
690
|
-
bottom={
|
|
691
|
-
Footer || isTab ? 12 : bottomInset + Spacing.S
|
|
692
|
-
}
|
|
667
|
+
bottom={Footer || isTab ? 12 : bottomInset + Spacing.S}
|
|
693
668
|
/>
|
|
694
669
|
</View>
|
|
695
670
|
)}
|