feat(mobile): rework settings layout #136
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -87,15 +87,34 @@ export default function AppLayout() {
|
||||
<Stack.Screen
|
||||
name="settings"
|
||||
options={{
|
||||
headerShown: Platform.OS === "android",
|
||||
// iOS gets a native header with a close button; Android
|
||||
// draws its own title bar in the screen.
|
||||
headerShown: Platform.OS === "ios",
|
||||
title: "Settings",
|
||||
headerLargeTitle: false,
|
||||
headerTransparent: false,
|
||||
headerShadowVisible: false,
|
||||
headerStyle: { backgroundColor: "#000" },
|
||||
// Matches the inline title size of Apple Music's settings.
|
||||
headerTitleStyle: { fontSize: 20, fontWeight: "700" },
|
||||
presentation:
|
||||
Platform.OS === "ios" ? "modal" : "fullScreenModal",
|
||||
animation: "slide_from_bottom",
|
||||
gestureEnabled: true,
|
||||
gestureDirection: "vertical",
|
||||
}}
|
||||
/>
|
||||
>
|
||||
{/* Stack.Toolbar forces the header on, so keep it iOS-only. */}
|
||||
{Platform.OS === "ios" ? (
|
||||
<Stack.Toolbar placement="right">
|
||||
<Stack.Toolbar.Button
|
||||
icon="xmark"
|
||||
accessibilityLabel="Close settings"
|
||||
onPress={() => router.back()}
|
||||
/>
|
||||
</Stack.Toolbar>
|
||||
) : null}
|
||||
</Stack.Screen>
|
||||
<Stack.Screen
|
||||
name="create-account"
|
||||
options={{
|
||||
|
||||
@@ -1,16 +1 @@
|
||||
import { Platform } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
|
||||
import SettingsScreen from "./(tabs)/home/settings"
|
||||
|
||||
export default function Settings() {
|
||||
if (Platform.OS !== "android") return <SettingsScreen />
|
||||
return (
|
||||
<SafeAreaView
|
||||
edges={["bottom", "left", "right"]}
|
||||
style={{ flex: 1, backgroundColor: "#000" }}
|
||||
>
|
||||
<SettingsScreen />
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
export { default } from "./(tabs)/home/settings"
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Button, Host } from "@expo/ui/swift-ui"
|
||||
import {
|
||||
buttonBorderShape,
|
||||
buttonStyle,
|
||||
controlSize,
|
||||
labelStyle,
|
||||
} from "@expo/ui/swift-ui/modifiers"
|
||||
|
||||
/** A native SwiftUI glass "+" button, matching the iOS header close button. */
|
||||
export function AddButton({
|
||||
label,
|
||||
onPress,
|
||||
}: {
|
||||
label: string
|
||||
onPress: () => void
|
||||
}) {
|
||||
return (
|
||||
<Host matchContents>
|
||||
<Button
|
||||
label={label}
|
||||
systemImage="plus"
|
||||
onPress={onPress}
|
||||
modifiers={[
|
||||
labelStyle("iconOnly"),
|
||||
buttonStyle("glass"),
|
||||
buttonBorderShape("circle"),
|
||||
controlSize("large"),
|
||||
]}
|
||||
/>
|
||||
</Host>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import { Pressable } from "react-native"
|
||||
|
||||
import { useThemeColors } from "@/lib/theme"
|
||||
|
||||
/** A plain "+" icon button. iOS uses a native SwiftUI button instead. */
|
||||
export function AddButton({
|
||||
label,
|
||||
onPress,
|
||||
}: {
|
||||
label: string
|
||||
onPress: () => void
|
||||
}) {
|
||||
const colors = useThemeColors()
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={label}
|
||||
hitSlop={8}
|
||||
onPress={onPress}
|
||||
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
|
||||
>
|
||||
<Ionicons name="add" size={32} color={colors.foreground} />
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user