fix(mobile): fix unreachable back button on subscription screen
Missing safe-area top inset pushed the header (back arrow + title) up under the status bar/notch, overlapping the clock and making the button effectively untappable. Also falls back to router.replace when there's no back history instead of silently no-op'ing.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import { ActivityIndicator, Alert, Pressable, ScrollView, Text, View } from "react-native";
|
import { ActivityIndicator, Alert, Pressable, ScrollView, Text, View } from "react-native";
|
||||||
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import type { CustomerInfo, PurchasesOffering, PurchasesPackage } from "react-native-purchases";
|
import type { CustomerInfo, PurchasesOffering, PurchasesPackage } from "react-native-purchases";
|
||||||
import Purchases from "react-native-purchases";
|
import Purchases from "react-native-purchases";
|
||||||
@@ -8,6 +9,7 @@ import { getActiveRestaurant } from "@/lib/active-restaurant";
|
|||||||
import { configurePurchases, getCurrentOffering, getCustomerInfo, isProActive, PRO_ENTITLEMENT_ID } from "@/lib/purchases";
|
import { configurePurchases, getCurrentOffering, getCustomerInfo, isProActive, PRO_ENTITLEMENT_ID } from "@/lib/purchases";
|
||||||
|
|
||||||
export default function SubscriptionScreen() {
|
export default function SubscriptionScreen() {
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [offering, setOffering] = useState<PurchasesOffering | null>(null);
|
const [offering, setOffering] = useState<PurchasesOffering | null>(null);
|
||||||
const [customerInfo, setCustomerInfo] = useState<CustomerInfo | null>(null);
|
const [customerInfo, setCustomerInfo] = useState<CustomerInfo | null>(null);
|
||||||
@@ -83,9 +85,16 @@ export default function SubscriptionScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{ flex: 1, backgroundColor: "#FAF8F5" }} contentContainerStyle={{ padding: 20, gap: 16 }}>
|
<ScrollView
|
||||||
|
style={{ flex: 1, backgroundColor: "#FAF8F5" }}
|
||||||
|
contentContainerStyle={{ padding: 20, paddingTop: insets.top + 12, gap: 16 }}
|
||||||
|
>
|
||||||
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
||||||
<Pressable onPress={() => router.back()} style={{ padding: 4 }}>
|
<Pressable
|
||||||
|
onPress={() => (router.canGoBack() ? router.back() : router.replace("/account"))}
|
||||||
|
hitSlop={12}
|
||||||
|
style={{ padding: 8 }}
|
||||||
|
>
|
||||||
<Ionicons name="arrow-back" size={22} color="#1C1917" />
|
<Ionicons name="arrow-back" size={22} color="#1C1917" />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<Text style={{ fontSize: 22, fontWeight: "800", color: "#1C1917" }}>Abonelik</Text>
|
<Text style={{ fontSize: 22, fontWeight: "800", color: "#1C1917" }}>Abonelik</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user