feat(mobile): improve navigation and UI components

- Add NavigationHeaderBackButton component
- Adjust SafeNavigationScrollView scroll and inset settings
- Update TimelineSelectorProvider header actions
- Change delete account text color to red
- Modify EntryTitle padding

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-02-27 14:28:42 +08:00
parent 8caafbd769
commit cbe4149bf5
5 changed files with 31 additions and 15 deletions
@@ -73,6 +73,12 @@ export const SafeNavigationScrollView: FC<SafeNavigationScrollViewProps> = ({
onScroll={RNAnimated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
useNativeDriver: true,
})}
automaticallyAdjustContentInsets={false}
automaticallyAdjustsScrollIndicatorInsets={false}
scrollIndicatorInsets={{
top: headerHeight,
bottom: tabBarHeight,
}}
{...props}
>
<View style={{ height: headerHeight - (withTopInset ? insets.top : 0) }} />
@@ -98,8 +104,6 @@ export const NavigationBlurEffectHeader = ({
headerHideableBottom?: () => React.ReactNode
headerTitleAbsolute?: boolean
}) => {
const label = useColor("label")
const canBack = useNavigation().canGoBack()
const navigationContext = useContext(NavigationContext)!
@@ -115,15 +119,7 @@ export const NavigationBlurEffectHeader = ({
headerTransparent: true,
headerShown: true,
headerLeft:
headerLeft ??
(canBack
? () => (
<TouchableOpacity hitSlop={10} onPress={() => router.back()}>
<MingcuteLeftLineIcon height={20} width={20} color={label} />
</TouchableOpacity>
)
: undefined),
headerLeft: headerLeft ?? (canBack ? () => <NavigationHeaderBackButton /> : undefined),
header: useTypeScriptHappyCallback(
({ options }) => (
@@ -151,3 +147,15 @@ export const NavigationBlurEffectHeader = ({
/>
)
}
export const NavigationHeaderBackButton = () => {
return <NavigationHeaderBackButtonImpl />
}
const NavigationHeaderBackButtonImpl = () => {
const label = useColor("label")
return (
<TouchableOpacity hitSlop={10} onPress={() => router.back()}>
<MingcuteLeftLineIcon height={20} width={20} color={label} />
</TouchableOpacity>
)
}
@@ -12,6 +12,7 @@ interface UIBarButtonProps extends PressableProps {
overlay?: boolean
}
export const UIBarButton = ({
normalIcon,
selectedIcon,
@@ -106,7 +106,7 @@ export const EntryTitle = ({ title, entryId }: { title: string; entryId: string
setTitleHeight(titleHeight)
}}
>
<Text className="text-label px-2 text-4xl font-bold leading-snug">{title}</Text>
<Text className="text-label px-4 text-4xl font-bold leading-snug">{title}</Text>
</View>
</>
)
@@ -4,7 +4,10 @@ import { Share, useAnimatedValue, View } from "react-native"
import { useColor } from "react-native-uikit-colors"
import { NavigationContext } from "@/src/components/layouts/views/NavigationContext"
import { NavigationBlurEffectHeader } from "@/src/components/layouts/views/SafeNavigationScrollView"
import {
NavigationBlurEffectHeader,
NavigationHeaderBackButton,
} from "@/src/components/layouts/views/SafeNavigationScrollView"
import { UIBarButton } from "@/src/components/ui/button/UIBarButton"
import { TIMELINE_VIEW_SELECTOR_HEIGHT } from "@/src/constants/ui"
import { Share3CuteReIcon } from "@/src/icons/share_3_cute_re"
@@ -41,7 +44,11 @@ export function TimelineSelectorProvider({ children }: { children: React.ReactNo
<HomeLeftAction />
</View>
)
: undefined,
: () => (
<View style={{ width: HEADER_ACTIONS_GROUP_WIDTH }}>
<NavigationHeaderBackButton />
</View>
),
[isTimeline, isSubscriptions],
)}
headerRight={useMemo(() => {
@@ -30,7 +30,7 @@ export const AccountScreen = () => {
await expo.reloadAppAsync("User sign out")
}}
>
<Text className="text-label">Delete account</Text>
<Text className="text-red">Delete account</Text>
</TouchableOpacity>
</GroupedInsetListBaseCell>
</GroupedInsetListCard>