From 211af98aaf079343ad2395c46d01cd292c9fc98d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 5 Dec 2022 10:18:38 -0600 Subject: [PATCH 1/4] Enlarge click targets for post controls and view header --- src/view/com/util/DropdownBtn.tsx | 8 +++++++- src/view/com/util/PostCtrls.tsx | 9 +++++++-- src/view/com/util/ViewHeader.tsx | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/view/com/util/DropdownBtn.tsx b/src/view/com/util/DropdownBtn.tsx index ea4e195038..98e2f3f2ba 100644 --- a/src/view/com/util/DropdownBtn.tsx +++ b/src/view/com/util/DropdownBtn.tsx @@ -18,6 +18,8 @@ import {useStores} from '../../../state' import {ConfirmModel} from '../../../state/models/shell-ui' import {TABS_ENABLED} from '../../../build-flags' +const HITSLOP = {left: 10, top: 10, right: 10, bottom: 10} + export interface DropdownItem { icon?: IconProp label: string @@ -61,7 +63,11 @@ export function DropdownBtn({ } return ( - + {children} ) diff --git a/src/view/com/util/PostCtrls.tsx b/src/view/com/util/PostCtrls.tsx index 10b54be3f0..f2a66d100c 100644 --- a/src/view/com/util/PostCtrls.tsx +++ b/src/view/com/util/PostCtrls.tsx @@ -25,6 +25,7 @@ interface PostCtrlsOpts { const redgray = '#7A6161' const sRedgray = {color: redgray} +const HITSLOP = {top: 10, left: 10, bottom: 10, right: 10} export function PostCtrls(opts: PostCtrlsOpts) { const interp1 = useSharedValue(0) @@ -59,7 +60,10 @@ export function PostCtrls(opts: PostCtrlsOpts) { return ( - + @@ -98,6 +103,7 @@ export function PostCtrls(opts: PostCtrlsOpts) { {opts.isUpvoted ? ( @@ -137,7 +143,6 @@ const styles = StyleSheet.create({ ctrl: { flexDirection: 'row', alignItems: 'center', - paddingRight: 4, }, ctrlIcon: { color: redgray, diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx index 50b7e65326..5d0ec2995e 100644 --- a/src/view/com/util/ViewHeader.tsx +++ b/src/view/com/util/ViewHeader.tsx @@ -5,6 +5,9 @@ import {colors} from '../../lib/styles' import {MagnifyingGlassIcon} from '../../lib/icons' import {useStores} from '../../../state' +const HITSLOP = {left: 10, top: 10, right: 10, bottom: 10} +const BACK_HITSLOP = {left: 10, top: 10, right: 30, bottom: 10} + export function ViewHeader({ title, subtitle, @@ -27,11 +30,14 @@ export function ViewHeader({ return ( {store.nav.tab.canGoBack ? ( - + ) : undefined} - + {title} {subtitle ? ( @@ -39,11 +45,15 @@ export function ViewHeader({ ) : undefined} - + Date: Mon, 5 Dec 2022 10:25:53 -0600 Subject: [PATCH 2/4] Make 'backswipe' a little easier to trigger --- src/view/shell/mobile/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 27524bcaef..fed7d02690 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -47,8 +47,8 @@ import { BellIconSolid, } from '../../lib/icons' -const SWIPE_GESTURE_DIST_TRIGGER = 0.4 -const SWIPE_GESTURE_VEL_TRIGGER = 2500 +const SWIPE_GESTURE_DIST_TRIGGER = 0.3 +const SWIPE_GESTURE_VEL_TRIGGER = 2000 const Btn = ({ icon, From c7a5642e48cc65c801f96f3b6667c69f67c36197 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 5 Dec 2022 10:39:34 -0600 Subject: [PATCH 3/4] Fix 'swipe back to nothing' bug --- src/view/shell/mobile/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index fed7d02690..d653944d19 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -195,6 +195,7 @@ export const MobileShell: React.FC = observer(() => { // = const goBack = () => store.nav.tab.goBack() const swipeGesture = Gesture.Pan() + .enabled(store.nav.tab.canGoBack) .onUpdate(e => { if (store.nav.tab.canGoBack) { swipeGestureInterp.value = Math.max(e.translationX / winDim.width, 0) From 09791a3b3ca8bdfedbdfdc516a4ddfc63a73f440 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 5 Dec 2022 10:50:46 -0600 Subject: [PATCH 4/4] Remove loading-placeholder animation; according to some issues, animated linear-gradients may cause crashes --- src/view/com/util/LoadingPlaceholder.tsx | 51 +++--------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/src/view/com/util/LoadingPlaceholder.tsx b/src/view/com/util/LoadingPlaceholder.tsx index 3fcb07b510..9c2d0398f3 100644 --- a/src/view/com/util/LoadingPlaceholder.tsx +++ b/src/view/com/util/LoadingPlaceholder.tsx @@ -1,13 +1,5 @@ -import React, {useEffect, useMemo} from 'react' -import { - Animated, - StyleSheet, - StyleProp, - useWindowDimensions, - View, - ViewStyle, -} from 'react-native' -import LinearGradient from 'react-native-linear-gradient' +import React from 'react' +import {StyleSheet, StyleProp, View, ViewStyle} from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {UpIcon} from '../../lib/icons' import {s, colors} from '../../lib/styles' @@ -21,31 +13,6 @@ export function LoadingPlaceholder({ height: string | number style?: StyleProp }) { - const dim = useWindowDimensions() - const elWidth = typeof width === 'string' ? dim.width : width - const offset = useMemo(() => new Animated.Value(elWidth * -1), []) - useEffect(() => { - const anim = Animated.loop( - Animated.sequence([ - Animated.timing(offset, { - toValue: elWidth, - duration: 1e3, - useNativeDriver: true, - isInteraction: false, - }), - Animated.timing(offset, { - toValue: elWidth * -1, - duration: 0, - delay: 500, - useNativeDriver: true, - isInteraction: false, - }), - ]), - ) - anim.start() - return () => anim.stop() - }, []) - return ( - - - + backgroundColor: '#e7e9ea', + }} + /> ) }