panelBase.tsx (4da0658b1bf77de935d6a60ad1a26e4b92d13606) | panelBase.tsx (ab5f994a52bee1ac7c89f2ccf9b6ca60d362890a) |
---|---|
1import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; 2import { 3 BackHandler, 4 DeviceEventEmitter, 5 EmitterSubscription, 6 Keyboard, 7 KeyboardAvoidingView, 8 NativeEventSubscription, --- 41 unchanged lines hidden (view full) --- 50 const snapPoint = useSharedValue(0); 51 52 const colors = useColors(); 53 const [loading, setLoading] = useState(true); // 是否处于弹出状态 54 const timerRef = useRef<any>(); 55 const safeAreaInsets = useSafeAreaInsets(); 56 const orientation = useOrientation(); 57 const useAnimatedBase = useMemo( | 1import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; 2import { 3 BackHandler, 4 DeviceEventEmitter, 5 EmitterSubscription, 6 Keyboard, 7 KeyboardAvoidingView, 8 NativeEventSubscription, --- 41 unchanged lines hidden (view full) --- 50 const snapPoint = useSharedValue(0); 51 52 const colors = useColors(); 53 const [loading, setLoading] = useState(true); // 是否处于弹出状态 54 const timerRef = useRef<any>(); 55 const safeAreaInsets = useSafeAreaInsets(); 56 const orientation = useOrientation(); 57 const useAnimatedBase = useMemo( |
58 () => (orientation === 'horizonal' ? rpx(750) : height), | 58 () => (orientation === 'horizontal' ? rpx(750) : height), |
59 [orientation], 60 ); 61 62 const backHandlerRef = useRef<NativeEventSubscription>(); 63 64 const hideCallbackRef = useRef<Function[]>([]); 65 66 const [keyboardHeight, setKeyboardHeight] = useState(0); | 59 [orientation], 60 ); 61 62 const backHandlerRef = useRef<NativeEventSubscription>(); 63 64 const hideCallbackRef = useRef<Function[]>([]); 65 66 const [keyboardHeight, setKeyboardHeight] = useState(0); |
67 |
|
67 useEffect(() => { 68 snapPoint.value = withTiming(1, timingConfig); 69 70 timerRef.current = setTimeout(() => { 71 if (loading) { 72 // 兜底 73 setLoading(false); 74 } --- 105 unchanged lines hidden (view full) --- 180 181 const panelBody = ( 182 <Animated.View 183 style={[ 184 style.wrapper, 185 { 186 backgroundColor: colors.backdrop, 187 height: | 68 useEffect(() => { 69 snapPoint.value = withTiming(1, timingConfig); 70 71 timerRef.current = setTimeout(() => { 72 if (loading) { 73 // 兜底 74 setLoading(false); 75 } --- 105 unchanged lines hidden (view full) --- 181 182 const panelBody = ( 183 <Animated.View 184 style={[ 185 style.wrapper, 186 { 187 backgroundColor: colors.backdrop, 188 height: |
188 orientation === 'horizonal' | 189 orientation === 'horizontal' |
189 ? vh(100) - safeAreaInsets.top 190 : height - 191 (isFinite(keyboardHeight) ? keyboardHeight : 0), 192 }, 193 panelAnimated, 194 ]}> 195 {renderBody(loading)} 196 </Animated.View> --- 54 unchanged lines hidden --- | 190 ? vh(100) - safeAreaInsets.top 191 : height - 192 (isFinite(keyboardHeight) ? keyboardHeight : 0), 193 }, 194 panelAnimated, 195 ]}> 196 {renderBody(loading)} 197 </Animated.View> --- 54 unchanged lines hidden --- |