mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-22 22:28:22 +03:00
attempt to fix android safe area inserts
This commit is contained in:
@@ -74,7 +74,7 @@ export default function CardManager({navigation}) {
|
||||
|
||||
return (
|
||||
<FlatList contentInsetAdjustmentBehavior="always"
|
||||
style={{padding: 16, paddingTop: 24}}
|
||||
style={{padding: 16}}
|
||||
data={cards}
|
||||
keyExtractor={i => i._id.toString()}
|
||||
contentContainerStyle={{paddingBottom: 120}}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {BSON} from "realm";
|
||||
import {ActivityIndicator, Button, Text, useTheme} from "react-native-paper";
|
||||
import React, {useCallback, useEffect, useLayoutEffect, useMemo, useState} from "react";
|
||||
import {Alert, Platform, RefreshControl, ScrollView, Share, StyleSheet, View} from "react-native";
|
||||
import {Alert, Platform, RefreshControl, ScrollView, Share, View} from "react-native";
|
||||
import {useSafeAreaInsets} from "react-native-safe-area-context";
|
||||
import {
|
||||
CircleCheck,
|
||||
CircleDot,
|
||||
@@ -41,7 +42,8 @@ const {useRealm, useQuery, useObject} = RealmContext;
|
||||
|
||||
export default function ServerCardIn({route, navigation}) {
|
||||
const realm = useRealm();
|
||||
const theme = useTheme()
|
||||
const theme = useTheme();
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
const {serverId} = route.params;
|
||||
const server = useObject(AMServer, ObjectId.createFromHexString(serverId));
|
||||
@@ -215,9 +217,17 @@ export default function ServerCardIn({route, navigation}) {
|
||||
)
|
||||
}
|
||||
|
||||
const containerStyle = {
|
||||
paddingTop: Platform.OS === 'android' ? insets.top : 0,
|
||||
paddingHorizontal: 16,
|
||||
paddingBottom: 80,
|
||||
gap: 20
|
||||
};
|
||||
|
||||
return (
|
||||
<ScrollView contentInsetAdjustmentBehavior="automatic" refreshControl={<RefreshControl refreshing={serverRefreshing} onRefresh={performRefresh}/>}>
|
||||
<View style={styles.container}>
|
||||
<ScrollView contentInsetAdjustmentBehavior="automatic"
|
||||
refreshControl={<RefreshControl refreshing={serverRefreshing} onRefresh={performRefresh}/>}>
|
||||
<View style={containerStyle}>
|
||||
<StatusAlert server={server} connectionEstablished={serverConnectionSuccess}/>
|
||||
<View style={styles.section}>
|
||||
<Text variant="titleLarge" style={styles.sectionTitle}>{server.gameId ? `Play ${getGameName(server.gameId)}` : "Selected Card"}</Text>
|
||||
@@ -344,21 +354,15 @@ const menuActions: MenuAction[] = [
|
||||
}
|
||||
];
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
const styles = {
|
||||
section: {
|
||||
gap: 10
|
||||
},
|
||||
sectionTitle: {
|
||||
fontWeight: "bold"
|
||||
fontWeight: "bold" as const
|
||||
},
|
||||
emptyPlaceholderView: {
|
||||
marginVertical: 30,
|
||||
gap: 15
|
||||
},
|
||||
container: {
|
||||
paddingTop: Platform.select({android: 120, default: 0}),
|
||||
paddingHorizontal: 16,
|
||||
paddingBottom: 80,
|
||||
gap: 20
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ export default function ServerManager({navigation}) {
|
||||
<FlatList contentInsetAdjustmentBehavior="always"
|
||||
data={servers}
|
||||
keyExtractor={i => i._id.toString()}
|
||||
style={{padding: 16, paddingTop: 24}}
|
||||
style={{padding: 16}}
|
||||
contentContainerStyle={{paddingBottom: 80}}
|
||||
renderItem={i => <ServerCard navigation={navigation} server={i.item}/>}
|
||||
ItemSeparatorComponent={() => <View style={{height: 15}}/>}
|
||||
|
||||
@@ -84,4 +84,7 @@ function MethodCard(props: {
|
||||
)
|
||||
}
|
||||
|
||||
export default CardAddModal;
|
||||
export default Platform.select({
|
||||
default: ManualCardEntry,
|
||||
ios: CardAddModal
|
||||
});
|
||||
Reference in New Issue
Block a user