Fix region sizing on web
parent
3e19728618
commit
fa115c1cba
|
@ -67,3 +67,5 @@ export const DEV_SUGGESTED_FOLLOWS = ['alice', 'bob', 'carla'].map(
|
||||||
export const POST_IMG_MAX_WIDTH = 2000
|
export const POST_IMG_MAX_WIDTH = 2000
|
||||||
export const POST_IMG_MAX_HEIGHT = 2000
|
export const POST_IMG_MAX_HEIGHT = 2000
|
||||||
export const POST_IMG_MAX_SIZE = 1000000
|
export const POST_IMG_MAX_SIZE = 1000000
|
||||||
|
|
||||||
|
export const DESKTOP_HEADER_HEIGHT = 57
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import {StyleProp, StyleSheet, TextStyle} from 'react-native'
|
import {StyleProp, StyleSheet, TextStyle} from 'react-native'
|
||||||
import {Theme, TypographyVariant} from './ThemeContext'
|
import {Theme, TypographyVariant} from './ThemeContext'
|
||||||
|
import {isDesktopWeb} from 'platform/detection'
|
||||||
|
import {DESKTOP_HEADER_HEIGHT} from './constants'
|
||||||
|
|
||||||
// 1 is lightest, 2 is light, 3 is mid, 4 is dark, 5 is darkest
|
// 1 is lightest, 2 is light, 3 is mid, 4 is dark, 5 is darkest
|
||||||
export const colors = {
|
export const colors = {
|
||||||
|
@ -150,6 +152,9 @@ export const s = StyleSheet.create({
|
||||||
// dimensions
|
// dimensions
|
||||||
w100pct: {width: '100%'},
|
w100pct: {width: '100%'},
|
||||||
h100pct: {height: '100%'},
|
h100pct: {height: '100%'},
|
||||||
|
hContentRegion: isDesktopWeb
|
||||||
|
? {height: `calc(100vh - ${DESKTOP_HEADER_HEIGHT}px)`}
|
||||||
|
: {height: '100%'},
|
||||||
|
|
||||||
// text align
|
// text align
|
||||||
textLeft: {textAlign: 'left'},
|
textLeft: {textAlign: 'left'},
|
||||||
|
|
|
@ -482,9 +482,9 @@ const ForgotPasswordForm = ({
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
const {screen} = useAnalytics()
|
const {screen} = useAnalytics()
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
screen('Signin:ForgotPassword')
|
screen('Signin:ForgotPassword')
|
||||||
// }, [screen])
|
}, [screen])
|
||||||
|
|
||||||
const onPressSelectService = () => {
|
const onPressSelectService = () => {
|
||||||
store.shell.openModal({
|
store.shell.openModal({
|
||||||
|
|
|
@ -81,7 +81,7 @@ export const Feed = observer(function Feed({
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<CenteredView>
|
<CenteredView>
|
||||||
{view.isLoading && !data && <NotificationFeedLoadingPlaceholder />}
|
{view.isLoading && !data && <NotificationFeedLoadingPlaceholder />}
|
||||||
{view.hasError && (
|
{view.hasError && (
|
||||||
|
|
|
@ -95,7 +95,7 @@ export const PostThread = observer(function PostThread({
|
||||||
onRefresh={onRefresh}
|
onRefresh={onRefresh}
|
||||||
onLayout={onLayout}
|
onLayout={onLayout}
|
||||||
onScrollToIndexFailed={onScrollToIndexFailed}
|
onScrollToIndexFailed={onScrollToIndexFailed}
|
||||||
style={s.h100pct}
|
style={s.hContentRegion}
|
||||||
contentContainerStyle={s.contentContainer}
|
contentContainerStyle={s.contentContainer}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -279,6 +279,7 @@ const styles = StyleSheet.create({
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
paddingBottom: 10,
|
||||||
},
|
},
|
||||||
outerNoTop: {
|
outerNoTop: {
|
||||||
borderTopWidth: 0,
|
borderTopWidth: 0,
|
||||||
|
|
|
@ -23,6 +23,7 @@ import {
|
||||||
ViewProps,
|
ViewProps,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {addStyle, colors} from 'lib/styles'
|
import {addStyle, colors} from 'lib/styles'
|
||||||
|
import {DESKTOP_HEADER_HEIGHT} from 'lib/constants'
|
||||||
|
|
||||||
export function CenteredView({
|
export function CenteredView({
|
||||||
style,
|
style,
|
||||||
|
@ -78,7 +79,7 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
containerScroll: {
|
containerScroll: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: `calc(100vh - ${DESKTOP_HEADER_HEIGHT}px)`,
|
||||||
maxWidth: 600,
|
maxWidth: 600,
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
|
|
|
@ -73,7 +73,7 @@ function DebugInner({
|
||||||
const items = [{currentView}]
|
const items = [{currentView}]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[s.h100pct, pal.view]}>
|
<View style={[s.hContentRegion, pal.view]}>
|
||||||
<ViewHeader title="Debug panel" />
|
<ViewHeader title="Debug panel" />
|
||||||
<ViewSelector
|
<ViewSelector
|
||||||
swipeEnabled
|
swipeEnabled
|
||||||
|
|
|
@ -90,13 +90,13 @@ export const Home = observer(function Home({navIdx, visible}: ScreenParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<Feed
|
<Feed
|
||||||
testID="homeFeed"
|
testID="homeFeed"
|
||||||
key="default"
|
key="default"
|
||||||
feed={store.me.mainFeed}
|
feed={store.me.mainFeed}
|
||||||
scrollElRef={scrollElRef}
|
scrollElRef={scrollElRef}
|
||||||
style={s.h100pct}
|
style={s.hContentRegion}
|
||||||
onPressTryAgain={onPressTryAgain}
|
onPressTryAgain={onPressTryAgain}
|
||||||
onScroll={onMainScroll}
|
onScroll={onMainScroll}
|
||||||
headerOffset={HEADER_HEIGHT}
|
headerOffset={HEADER_HEIGHT}
|
||||||
|
|
|
@ -76,7 +76,7 @@ export const Notifications = ({navIdx, visible}: ScreenParams) => {
|
||||||
}, [visible, store, navIdx, screen, scrollToTop])
|
}, [visible, store, navIdx, screen, scrollToTop])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<ViewHeader title="Notifications" canGoBack={false} />
|
<ViewHeader title="Notifications" canGoBack={false} />
|
||||||
<Feed
|
<Feed
|
||||||
view={store.me.notifications}
|
view={store.me.notifications}
|
||||||
|
|
|
@ -49,9 +49,9 @@ export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
|
||||||
}, [visible, store.nav, store.log, store.shell, name, navIdx, view])
|
}, [visible, store.nav, store.log, store.shell, name, navIdx, view])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<ViewHeader title="Post" />
|
<ViewHeader title="Post" />
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<PostThreadComponent uri={uri} view={view} />
|
<PostThreadComponent uri={uri} view={view} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -84,7 +84,7 @@ export const Search = observer(({navIdx, visible, params}: ScreenParams) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={s.h100pct}>
|
<View style={s.hContentRegion}>
|
||||||
<ViewHeader title="Explore" />
|
<ViewHeader title="Explore" />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
ref={scrollElRef}
|
ref={scrollElRef}
|
||||||
|
|
|
@ -69,9 +69,9 @@ export const Settings = observer(function Settings({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[s.h100pct]} testID="settingsScreen">
|
<View style={[s.hContentRegion]} testID="settingsScreen">
|
||||||
<ViewHeader title="Settings" />
|
<ViewHeader title="Settings" />
|
||||||
<ScrollView style={s.h100pct}>
|
<ScrollView style={s.hContentRegion}>
|
||||||
<View style={[s.mt10, s.pl10, s.pr10]}>
|
<View style={[s.mt10, s.pl10, s.pr10]}>
|
||||||
<View style={[s.flexRow]}>
|
<View style={[s.flexRow]}>
|
||||||
<Text type="xl-bold" style={pal.text}>
|
<Text type="xl-bold" style={pal.text}>
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const WebShell: React.FC = observer(() => {
|
||||||
{screenRenderDesc.screens.map(({Com, navIdx, params, key, current}) => (
|
{screenRenderDesc.screens.map(({Com, navIdx, params, key, current}) => (
|
||||||
<View
|
<View
|
||||||
key={key}
|
key={key}
|
||||||
style={[s.h100pct, current ? styles.visible : styles.hidden]}>
|
style={[s.hContentRegion, current ? styles.visible : styles.hidden]}>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<Com params={params} navIdx={navIdx} visible={current} />
|
<Com params={params} navIdx={navIdx} visible={current} />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
|
Loading…
Reference in New Issue