Skip to content

Commit

Permalink
feat(rn-profile): update profile share
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Jan 21, 2025
1 parent a031ac3 commit 7c1fa69
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions apps/mobile/src/modules/settings/routes/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FeedViewType } from "@follow/constants"
import { cn } from "@follow/utils"
import { Stack } from "expo-router"
import { Fragment, useCallback, useEffect, useMemo } from "react"
import { FlatList, Image, Linking, Pressable, StyleSheet, Text, View } from "react-native"
import { FlatList, Image, Share, StyleSheet, Text, TouchableOpacity, View } from "react-native"
import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated"
import { useSafeAreaInsets } from "react-native-safe-area-context"

Expand Down Expand Up @@ -51,8 +51,12 @@ export const ProfileScreen = () => {
const textLabelColor = useColor("label")
const openShareUrl = useCallback(() => {
if (!whoami?.id) return
Linking.openURL(`https://app.follow.is/share/users/${whoami.id}`)
}, [whoami?.id])
Share.share({
url: `https://app.follow.is/share/users/${whoami.id}`,
title: `Follow | ${whoami.name}'s Profile`,
})
}, [whoami?.id, whoami?.name])

return (
<View className="bg-system-grouped-background flex-1">
<ReAnimatedScrollView
Expand All @@ -68,35 +72,39 @@ export const ProfileScreen = () => {
{!isLoading && subscriptions && <SubscriptionList subscriptions={subscriptions.data} />}
</ReAnimatedScrollView>
{/* Top transparent header buttons */}
<Pressable
<TouchableOpacity
onPress={() => settingNavigation.goBack()}
className="absolute left-4"
style={{ top: insets.top }}
>
<MingcuteLeftLineIcon color="#fff" />
</Pressable>
</TouchableOpacity>

<Pressable onPress={openShareUrl} className="absolute right-4" style={{ top: insets.top }}>
<TouchableOpacity
onPress={openShareUrl}
className="absolute right-4"
style={{ top: insets.top }}
>
<Share3CuteReIcon color="#fff" />
</Pressable>
</TouchableOpacity>
{/* Header */}
<Animated.View
pointerEvents="none"
className="border-b-hairline border-opaque-separator absolute inset-x-0 top-0 flex-row items-center px-4 pb-2 pt-safe"
style={{ opacity: headerOpacity }}
>
<BlurEffect />
<Pressable pointerEvents="auto" onPress={() => settingNavigation.goBack()}>
<TouchableOpacity pointerEvents="auto" onPress={() => settingNavigation.goBack()}>
<MingcuteLeftLineIcon color={textLabelColor} />
</Pressable>
</TouchableOpacity>

<Text className="text-label flex-1 text-center text-lg font-medium">
{whoami?.name}'s Profile
</Text>

<Pressable onPress={openShareUrl}>
<TouchableOpacity onPress={openShareUrl}>
<Share3CuteReIcon color={textLabelColor} />
</Pressable>
</TouchableOpacity>
</Animated.View>
</View>
)
Expand Down

0 comments on commit 7c1fa69

Please sign in to comment.