diff --git a/src/usecase/settings/ConnectionSettings.tsx b/src/usecase/settings/ConnectionSettings.tsx index 7572af6..63169b1 100644 --- a/src/usecase/settings/ConnectionSettings.tsx +++ b/src/usecase/settings/ConnectionSettings.tsx @@ -103,7 +103,7 @@ class ConnectionSettings extends React.PureComponent { return ( - + WeechatRN is a relay client for the WeeChat IRC client. WeechatRN supports the WebSocket connection method only. Configure your relay diff --git a/src/usecase/settings/UploadSettings.tsx b/src/usecase/settings/UploadSettings.tsx index b7a7fcd..8486fec 100644 --- a/src/usecase/settings/UploadSettings.tsx +++ b/src/usecase/settings/UploadSettings.tsx @@ -1,4 +1,3 @@ -import { useHeaderHeight } from '@react-navigation/elements'; import type { NativeStackScreenProps } from '@react-navigation/native-stack'; import { memo, useCallback, useEffect, useReducer, useRef } from 'react'; import { @@ -29,7 +28,6 @@ const mergeState = (oldState: T, newState: Partial): T => ({ const UploadSettings: React.FC = ({ navigation }) => { const dispatch = useAppDispatch(); - const headerHeight = useHeaderHeight(); const uploadOptions = useAppSelector( (state) => state.connection.mediaUploadOptions @@ -91,12 +89,9 @@ const UploadSettings: React.FC = ({ navigation }) => { return ( - + - + Use the form below to configure media upload settings. This allows for uploading media to hosting provider and will automatically paste diff --git a/src/usecase/shared/KeyboardAvoidingView.tsx b/src/usecase/shared/KeyboardAvoidingView.tsx index 93c5211..e90a136 100644 --- a/src/usecase/shared/KeyboardAvoidingView.tsx +++ b/src/usecase/shared/KeyboardAvoidingView.tsx @@ -1,62 +1,28 @@ -import { useCallback } from 'react'; -import type { LayoutChangeEvent, LayoutRectangle } from 'react-native'; -import { Platform, useWindowDimensions, type ViewStyle } from 'react-native'; +import { type ViewStyle } from 'react-native'; import Animated, { KeyboardState, - runOnUI, useAnimatedKeyboard, - useAnimatedStyle, - useSharedValue + useAnimatedStyle } from 'react-native-reanimated'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; interface Props { style?: ViewStyle; behavior?: string; - keyboardVerticalOffset?: number; } export const KeyboardAvoidingView: React.FC> = ({ children, style, - behavior, - keyboardVerticalOffset = 0 + behavior }) => { const keyboard = useAnimatedKeyboard({ isStatusBarTranslucentAndroid: true }); - const currentFrame = useSharedValue(null); - const { height: screenHeight } = useWindowDimensions(); const safeAreaInsets = useSafeAreaInsets(); - const topInset = Platform.OS === 'android' ? safeAreaInsets.top : 0; - - const setCurrentFrame = useCallback( - (layout: LayoutRectangle) => { - 'worklet'; - currentFrame.value = layout; - }, - [currentFrame] - ); - - const onLayout = useCallback( - (event: LayoutChangeEvent) => { - runOnUI(setCurrentFrame)(event.nativeEvent.layout); - }, - [setCurrentFrame] - ); const animatedStyles = useAnimatedStyle(() => { - if (!currentFrame.value) return {}; - - const offset = Math.max( - currentFrame.value.y + - currentFrame.value.height - - (screenHeight + - topInset - - keyboard.height.value - - keyboardVerticalOffset), - 0 - ); + const offset = Math.max(keyboard.height.value - safeAreaInsets.bottom, 0); if (behavior === 'padding') { return { paddingBottom: offset }; @@ -71,8 +37,6 @@ export const KeyboardAvoidingView: React.FC> = ({ }); return ( - - {children} - + {children} ); };