mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve Device Detection For Better Responsiveness (#1512)

* Refactor `useOnMainScroll` function to use responsive device detection

- Replace static `isDesktopWeb` with `useWebMediaQueries` hook to enable dynamic device type detection.
- Create `useDeviceLimits` hook to dynamically determine `DY_LIMIT_UP` and `DY_LIMIT_DOWN` based on device type.
- Update dependency arrays for the `useCallback` hooks to include new dynamic variables.

* Refactor styles to be responsive to device type

- Create `useStyles` hook that generates styles object based on device type detected from `useWebMediaQueries`.
- Replace static styles object with dynamic styles object generated from `useStyles` hook in components.
- This allows `paddingLeft` values for 'ul' and 'ol' styles to adapt to device type dynamically.
- This allows `maxWidth` values for 'metaItem'' styles to adapt to device type dynamically.

* Remove `isDesktopWeb` in favor of `useWebMediaQueries().isDesktop`

* Refactor `SplashScreen` component for responsive design

* Revision based on review results

* Fix isNative check

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>

authored by

Bryan Lee
Paul Frazee
and committed by
GitHub
2aae37d6 2e5f73ff

+289 -244
+14 -10
src/lib/hooks/useOnMainScroll.ts
··· 2 2 import {NativeSyntheticEvent, NativeScrollEvent} from 'react-native' 3 3 import {RootStoreModel} from 'state/index' 4 4 import {s} from 'lib/styles' 5 - import {isDesktopWeb} from 'platform/detection' 5 + import {useWebMediaQueries} from './useWebMediaQueries' 6 6 7 - const DY_LIMIT_UP = isDesktopWeb ? 30 : 10 8 - const DY_LIMIT_DOWN = isDesktopWeb ? 150 : 10 9 7 const Y_LIMIT = 10 8 + 9 + const useDeviceLimits = () => { 10 + const {isDesktop} = useWebMediaQueries() 11 + return { 12 + dyLimitUp: isDesktop ? 30 : 10, 13 + dyLimitDown: isDesktop ? 150 : 10, 14 + } 15 + } 10 16 11 17 export type OnScrollCb = ( 12 18 event: NativeSyntheticEvent<NativeScrollEvent>, ··· 18 24 ): [OnScrollCb, boolean, ResetCb] { 19 25 let lastY = useRef(0) 20 26 let [isScrolledDown, setIsScrolledDown] = useState(false) 27 + const {dyLimitUp, dyLimitDown} = useDeviceLimits() 28 + 21 29 return [ 22 30 useCallback( 23 31 (event: NativeSyntheticEvent<NativeScrollEvent>) => { ··· 25 33 const dy = y - (lastY.current || 0) 26 34 lastY.current = y 27 35 28 - if ( 29 - !store.shell.minimalShellMode && 30 - dy > DY_LIMIT_DOWN && 31 - y > Y_LIMIT 32 - ) { 36 + if (!store.shell.minimalShellMode && dy > dyLimitDown && y > Y_LIMIT) { 33 37 store.shell.setMinimalShellMode(true) 34 38 } else if ( 35 39 store.shell.minimalShellMode && 36 - (dy < DY_LIMIT_UP * -1 || y <= Y_LIMIT) 40 + (dy < dyLimitUp * -1 || y <= Y_LIMIT) 37 41 ) { 38 42 store.shell.setMinimalShellMode(false) 39 43 } ··· 50 54 setIsScrolledDown(false) 51 55 } 52 56 }, 53 - [store, isScrolledDown], 57 + [store.shell, dyLimitDown, dyLimitUp, isScrolledDown], 54 58 ), 55 59 isScrolledDown, 56 60 useCallback(() => {
-1
src/platform/detection.ts
··· 12 12 isWeb && 13 13 // @ts-ignore we know window exists -prf 14 14 global.window.matchMedia(isMobileWebMediaQuery)?.matches 15 - export const isDesktopWeb = isWeb && !isMobileWeb 16 15 17 16 export const deviceLocales = dedupArray( 18 17 getLocales?.().map?.(locale => locale.languageCode),
+86 -78
src/view/com/auth/SplashScreen.web.tsx
··· 6 6 import {s, colors} from 'lib/styles' 7 7 import {usePalette} from 'lib/hooks/usePalette' 8 8 import {CenteredView} from '../util/Views' 9 - import {isMobileWeb} from 'platform/detection' 9 + import {isWeb} from 'platform/detection' 10 + import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 10 11 11 12 export const SplashScreen = ({ 12 13 onPressSignin, ··· 16 17 onPressCreateAccount: () => void 17 18 }) => { 18 19 const pal = usePalette('default') 20 + const {isTabletOrMobile} = useWebMediaQueries() 21 + const styles = useStyles() 22 + const isMobileWeb = isWeb && isTabletOrMobile 19 23 20 24 return ( 21 25 <CenteredView style={[styles.container, pal.view]}> ··· 55 59 </View> 56 60 </ErrorBoundary> 57 61 </View> 58 - <Footer /> 62 + <Footer styles={styles} /> 59 63 </CenteredView> 60 64 ) 61 65 } 62 66 63 - function Footer() { 67 + function Footer({styles}: {styles: ReturnType<typeof useStyles>}) { 64 68 const pal = usePalette('default') 69 + 65 70 return ( 66 71 <View style={[styles.footer, pal.view, pal.border]}> 67 72 <TextLink ··· 82 87 </View> 83 88 ) 84 89 } 85 - 86 - const styles = StyleSheet.create({ 87 - container: { 88 - height: '100%', 89 - }, 90 - containerInner: { 91 - height: '100%', 92 - justifyContent: 'center', 93 - // @ts-ignore web only 94 - paddingBottom: '20vh', 95 - paddingHorizontal: 20, 96 - }, 97 - containerInnerMobile: { 98 - paddingBottom: 50, 99 - }, 100 - title: { 101 - textAlign: 'center', 102 - color: colors.blue3, 103 - fontSize: 68, 104 - fontWeight: 'bold', 105 - paddingBottom: 10, 106 - }, 107 - titleMobile: { 108 - textAlign: 'center', 109 - color: colors.blue3, 110 - fontSize: 58, 111 - fontWeight: 'bold', 112 - }, 113 - subtitle: { 114 - textAlign: 'center', 115 - color: colors.gray5, 116 - fontSize: 52, 117 - fontWeight: 'bold', 118 - paddingBottom: 30, 119 - }, 120 - subtitleMobile: { 121 - textAlign: 'center', 122 - color: colors.gray5, 123 - fontSize: 42, 124 - fontWeight: 'bold', 125 - paddingBottom: 30, 126 - }, 127 - btns: { 128 - flexDirection: isMobileWeb ? 'column' : 'row', 129 - gap: 20, 130 - justifyContent: 'center', 131 - paddingBottom: 40, 132 - }, 133 - btn: { 134 - borderRadius: 30, 135 - paddingHorizontal: 24, 136 - paddingVertical: 12, 137 - minWidth: 220, 138 - }, 139 - btnLabel: { 140 - textAlign: 'center', 141 - fontSize: 18, 142 - }, 143 - notice: { 144 - paddingHorizontal: 40, 145 - textAlign: 'center', 146 - }, 147 - footer: { 148 - position: 'absolute', 149 - left: 0, 150 - right: 0, 151 - bottom: 0, 152 - padding: 20, 153 - borderTopWidth: 1, 154 - flexDirection: 'row', 155 - }, 156 - footerLink: { 157 - marginRight: 20, 158 - }, 159 - }) 90 + const useStyles = () => { 91 + const {isTabletOrMobile} = useWebMediaQueries() 92 + const isMobileWeb = isWeb && isTabletOrMobile 93 + return StyleSheet.create({ 94 + container: { 95 + height: '100%', 96 + }, 97 + containerInner: { 98 + height: '100%', 99 + justifyContent: 'center', 100 + // @ts-ignore web only 101 + paddingBottom: '20vh', 102 + paddingHorizontal: 20, 103 + }, 104 + containerInnerMobile: { 105 + paddingBottom: 50, 106 + }, 107 + title: { 108 + textAlign: 'center', 109 + color: colors.blue3, 110 + fontSize: 68, 111 + fontWeight: 'bold', 112 + paddingBottom: 10, 113 + }, 114 + titleMobile: { 115 + textAlign: 'center', 116 + color: colors.blue3, 117 + fontSize: 58, 118 + fontWeight: 'bold', 119 + }, 120 + subtitle: { 121 + textAlign: 'center', 122 + color: colors.gray5, 123 + fontSize: 52, 124 + fontWeight: 'bold', 125 + paddingBottom: 30, 126 + }, 127 + subtitleMobile: { 128 + textAlign: 'center', 129 + color: colors.gray5, 130 + fontSize: 42, 131 + fontWeight: 'bold', 132 + paddingBottom: 30, 133 + }, 134 + btns: { 135 + flexDirection: isMobileWeb ? 'column' : 'row', 136 + gap: 20, 137 + justifyContent: 'center', 138 + paddingBottom: 40, 139 + }, 140 + btn: { 141 + borderRadius: 30, 142 + paddingHorizontal: 24, 143 + paddingVertical: 12, 144 + minWidth: 220, 145 + }, 146 + btnLabel: { 147 + textAlign: 'center', 148 + fontSize: 18, 149 + }, 150 + notice: { 151 + paddingHorizontal: 40, 152 + textAlign: 'center', 153 + }, 154 + footer: { 155 + position: 'absolute', 156 + left: 0, 157 + right: 0, 158 + bottom: 0, 159 + padding: 20, 160 + borderTopWidth: 1, 161 + flexDirection: 'row', 162 + }, 163 + footerLink: { 164 + marginRight: 20, 165 + }, 166 + }) 167 + }
+3 -2
src/view/com/composer/photos/OpenCameraBtn.tsx
··· 7 7 import {usePalette} from 'lib/hooks/usePalette' 8 8 import {useAnalytics} from 'lib/analytics/analytics' 9 9 import {useStores} from 'state/index' 10 - import {isDesktopWeb} from 'platform/detection' 11 10 import {openCamera} from 'lib/media/picker' 12 11 import {useCameraPermission} from 'lib/hooks/usePermissions' 13 12 import {HITSLOP_10, POST_IMG_MAX} from 'lib/constants' 14 13 import {GalleryModel} from 'state/models/media/gallery' 14 + import {isMobileWeb, isNative} from 'platform/detection' 15 15 16 16 type Props = { 17 17 gallery: GalleryModel ··· 43 43 } 44 44 }, [gallery, track, store, requestCameraAccessIfNeeded]) 45 45 46 - if (isDesktopWeb) { 46 + const shouldShowCameraButton = isNative || isMobileWeb 47 + if (!shouldShowCameraButton) { 47 48 return null 48 49 } 49 50
+3 -3
src/view/com/composer/photos/SelectPhotoBtn.tsx
··· 6 6 } from '@fortawesome/react-native-fontawesome' 7 7 import {usePalette} from 'lib/hooks/usePalette' 8 8 import {useAnalytics} from 'lib/analytics/analytics' 9 - import {isDesktopWeb} from 'platform/detection' 10 9 import {usePhotoLibraryPermission} from 'lib/hooks/usePermissions' 11 10 import {GalleryModel} from 'state/models/media/gallery' 12 11 import {HITSLOP_10} from 'lib/constants' 12 + import {isNative} from 'platform/detection' 13 13 14 14 type Props = { 15 15 gallery: GalleryModel ··· 23 23 const onPressSelectPhotos = useCallback(async () => { 24 24 track('Composer:GalleryOpened') 25 25 26 - if (!isDesktopWeb && !(await requestPhotoAccessIfNeeded())) { 26 + if (isNative && !(await requestPhotoAccessIfNeeded())) { 27 27 return 28 28 } 29 29 30 30 gallery.pick() 31 - }, [track, gallery, requestPhotoAccessIfNeeded]) 31 + }, [track, requestPhotoAccessIfNeeded, gallery]) 32 32 33 33 return ( 34 34 <TouchableOpacity
+17 -4
src/view/com/post-thread/PostThread.tsx
··· 23 23 import {ErrorMessage} from '../util/error/ErrorMessage' 24 24 import {Text} from '../util/text/Text' 25 25 import {s} from 'lib/styles' 26 - import {isNative, isDesktopWeb} from 'platform/detection' 26 + import {isNative} from 'platform/detection' 27 27 import {usePalette} from 'lib/hooks/usePalette' 28 28 import {useSetTitle} from 'lib/hooks/useSetTitle' 29 29 import {useNavigation} from '@react-navigation/native' ··· 78 78 treeView: boolean 79 79 }) { 80 80 const pal = usePalette('default') 81 - const {isTablet} = useWebMediaQueries() 81 + const {isTablet, isDesktop} = useWebMediaQueries() 82 82 const ref = useRef<FlatList>(null) 83 83 const hasScrolledIntoView = useRef<boolean>(false) 84 84 const [isRefreshing, setIsRefreshing] = React.useState(false) ··· 189 189 } else if (item === REPLY_PROMPT) { 190 190 return ( 191 191 <View> 192 - {isDesktopWeb && <ComposePrompt onPressCompose={onPressReply} />} 192 + {isDesktop && <ComposePrompt onPressCompose={onPressReply} />} 193 193 </View> 194 194 ) 195 195 } else if (item === DELETED) { ··· 261 261 } 262 262 return <></> 263 263 }, 264 - [onRefresh, onPressReply, pal, posts, isTablet, treeView], 264 + [ 265 + isTablet, 266 + isDesktop, 267 + onPressReply, 268 + pal.border, 269 + pal.viewLight, 270 + pal.textLight, 271 + pal.view, 272 + pal.text, 273 + pal.colors.border, 274 + posts, 275 + onRefresh, 276 + treeView, 277 + ], 265 278 ) 266 279 267 280 // loading
+92 -88
src/view/com/post-thread/PostThreadItem.tsx
··· 34 34 import {formatCount} from '../util/numeric/format' 35 35 import {TimeElapsed} from 'view/com/util/TimeElapsed' 36 36 import {makeProfileLink} from 'lib/routes/links' 37 - import {isDesktopWeb} from 'platform/detection' 38 37 import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 39 38 40 39 export const PostThreadItem = observer(function PostThreadItem({ ··· 51 50 const pal = usePalette('default') 52 51 const store = useStores() 53 52 const [deleted, setDeleted] = React.useState(false) 53 + const styles = useStyles() 54 54 const record = item.postRecord 55 55 const hasEngagement = item.post.likeCount || item.post.repostCount 56 56 ··· 568 568 }>) { 569 569 const {isMobile} = useWebMediaQueries() 570 570 const pal = usePalette('default') 571 + const styles = useStyles() 571 572 if (treeView && item._depth > 1) { 572 573 return ( 573 574 <View ··· 636 637 ) 637 638 } 638 639 639 - const styles = StyleSheet.create({ 640 - outer: { 641 - borderTopWidth: 1, 642 - paddingLeft: 8, 643 - }, 644 - outerHighlighted: { 645 - paddingTop: 16, 646 - paddingLeft: 8, 647 - paddingRight: 8, 648 - }, 649 - noTopBorder: { 650 - borderTopWidth: 0, 651 - }, 652 - layout: { 653 - flexDirection: 'row', 654 - gap: 10, 655 - paddingLeft: 8, 656 - }, 657 - layoutAvi: {}, 658 - layoutContent: { 659 - flex: 1, 660 - paddingRight: 10, 661 - }, 662 - meta: { 663 - flexDirection: 'row', 664 - paddingTop: 2, 665 - paddingBottom: 2, 666 - }, 667 - metaExpandedLine1: { 668 - paddingTop: 5, 669 - paddingBottom: 0, 670 - }, 671 - metaItem: { 672 - paddingRight: 5, 673 - maxWidth: isDesktopWeb ? 380 : 220, 674 - }, 675 - alert: { 676 - marginBottom: 6, 677 - }, 678 - postTextContainer: { 679 - flexDirection: 'row', 680 - alignItems: 'center', 681 - flexWrap: 'wrap', 682 - paddingBottom: 4, 683 - paddingRight: 10, 684 - }, 685 - postTextLargeContainer: { 686 - paddingHorizontal: 0, 687 - paddingBottom: 10, 688 - }, 689 - translateLink: { 690 - marginBottom: 6, 691 - }, 692 - contentHider: { 693 - marginBottom: 6, 694 - }, 695 - contentHiderChild: { 696 - marginTop: 6, 697 - }, 698 - expandedInfo: { 699 - flexDirection: 'row', 700 - padding: 10, 701 - borderTopWidth: 1, 702 - borderBottomWidth: 1, 703 - marginTop: 5, 704 - marginBottom: 15, 705 - }, 706 - expandedInfoItem: { 707 - marginRight: 10, 708 - }, 709 - loadMore: { 710 - flexDirection: 'row', 711 - alignItems: 'center', 712 - justifyContent: 'flex-start', 713 - gap: 4, 714 - paddingHorizontal: 20, 715 - }, 716 - replyLine: { 717 - width: 2, 718 - marginLeft: 'auto', 719 - marginRight: 'auto', 720 - }, 721 - cursor: { 722 - // @ts-ignore web only 723 - cursor: 'pointer', 724 - }, 725 - }) 640 + const useStyles = () => { 641 + const {isDesktop} = useWebMediaQueries() 642 + return StyleSheet.create({ 643 + outer: { 644 + borderTopWidth: 1, 645 + paddingLeft: 8, 646 + }, 647 + outerHighlighted: { 648 + paddingTop: 16, 649 + paddingLeft: 8, 650 + paddingRight: 8, 651 + }, 652 + noTopBorder: { 653 + borderTopWidth: 0, 654 + }, 655 + layout: { 656 + flexDirection: 'row', 657 + gap: 10, 658 + paddingLeft: 8, 659 + }, 660 + layoutAvi: {}, 661 + layoutContent: { 662 + flex: 1, 663 + paddingRight: 10, 664 + }, 665 + meta: { 666 + flexDirection: 'row', 667 + paddingTop: 2, 668 + paddingBottom: 2, 669 + }, 670 + metaExpandedLine1: { 671 + paddingTop: 5, 672 + paddingBottom: 0, 673 + }, 674 + metaItem: { 675 + paddingRight: 5, 676 + maxWidth: isDesktop ? 380 : 220, 677 + }, 678 + alert: { 679 + marginBottom: 6, 680 + }, 681 + postTextContainer: { 682 + flexDirection: 'row', 683 + alignItems: 'center', 684 + flexWrap: 'wrap', 685 + paddingBottom: 4, 686 + paddingRight: 10, 687 + }, 688 + postTextLargeContainer: { 689 + paddingHorizontal: 0, 690 + paddingBottom: 10, 691 + }, 692 + translateLink: { 693 + marginBottom: 6, 694 + }, 695 + contentHider: { 696 + marginBottom: 6, 697 + }, 698 + contentHiderChild: { 699 + marginTop: 6, 700 + }, 701 + expandedInfo: { 702 + flexDirection: 'row', 703 + padding: 10, 704 + borderTopWidth: 1, 705 + borderBottomWidth: 1, 706 + marginTop: 5, 707 + marginBottom: 15, 708 + }, 709 + expandedInfoItem: { 710 + marginRight: 10, 711 + }, 712 + loadMore: { 713 + flexDirection: 'row', 714 + alignItems: 'center', 715 + justifyContent: 'flex-start', 716 + gap: 4, 717 + paddingHorizontal: 20, 718 + }, 719 + replyLine: { 720 + width: 2, 721 + marginLeft: 'auto', 722 + marginRight: 'auto', 723 + }, 724 + cursor: { 725 + // @ts-ignore web only 726 + cursor: 'pointer', 727 + }, 728 + }) 729 + }
+69 -56
src/view/com/util/Html.tsx
··· 4 4 import {useTheme} from 'lib/ThemeContext' 5 5 import {Text} from './text/Text' 6 6 import {TextLink} from './Link' 7 - import {isDesktopWeb} from 'platform/detection' 8 7 import { 9 8 H1 as ExpoH1, 10 9 H2 as ExpoH2, 11 10 H3 as ExpoH3, 12 11 H4 as ExpoH4, 13 12 } from '@expo/html-elements' 13 + import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 14 14 15 15 /** 16 16 * These utilities are used to define long documents in an html-like ··· 27 27 // | React.ReactNode 28 28 29 29 export function H1({children}: React.PropsWithChildren<{}>) { 30 + const styles = useStyles() 30 31 const pal = usePalette('default') 31 32 const typography = useTheme().typography['title-xl'] 32 33 return <ExpoH1 style={[typography, pal.text, styles.h1]}>{children}</ExpoH1> 33 34 } 34 35 35 36 export function H2({children}: React.PropsWithChildren<{}>) { 37 + const styles = useStyles() 36 38 const pal = usePalette('default') 37 39 const typography = useTheme().typography['title-lg'] 38 40 return <ExpoH2 style={[typography, pal.text, styles.h2]}>{children}</ExpoH2> 39 41 } 40 42 41 43 export function H3({children}: React.PropsWithChildren<{}>) { 44 + const styles = useStyles() 42 45 const pal = usePalette('default') 43 46 const typography = useTheme().typography.title 44 47 return <ExpoH3 style={[typography, pal.text, styles.h3]}>{children}</ExpoH3> 45 48 } 46 49 47 50 export function H4({children}: React.PropsWithChildren<{}>) { 51 + const styles = useStyles() 48 52 const pal = usePalette('default') 49 53 const typography = useTheme().typography['title-sm'] 50 54 return <ExpoH4 style={[typography, pal.text, styles.h4]}>{children}</ExpoH4> 51 55 } 52 56 53 57 export function P({children}: React.PropsWithChildren<{}>) { 58 + const styles = useStyles() 54 59 const pal = usePalette('default') 55 60 return ( 56 61 <Text type="md" style={[pal.text, styles.p]}> ··· 60 65 } 61 66 62 67 export function UL({children, isChild}: React.PropsWithChildren<IsChildProps>) { 68 + const styles = useStyles() 63 69 return ( 64 70 <View style={[styles.ul, isChild && styles.ulChild]}> 65 71 {markChildProps(children)} ··· 68 74 } 69 75 70 76 export function OL({children, isChild}: React.PropsWithChildren<IsChildProps>) { 77 + const styles = useStyles() 71 78 return ( 72 79 <View style={[styles.ol, isChild && styles.olChild]}> 73 80 {markChildProps(children)} ··· 79 86 children, 80 87 value, 81 88 }: React.PropsWithChildren<{value?: string}>) { 89 + const styles = useStyles() 82 90 const pal = usePalette('default') 83 91 return ( 84 92 <View style={styles.li}> ··· 91 99 } 92 100 93 101 export function A({children, href}: React.PropsWithChildren<{href: string}>) { 102 + const styles = useStyles() 94 103 const pal = usePalette('default') 95 104 return ( 96 105 <TextLink ··· 112 121 } 113 122 114 123 export function EM({children}: React.PropsWithChildren<{}>) { 124 + const styles = useStyles() 115 125 const pal = usePalette('default') 116 126 return ( 117 127 <Text type="md" style={[pal.text, styles.em]}> ··· 132 142 }) 133 143 } 134 144 135 - const styles = StyleSheet.create({ 136 - h1: { 137 - marginTop: 20, 138 - marginBottom: 10, 139 - letterSpacing: 0.8, 140 - }, 141 - h2: { 142 - marginTop: 20, 143 - marginBottom: 10, 144 - letterSpacing: 0.8, 145 - }, 146 - h3: { 147 - marginTop: 0, 148 - marginBottom: 10, 149 - }, 150 - h4: { 151 - marginTop: 0, 152 - marginBottom: 10, 153 - fontWeight: 'bold', 154 - }, 155 - p: { 156 - marginBottom: 10, 157 - }, 158 - ul: { 159 - marginBottom: 10, 160 - paddingLeft: isDesktopWeb ? 18 : 4, 161 - }, 162 - ulChild: { 163 - paddingTop: 10, 164 - marginBottom: 0, 165 - }, 166 - ol: { 167 - marginBottom: 10, 168 - paddingLeft: isDesktopWeb ? 18 : 4, 169 - }, 170 - olChild: { 171 - paddingTop: 10, 172 - marginBottom: 0, 173 - }, 174 - li: { 175 - flexDirection: 'row', 176 - paddingRight: 20, 177 - marginBottom: 10, 178 - }, 179 - liBullet: { 180 - paddingRight: 10, 181 - }, 182 - liText: {}, 183 - a: { 184 - marginBottom: 10, 185 - }, 186 - em: { 187 - fontStyle: 'italic', 188 - }, 189 - }) 145 + const useStyles = () => { 146 + const {isDesktop} = useWebMediaQueries() 147 + return StyleSheet.create({ 148 + h1: { 149 + marginTop: 20, 150 + marginBottom: 10, 151 + letterSpacing: 0.8, 152 + }, 153 + h2: { 154 + marginTop: 20, 155 + marginBottom: 10, 156 + letterSpacing: 0.8, 157 + }, 158 + h3: { 159 + marginTop: 0, 160 + marginBottom: 10, 161 + }, 162 + h4: { 163 + marginTop: 0, 164 + marginBottom: 10, 165 + fontWeight: 'bold', 166 + }, 167 + p: { 168 + marginBottom: 10, 169 + }, 170 + ul: { 171 + marginBottom: 10, 172 + paddingLeft: isDesktop ? 18 : 4, 173 + }, 174 + ulChild: { 175 + paddingTop: 10, 176 + marginBottom: 0, 177 + }, 178 + ol: { 179 + marginBottom: 10, 180 + paddingLeft: isDesktop ? 18 : 4, 181 + }, 182 + olChild: { 183 + paddingTop: 10, 184 + marginBottom: 0, 185 + }, 186 + li: { 187 + flexDirection: 'row', 188 + paddingRight: 20, 189 + marginBottom: 10, 190 + }, 191 + liBullet: { 192 + paddingRight: 10, 193 + }, 194 + liText: {}, 195 + a: { 196 + marginBottom: 10, 197 + }, 198 + em: { 199 + fontStyle: 'italic', 200 + }, 201 + }) 202 + }
+5 -2
src/view/com/util/Link.tsx
··· 24 24 import {router} from '../../../routes' 25 25 import {useStores, RootStoreModel} from 'state/index' 26 26 import {convertBskyAppUrlIfNeeded, isExternalUrl} from 'lib/strings/url-helpers' 27 - import {isAndroid, isDesktopWeb} from 'platform/detection' 27 + import {isAndroid} from 'platform/detection' 28 28 import {sanitizeUrl} from '@braintree/sanitize-url' 29 29 import {PressableWithHover} from './PressableWithHover' 30 30 import FixedTouchableHighlight from '../pager/FixedTouchableHighlight' 31 + import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 31 32 32 33 type Event = 33 34 | React.MouseEvent<HTMLAnchorElement, MouseEvent> ··· 224 225 lineHeight, 225 226 ...props 226 227 }: DesktopWebTextLinkProps) { 227 - if (isDesktopWeb) { 228 + const {isDesktop} = useWebMediaQueries() 229 + 230 + if (isDesktop) { 228 231 return ( 229 232 <TextLink 230 233 testID={testID}