|
@@ -72,7 +72,7 @@ const BottomSheet: FC<IBottomSheetProps> = ({
|
|
|
|
|
|
|
|
const scrollViewRef = useRef<ComponentRef<ScrollView>>(null);
|
|
const scrollViewRef = useRef<ComponentRef<ScrollView>>(null);
|
|
|
|
|
|
|
|
- const animatedTranslateY = useRef(new Animated.Value(0)).current;
|
|
|
|
|
|
|
+ const animatedTranslateY = useRef(new Animated.Value(snapPoint && !isWorkAsFullScreen ? snapPoint : windowHeight)).current;
|
|
|
const animatedHeight = useRef(new Animated.Value(
|
|
const animatedHeight = useRef(new Animated.Value(
|
|
|
isAutoHeight ? 0 : snapPoint ?? 0
|
|
isAutoHeight ? 0 : snapPoint ?? 0
|
|
|
)).current;
|
|
)).current;
|
|
@@ -115,6 +115,7 @@ const BottomSheet: FC<IBottomSheetProps> = ({
|
|
|
}) => {
|
|
}) => {
|
|
|
translateYValue.current = value;
|
|
translateYValue.current = value;
|
|
|
});
|
|
});
|
|
|
|
|
+ openAnimation();
|
|
|
|
|
|
|
|
return () => {
|
|
return () => {
|
|
|
animatedHeight.removeListener(listenerAHeightId);
|
|
animatedHeight.removeListener(listenerAHeightId);
|
|
@@ -122,6 +123,19 @@ const BottomSheet: FC<IBottomSheetProps> = ({
|
|
|
};
|
|
};
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
+ const openAnimation = () => {
|
|
|
|
|
+ Animated.spring(animatedTranslateY, {
|
|
|
|
|
+ useNativeDriver: false,
|
|
|
|
|
+ friction: 10,
|
|
|
|
|
+ tension: 40,
|
|
|
|
|
+ toValue: 0
|
|
|
|
|
+ }).start();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const closeAnimation = () => {
|
|
|
|
|
+
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
const onLayout = (event: LayoutChangeEvent) => {
|
|
const onLayout = (event: LayoutChangeEvent) => {
|
|
|
if (isMeasured) return;
|
|
if (isMeasured) return;
|
|
|
|
|
|