switch to useSafeAreaInsets().top (#85)

StatusBar.currentHeight seems just broken on some devices
This commit is contained in:
austinried
2022-04-04 12:48:10 +09:00
committed by GitHub
parent 9923a8cbcf
commit accb969e73
9 changed files with 49 additions and 51 deletions
+5 -5
View File
@@ -12,8 +12,9 @@ import colors from '@app/styles/colors'
import font from '@app/styles/font'
import { useNavigation } from '@react-navigation/core'
import React, { useCallback, useState } from 'react'
import { KeyboardTypeOptions, Linking, Modal, Pressable, StatusBar, StyleSheet, Text, View } from 'react-native'
import { KeyboardTypeOptions, Linking, Modal, Pressable, StyleSheet, Text, View } from 'react-native'
import { ScrollView } from 'react-native-gesture-handler'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
import { version } from '../../package.json'
@@ -296,8 +297,10 @@ const SettingsContent = React.memo(() => {
})
const Settings = () => {
const paddingTop = useSafeAreaInsets().top
return (
<GradientScrollView style={styles.scroll} contentContainerStyle={styles.scrollContentContainer}>
<GradientScrollView style={styles.scroll} contentContainerStyle={{ paddingTop }}>
<SettingsContent />
</GradientScrollView>
)
@@ -307,9 +310,6 @@ const styles = StyleSheet.create({
scroll: {
flex: 1,
},
scrollContentContainer: {
paddingTop: StatusBar.currentHeight,
},
content: {
paddingHorizontal: 20,
paddingBottom: 40,