move button inline if viewport is small (vertically)
parent
c1c7a55fd5
commit
f3619cf9f9
|
@ -11,6 +11,7 @@ const AnimatedTouchableOpacity =
|
||||||
Animated.createAnimatedComponent(TouchableOpacity)
|
Animated.createAnimatedComponent(TouchableOpacity)
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from 'platform/detection'
|
||||||
import {useSession} from 'state/session'
|
import {useSession} from 'state/session'
|
||||||
|
import {useMediaQuery} from 'react-responsive'
|
||||||
|
|
||||||
export function LoadLatestBtn({
|
export function LoadLatestBtn({
|
||||||
onPress,
|
onPress,
|
||||||
|
@ -26,6 +27,9 @@ export function LoadLatestBtn({
|
||||||
const {isDesktop, isTablet, isMobile, isTabletOrMobile} = useWebMediaQueries()
|
const {isDesktop, isTablet, isMobile, isTabletOrMobile} = useWebMediaQueries()
|
||||||
const {fabMinimalShellTransform} = useMinimalShellMode()
|
const {fabMinimalShellTransform} = useMinimalShellMode()
|
||||||
|
|
||||||
|
// move button inline if it starts overlapping the left nav
|
||||||
|
const isTallViewport = useMediaQuery({minHeight: 700})
|
||||||
|
|
||||||
// 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 ? isMobile : isTabletOrMobile
|
||||||
|
@ -34,8 +38,11 @@ export function LoadLatestBtn({
|
||||||
<AnimatedTouchableOpacity
|
<AnimatedTouchableOpacity
|
||||||
style={[
|
style={[
|
||||||
styles.loadLatest,
|
styles.loadLatest,
|
||||||
isDesktop && styles.loadLatestDesktop,
|
isDesktop &&
|
||||||
isTablet && styles.loadLatestTablet,
|
(isTallViewport
|
||||||
|
? styles.loadLatestOutOfLine
|
||||||
|
: styles.loadLatestInline),
|
||||||
|
isTablet && styles.loadLatestInline,
|
||||||
pal.borderDark,
|
pal.borderDark,
|
||||||
pal.view,
|
pal.view,
|
||||||
showBottomBar && fabMinimalShellTransform,
|
showBottomBar && fabMinimalShellTransform,
|
||||||
|
@ -65,11 +72,11 @@ const styles = StyleSheet.create({
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
loadLatestTablet: {
|
loadLatestInline: {
|
||||||
// @ts-ignore web only
|
// @ts-ignore web only
|
||||||
left: 'calc(50vw - 282px)',
|
left: 'calc(50vw - 282px)',
|
||||||
},
|
},
|
||||||
loadLatestDesktop: {
|
loadLatestOutOfLine: {
|
||||||
// @ts-ignore web only
|
// @ts-ignore web only
|
||||||
left: 'calc(50vw - 382px)',
|
left: 'calc(50vw - 382px)',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue