summaryrefslogtreecommitdiff
path: root/app_expo/components/screen/screen.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-23 15:24:35 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-23 15:24:35 +0200
commit356381d14cb1ff3cbd39c7e396dd14379336451b (patch)
treea03e9b2534600bde7b3b781411b5b03f8134904b /app_expo/components/screen/screen.tsx
parent7aa007f158a52b41494049a1202938fc97813ec1 (diff)
parent73308af061af5e17ac7d4a73fa027a2f303c70dd (diff)
resolving merge conflicts
Diffstat (limited to 'app_expo/components/screen/screen.tsx')
-rw-r--r--app_expo/components/screen/screen.tsx66
1 files changed, 0 insertions, 66 deletions
diff --git a/app_expo/components/screen/screen.tsx b/app_expo/components/screen/screen.tsx
deleted file mode 100644
index dafe36e..0000000
--- a/app_expo/components/screen/screen.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import * as React from 'react'
-import { KeyboardAvoidingView, Platform, ScrollView, StatusBar, View } from 'react-native'
-import { useSafeAreaInsets } from 'react-native-safe-area-context'
-import { ScreenProps } from './screen.props'
-import { isNonScrolling, offsets, presets } from './screen.presets'
-
-const isIos = Platform.OS === 'ios'
-
-function ScreenWithoutScrolling(props: ScreenProps) {
- const insets = useSafeAreaInsets()
- const preset = presets.fixed
- const style = props.style || {}
- const backgroundStyle = props.backgroundColor ? { backgroundColor: props.backgroundColor } : {}
- const insetStyle = { paddingTop: props.unsafe ? 0 : insets.top }
-
- return (
- <KeyboardAvoidingView
- style={[preset.outer, backgroundStyle]}
- behavior={isIos ? 'padding' : undefined}
- keyboardVerticalOffset={offsets[props.keyboardOffset || 'none']}
- >
- <StatusBar barStyle={props.statusBar || 'light-content'} />
- <View style={[preset.inner, style, insetStyle]}>{props.children}</View>
- </KeyboardAvoidingView>
- )
-}
-
-function ScreenWithScrolling(props: ScreenProps) {
- const insets = useSafeAreaInsets()
- const preset = presets.scroll
- const style = props.style || {}
- const backgroundStyle = props.backgroundColor ? { backgroundColor: props.backgroundColor } : {}
- const insetStyle = { paddingTop: props.unsafe ? 0 : insets.top }
-
- return (
- <KeyboardAvoidingView
- style={[preset.outer, backgroundStyle]}
- behavior={isIos ? 'padding' : undefined}
- keyboardVerticalOffset={offsets[props.keyboardOffset || 'none']}
- >
- <StatusBar barStyle={props.statusBar || 'light-content'} />
- <View style={[preset.outer, backgroundStyle, insetStyle]}>
- <ScrollView
- style={[preset.outer, backgroundStyle]}
- contentContainerStyle={[preset.inner, style]}
- keyboardShouldPersistTaps={props.keyboardShouldPersistTaps || 'handled'}
- >
- {props.children}
- </ScrollView>
- </View>
- </KeyboardAvoidingView>
- )
-}
-
-/**
- * The starting component on every screen in the app.
- *
- * @param props The screen props
- */
-export function Screen(props: ScreenProps) {
- if (isNonScrolling(props.preset)) {
- return <ScreenWithoutScrolling {...props} />
- } else {
- return <ScreenWithScrolling {...props} />
- }
-}