From 764c7cd5694a41c98d8543b68d7791fa90db4291 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 5 Sep 2023 10:42:19 -0700 Subject: Updates to use dynamic/responsive styles on web (#1351) * Move most responsive queries to the hook * Fix invalid CSS value * Fixes to tablet render of post thread * Fix overflow issues on web * Fix search header on tablet * Fix QP margin in web composer * Fix: only apply double gutter once to flatlist (close #1368) * Fix styles on discover feeds header * Fix double discover links in multifeed --- src/view/com/composer/Composer.tsx | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/view/com/composer/Composer.tsx') diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index c801c47bf..8ed0bb378 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -37,9 +37,10 @@ import {toShortUrl} from 'lib/strings/url-helpers' import {SelectPhotoBtn} from './photos/SelectPhotoBtn' import {OpenCameraBtn} from './photos/OpenCameraBtn' import {usePalette} from 'lib/hooks/usePalette' -import QuoteEmbed from '../util/post-embeds/QuoteEmbed' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useExternalLinkFetch} from './useExternalLinkFetch' -import {isDesktopWeb, isAndroid, isIOS} from 'platform/detection' +import {isWeb, isNative, isAndroid, isIOS} from 'platform/detection' +import QuoteEmbed from '../util/post-embeds/QuoteEmbed' import {GalleryModel} from 'state/models/media/gallery' import {Gallery} from './photos/Gallery' import {MAX_GRAPHEME_LENGTH} from 'lib/constants' @@ -61,6 +62,7 @@ export const ComposePost = observer(function ComposePost({ }: Props) { const {track} = useAnalytics() const pal = usePalette('default') + const {isDesktop, isMobile} = useWebMediaQueries() const store = useStores() const textInput = useRef(null) const [isKeyboardVisible] = useIsKeyboardVisible({iosUseWillEvents: true}) @@ -99,9 +101,9 @@ export const ComposePost = observer(function ComposePost({ () => ({ paddingBottom: isAndroid || (isIOS && !isKeyboardVisible) ? insets.bottom : 0, - paddingTop: isAndroid ? insets.top : isDesktopWeb ? 0 : 15, + paddingTop: isAndroid ? insets.top : isMobile ? 15 : 0, }), - [insets, isKeyboardVisible], + [insets, isKeyboardVisible, isMobile], ) const onPressCancel = useCallback(() => { @@ -143,7 +145,7 @@ export const ComposePost = observer(function ComposePost({ [onPressCancel], ) useEffect(() => { - if (isDesktopWeb) { + if (isWeb) { window.addEventListener('keydown', onEscape) return () => window.removeEventListener('keydown', onEscape) } @@ -240,7 +242,7 @@ export const ComposePost = observer(function ComposePost({ behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={styles.outer}> - + ) : undefined} - + )} {quote ? ( - + ) : undefined} @@ -395,7 +402,7 @@ export const ComposePost = observer(function ComposePost({ ) : null} - {isDesktopWeb ? : null} + {isDesktop ? : null} @@ -414,11 +421,14 @@ const styles = StyleSheet.create({ topbar: { flexDirection: 'row', alignItems: 'center', - paddingTop: isDesktopWeb ? 10 : undefined, - paddingBottom: isDesktopWeb ? 10 : 4, + paddingBottom: 4, paddingHorizontal: 20, height: 55, }, + topbarDesktop: { + paddingTop: 10, + paddingBottom: 10, + }, postBtn: { borderRadius: 20, paddingHorizontal: 20, @@ -465,11 +475,13 @@ const styles = StyleSheet.create({ paddingHorizontal: 15, }, textInputLayout: { - flex: isDesktopWeb ? undefined : 1, flexDirection: 'row', borderTopWidth: 1, paddingTop: 16, }, + textInputLayoutMobile: { + flex: 1, + }, replyToLayout: { flexDirection: 'row', borderTopWidth: 1, -- cgit 1.4.1