@momo-kits/foundation 0.163.1-sp.1 → 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/Layout/Screen.tsx +7 -34
- 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,9 +232,8 @@ const Screen = forwardRef(
|
|
|
242
232
|
}, [customAnimatedValue, internalShared]);
|
|
243
233
|
|
|
244
234
|
const currentTint = useRef<string | undefined>(undefined);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
!!screen?.bottomTab;
|
|
235
|
+
|
|
236
|
+
const isTab = !!screen?.bottomTab;
|
|
248
237
|
|
|
249
238
|
let handleScroll;
|
|
250
239
|
let Component: any = View;
|
|
@@ -659,23 +648,9 @@ const Screen = forwardRef(
|
|
|
659
648
|
onScroll={handleScroll}
|
|
660
649
|
onScrollEndDrag={handleScrollEnd}
|
|
661
650
|
scrollEventThrottle={16}
|
|
662
|
-
style={[
|
|
663
|
-
Styles.flex,
|
|
664
|
-
!scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
665
|
-
]}
|
|
651
|
+
style={[Styles.flex]}
|
|
666
652
|
contentContainerStyle={[
|
|
667
653
|
scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
668
|
-
// The animated search header collapses as the body scrolls. When the
|
|
669
|
-
// body is short (e.g. no search history) the ScrollView is barely
|
|
670
|
-
// scrollable, so overscroll bounce feeds the scroll-driven animation
|
|
671
|
-
// and the input jitters on its way up to the header. A ScrollView
|
|
672
|
-
// frame can never exceed the window, so forcing the content to be at
|
|
673
|
-
// least one screen plus the collapse distance guarantees the animation
|
|
674
|
-
// always has room to complete smoothly, independent of body content.
|
|
675
|
-
scrollable &&
|
|
676
|
-
inputSearchProps && {
|
|
677
|
-
minHeight: heightDevice + SEARCH_HEADER_COLLAPSE_DISTANCE,
|
|
678
|
-
},
|
|
679
654
|
scrollViewProps?.contentContainerStyle,
|
|
680
655
|
]}
|
|
681
656
|
>
|
|
@@ -689,9 +664,7 @@ const Screen = forwardRef(
|
|
|
689
664
|
<FloatingButton
|
|
690
665
|
{...floatingButtonProps}
|
|
691
666
|
animatedValue={sharedValue}
|
|
692
|
-
bottom={
|
|
693
|
-
Footer || isTab ? 12 : bottomInset + Spacing.S
|
|
694
|
-
}
|
|
667
|
+
bottom={Footer || isTab ? 12 : bottomInset + Spacing.S}
|
|
695
668
|
/>
|
|
696
669
|
</View>
|
|
697
670
|
)}
|