diff --git a/src/view/com/auth/withAuthRequired.tsx b/src/view/com/auth/withAuthRequired.tsx index 6073a4f8..a3f02127 100644 --- a/src/view/com/auth/withAuthRequired.tsx +++ b/src/view/com/auth/withAuthRequired.tsx @@ -1,7 +1,8 @@ import React from 'react' -import {ActivityIndicator, StyleSheet, View} from 'react-native' +import {ActivityIndicator, StyleSheet} from 'react-native' import {observer} from 'mobx-react-lite' import {useStores} from 'state/index' +import {CenteredView} from '../util/Views' import {LoggedOut} from './LoggedOut' import {Text} from '../util/text/Text' import {usePalette} from 'lib/hooks/usePalette' @@ -30,14 +31,14 @@ function Loading() { }, [setIsTakingTooLong]) return ( - + {isTakingTooLong ? "This is taking too long. There may be a problem with your internet or with the service, but we're going to try a couple more times..." : 'Connecting...'} - + ) } diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index fd9f2324..34df2a8e 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -3,7 +3,7 @@ import {observer} from 'mobx-react-lite' import { Animated, TouchableOpacity, - TouchableWithoutFeedback, + Pressable, StyleSheet, View, } from 'react-native' @@ -124,7 +124,7 @@ export const FeedItem = observer(function FeedItem({ return <> } - let authors: Author[] = [ + const authors: Author[] = [ { href: `/profile/${item.author.handle}`, handle: item.author.handle, @@ -132,18 +132,18 @@ export const FeedItem = observer(function FeedItem({ avatar: item.author.avatar, labels: item.author.labels, }, + ...(item.additional?.map( + ({author: {avatar, labels, handle, displayName}}) => { + return { + href: `/profile/${handle}`, + handle, + displayName, + avatar, + labels, + } + }, + ) || []), ] - if (item.additional?.length) { - authors = authors.concat( - item.additional.map(item2 => ({ - href: `/profile/${item2.author.handle}`, - handle: item2.author.handle, - displayName: item2.author.displayName, - avatar: item2.author.avatar, - labels: item2.author.labels, - })), - ) - } return ( - - - {icon === 'HeartIconSolid' ? ( - - ) : ( - + {icon === 'HeartIconSolid' ? ( + + ) : ( + + )} + + + 1 ? onToggleAuthorsExpanded : () => {}}> + + + + - )} - - - 1 ? onToggleAuthorsExpanded : () => {}}> - - - - - - {authors.length > 1 ? ( - <> - and - - {authors.length - 1}{' '} - {pluralize(authors.length - 1, 'other')} - - - ) : undefined} - {action} - - {ago(item.indexedAt)} + {authors.length > 1 ? ( + <> + and + + {authors.length - 1} {pluralize(authors.length - 1, 'other')} - - - - {item.isLike || item.isRepost || item.isQuote ? ( - - ) : ( - <> - )} - + + ) : undefined} + {action} + + {ago(item.indexedAt)} + + + + {item.isLike || item.isRepost || item.isQuote ? ( + + ) : null} ) @@ -392,8 +382,6 @@ const styles = StyleSheet.create({ padding: 10, paddingRight: 15, borderTopWidth: 1, - }, - layout: { flexDirection: 'row', }, layoutIcon: { @@ -405,6 +393,9 @@ const styles = StyleSheet.create({ marginRight: 10, marginTop: 4, }, + layoutContent: { + flex: 1, + }, avis: { flexDirection: 'row', alignItems: 'center', @@ -413,9 +404,6 @@ const styles = StyleSheet.create({ fontWeight: 'bold', paddingLeft: 6, }, - layoutContent: { - flex: 1, - }, meta: { flexDirection: 'row', flexWrap: 'wrap', diff --git a/src/view/com/pager/TabBar.tsx b/src/view/com/pager/TabBar.tsx index 8f3951e7..628128e8 100644 --- a/src/view/com/pager/TabBar.tsx +++ b/src/view/com/pager/TabBar.tsx @@ -1,11 +1,7 @@ import React, {createRef, useState, useMemo, useRef} from 'react' -import { - Animated, - StyleSheet, - TouchableWithoutFeedback, - View, -} from 'react-native' +import {Animated, StyleSheet, View} from 'react-native' import {Text} from '../util/text/Text' +import {PressableWithHover} from '../util/PressableWithHover' import {usePalette} from 'lib/hooks/usePalette' import {isDesktopWeb} from 'platform/detection' @@ -109,20 +105,21 @@ export function TabBar({ {items.map((item, i) => { const selected = i === selectedPage return ( - onPressItem(i)}> - - - {item} - - - + + {item} + + ) })} @@ -138,18 +135,19 @@ const styles = isDesktopWeb itemTop: { paddingTop: 16, paddingBottom: 14, - marginRight: 24, + paddingHorizontal: 12, }, itemBottom: { paddingTop: 14, paddingBottom: 16, - marginRight: 24, + paddingHorizontal: 12, }, indicator: { position: 'absolute', left: 0, width: 1, height: 3, + zIndex: 1, }, }) : StyleSheet.create({ diff --git a/src/view/com/profile/ProfileCard.tsx b/src/view/com/profile/ProfileCard.tsx index d14d5e16..07bf4e29 100644 --- a/src/view/com/profile/ProfileCard.tsx +++ b/src/view/com/profile/ProfileCard.tsx @@ -48,7 +48,6 @@ export function ProfileCard({ ]} href={`/profile/${handle}`} title={handle} - noFeedback asAnchor> diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 101b6b83..4c232a13 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -64,7 +64,7 @@ export const ProfileHeader = observer( - + {sanitizeDisplayName(view.displayName || view.handle)} @@ -273,7 +273,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoaded({ ) : undefined} - + +} + +export const PressableWithHover = forwardRef( + ( + { + children, + style, + hoverStyle, + ...props + }: PropsWithChildren, + ref: Ref, + ) => { + const [isHovering, setIsHovering] = useState(false) + + const onHoverIn = useCallback(() => setIsHovering(true), [setIsHovering]) + const onHoverOut = useCallback(() => setIsHovering(false), [setIsHovering]) + style = + typeof style !== 'function' && isHovering + ? addStyle(style, hoverStyle) + : style + + return ( + + {children} + + ) + }, +) diff --git a/src/view/com/util/Selector.tsx b/src/view/com/util/Selector.tsx index 03db13bd..872b7818 100644 --- a/src/view/com/util/Selector.tsx +++ b/src/view/com/util/Selector.tsx @@ -1,10 +1,5 @@ import React, {createRef, useState, useMemo, useRef} from 'react' -import { - Animated, - StyleSheet, - TouchableWithoutFeedback, - View, -} from 'react-native' +import {Animated, Pressable, StyleSheet, View} from 'react-native' import {Text} from './text/Text' import {usePalette} from 'lib/hooks/usePalette' @@ -99,7 +94,7 @@ export function Selector({ {items.map((item, i) => { const selected = i === selectedIndex return ( - onPressItem(i)}> + onPressItem(i)}> - + ) })} diff --git a/src/view/com/util/moderation/ContentHider.tsx b/src/view/com/util/moderation/ContentHider.tsx index c1512171..42a97cd3 100644 --- a/src/view/com/util/moderation/ContentHider.tsx +++ b/src/view/com/util/moderation/ContentHider.tsx @@ -40,7 +40,7 @@ export function ContentHider({ } if (labelPref.pref === 'hide') { - return <> + return null } return ( diff --git a/src/view/screens/SearchMobile.tsx b/src/view/screens/SearchMobile.tsx index 679fb07c..de64b2d6 100644 --- a/src/view/screens/SearchMobile.tsx +++ b/src/view/screens/SearchMobile.tsx @@ -1,8 +1,8 @@ -import React from 'react' +import React, {useCallback} from 'react' import { - Keyboard, StyleSheet, TouchableWithoutFeedback, + Keyboard, View, } from 'react-native' import {useFocusEffect} from '@react-navigation/native' @@ -26,6 +26,7 @@ import {s} from 'lib/styles' import {ProfileCard} from 'view/com/profile/ProfileCard' import {usePalette} from 'lib/hooks/usePalette' import {useOnMainScroll} from 'lib/hooks/useOnMainScroll' +import {isAndroid, isIOS} from 'platform/detection' type Props = NativeStackScreenProps export const SearchScreen = withAuthRequired( @@ -110,8 +111,14 @@ export const SearchScreen = withAuthRequired( }, [store, autocompleteView, foafs, suggestedActors, onSoftReset]), ) + const onPress = useCallback(() => { + if (isIOS || isAndroid) { + Keyboard.dismiss() + } + }, []) + return ( - + {query && autocompleteView.searchRes.length ? ( <> - {autocompleteView.searchRes.map(item => ( - - ))} + {autocompleteView.searchRes.map( + ({did, handle, displayName, labels, avatar}, index) => ( + + ), + )} ) : query && !autocompleteView.searchRes.length ? ( diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index e9a631b2..c5486a8f 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -1,6 +1,7 @@ import React from 'react' import {observer} from 'mobx-react-lite' import {StyleSheet, TouchableOpacity, View} from 'react-native' +import {PressableWithHover} from 'view/com/util/PressableWithHover' import {useNavigation, useNavigationState} from '@react-navigation/native' import { FontAwesomeIcon, @@ -88,19 +89,23 @@ const NavItem = observer( const isCurrent = isTab(currentRouteName, pathName) return ( - - - {isCurrent ? iconFilled : icon} - {typeof count === 'number' && count > 0 && ( - - {count} - - )} - - - {label} - - + + + + {isCurrent ? iconFilled : icon} + {typeof count === 'number' && count > 0 && ( + + {count} + + )} + + + {label} + + + ) }, ) @@ -193,13 +198,14 @@ const styles = StyleSheet.create({ leftNav: { position: 'absolute', top: 10, - right: 'calc(50vw + 300px)', + right: 'calc(50vw + 312px)', width: 220, }, profileCard: { marginVertical: 10, width: 60, + paddingLeft: 12, }, backBtn: { @@ -210,11 +216,15 @@ const styles = StyleSheet.create({ height: 30, }, + navItemWrapper: { + paddingHorizontal: 12, + borderRadius: 8, + }, navItem: { flexDirection: 'row', alignItems: 'center', - paddingTop: 14, - paddingBottom: 10, + paddingTop: 12, + paddingBottom: 12, }, navItemIconWrapper: { alignItems: 'center', @@ -245,6 +255,7 @@ const styles = StyleSheet.create({ paddingVertical: 10, paddingHorizontal: 16, backgroundColor: colors.blue3, + marginLeft: 12, marginTop: 20, marginBottom: 10, },