chore: fix bug
This commit is contained in:
@@ -238,8 +238,7 @@ export default function OrdersScreen() {
|
||||
StyleSheet.create({
|
||||
container: { flex: 1, backgroundColor: colors.bgPrimary },
|
||||
refreshRow: {
|
||||
paddingHorizontal: spacing.l,
|
||||
paddingBottom: spacing.s,
|
||||
paddingBottom: spacing.m,
|
||||
alignItems: "flex-start",
|
||||
},
|
||||
refreshBtn: {
|
||||
@@ -579,20 +578,6 @@ export default function OrdersScreen() {
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.refreshRow}>
|
||||
<TouchableOpacity
|
||||
style={styles.refreshBtn}
|
||||
onPress={onRefresh}
|
||||
disabled={refreshing}
|
||||
>
|
||||
<Ionicons
|
||||
name="refresh-outline"
|
||||
size={16}
|
||||
color={refreshing ? colors.textMuted : colors.accent}
|
||||
/>
|
||||
<Text style={styles.refreshBtnText}>Actualiser</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
<FlatList
|
||||
data={commands}
|
||||
keyExtractor={(item) => item.id.toString()}
|
||||
@@ -604,7 +589,23 @@ export default function OrdersScreen() {
|
||||
tintColor={colors.accent}
|
||||
/>
|
||||
}
|
||||
contentContainerStyle={{ padding: spacing.l, paddingTop: 0 }}
|
||||
contentContainerStyle={{ padding: spacing.l }}
|
||||
ListHeaderComponent={
|
||||
<View style={styles.refreshRow}>
|
||||
<TouchableOpacity
|
||||
style={styles.refreshBtn}
|
||||
onPress={onRefresh}
|
||||
disabled={refreshing}
|
||||
>
|
||||
<Ionicons
|
||||
name="refresh-outline"
|
||||
size={16}
|
||||
color={refreshing ? colors.textMuted : colors.accent}
|
||||
/>
|
||||
<Text style={styles.refreshBtnText}>Actualiser</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
}
|
||||
ListEmptyComponent={
|
||||
<Text style={styles.empty}>Aucune commande</Text>
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ function handleRegistrationError(errorMessage: string) {
|
||||
Alert.alert("Push Notification Error", errorMessage);
|
||||
}
|
||||
|
||||
export async function registerForPushNotifications(): Promise<string | undefined> {
|
||||
export async function registerForPushNotifications(): Promise<
|
||||
string | undefined
|
||||
> {
|
||||
if (Platform.OS === "android") {
|
||||
await Notifications.setNotificationChannelAsync("default", {
|
||||
name: "default",
|
||||
@@ -36,14 +38,17 @@ export async function registerForPushNotifications(): Promise<string | undefined
|
||||
}
|
||||
|
||||
if (Device.isDevice) {
|
||||
const { status: existingStatus } = await Notifications.getPermissionsAsync();
|
||||
const { status: existingStatus } =
|
||||
await Notifications.getPermissionsAsync();
|
||||
let finalStatus = existingStatus;
|
||||
if (existingStatus !== "granted") {
|
||||
const { status } = await Notifications.requestPermissionsAsync();
|
||||
finalStatus = status;
|
||||
}
|
||||
if (finalStatus !== "granted") {
|
||||
handleRegistrationError("Permission not granted to get push token for push notification!");
|
||||
handleRegistrationError(
|
||||
"Permission not granted to get push token for push notification!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
const projectId =
|
||||
@@ -64,6 +69,8 @@ export async function registerForPushNotifications(): Promise<string | undefined
|
||||
handleRegistrationError(`${e}`);
|
||||
}
|
||||
} else {
|
||||
handleRegistrationError("Must use physical device for push notifications");
|
||||
handleRegistrationError(
|
||||
"Must use physical device for push notifications",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user