Reposition FABs

This commit is contained in:
DS Boyce
2026-07-31 11:25:55 -07:00
parent 236013b5fc
commit 76c65f333e
2 changed files with 17 additions and 13 deletions
+7 -2
View File
@@ -32,8 +32,13 @@ export function FABInner({testID, icon, onPress, style, ...props}: FABProps) {
const size = gtMobile ? styles.sizeLarge : styles.sizeRegular const size = gtMobile ? styles.sizeLarge : styles.sizeRegular
const tabletSpacing = gtMobile const tabletSpacing = gtMobile
? {right: 50, bottom: 50} ? {right: a.pr_xl.paddingRight, bottom: a.pb_lg.paddingBottom}
: {right: 24, bottom: clamp(insets.bottom, 15, 60) + 15} : {
right: a.pr_lg.paddingRight,
bottom:
clamp(insets.bottom, a.pb_md.paddingBottom, 60) +
a.pb_md.paddingBottom,
}
return ( return (
<Animated.View <Animated.View
+10 -11
View File
@@ -6,7 +6,6 @@ import {useMediaQuery} from 'react-responsive'
import {HITSLOP_20} from '#/lib/constants' import {HITSLOP_20} from '#/lib/constants'
import {PressableScale} from '#/lib/custom-animations/PressableScale' import {PressableScale} from '#/lib/custom-animations/PressableScale'
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform' import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {clamp} from '#/lib/numbers' import {clamp} from '#/lib/numbers'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import { import {
@@ -31,9 +30,8 @@ export function LoadLatestBtn({
showIndicator: boolean showIndicator: boolean
}) { }) {
const {hasSession} = useSession() const {hasSession} = useSession()
const {isDesktop, isTablet, isMobile, isTabletOrMobile} = useWebMediaQueries()
const {centerColumnOffset} = useLayoutBreakpoints() const {centerColumnOffset} = useLayoutBreakpoints()
const {gtMobile} = useBreakpoints() const {gtMobile, gtTablet} = useBreakpoints()
const fabMinimalShellTransform = useMinimalShellFabTransform() const fabMinimalShellTransform = useMinimalShellFabTransform()
const insets = useSafeAreaInsets() const insets = useSafeAreaInsets()
const t = useTheme() const t = useTheme()
@@ -48,11 +46,12 @@ export function LoadLatestBtn({
// Adjust height of the fab if we have a session only on mobile web. If we don't have a session, we want to adjust // Adjust height of the fab if we have a session only on mobile web. If we don't have a session, we want to adjust
// it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth) // it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth)
const showBottomBar = hasSession ? isMobile : isTabletOrMobile const showBottomBar = hasSession ? !gtMobile : !gtTablet
const bottomPosition = isTablet const bottomInset = gtMobile ? a.pb_lg.paddingBottom : a.pb_md.paddingBottom
? {bottom: 50} const bottomPosition = gtMobile
: {bottom: clamp(insets.bottom, 15, 60) + 15} ? {bottom: bottomInset}
: {bottom: clamp(insets.bottom, bottomInset, 60) + bottomInset}
return ( return (
<Animated.View <Animated.View
@@ -61,11 +60,11 @@ export function LoadLatestBtn({
a.fixed, a.fixed,
a.z_20, a.z_20,
{left: gtMobile ? a.pl_lg.paddingLeft : a.pl_md.paddingLeft}, {left: gtMobile ? a.pl_lg.paddingLeft : a.pl_md.paddingLeft},
isDesktop && gtTablet &&
(isTallViewport (isTallViewport
? styles.loadLatestOutOfLine ? styles.loadLatestOutOfLine
: styles.loadLatestInline), : styles.loadLatestInline),
isTablet && gtMobile &&
(centerColumnOffset (centerColumnOffset
? styles.loadLatestInlineOffset ? styles.loadLatestInlineOffset
: styles.loadLatestInline), : styles.loadLatestInline),
@@ -109,10 +108,10 @@ export function LoadLatestBtn({
const styles = StyleSheet.create({ const styles = StyleSheet.create({
loadLatestInline: { loadLatestInline: {
left: web('calc(50vw - 282px)'), left: web('calc(50vw - 292px)'),
}, },
loadLatestInlineOffset: { loadLatestInlineOffset: {
left: web(`calc(50vw - 282px + ${CENTER_COLUMN_OFFSET}px)`), left: web(`calc(50vw - 292px + ${CENTER_COLUMN_OFFSET}px)`),
}, },
loadLatestOutOfLine: { loadLatestOutOfLine: {
left: web('calc(50vw - 382px)'), left: web('calc(50vw - 382px)'),