Skip to content

Commit 7c1fa69

Browse files
committed
feat(rn-profile): update profile share
Signed-off-by: Innei <tukon479@gmail.com>
1 parent a031ac3 commit 7c1fa69

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

apps/mobile/src/modules/settings/routes/Profile.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { FeedViewType } from "@follow/constants"
22
import { cn } from "@follow/utils"
33
import { Stack } from "expo-router"
44
import { Fragment, useCallback, useEffect, useMemo } from "react"
5-
import { FlatList, Image, Linking, Pressable, StyleSheet, Text, View } from "react-native"
5+
import { FlatList, Image, Share, StyleSheet, Text, TouchableOpacity, View } from "react-native"
66
import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated"
77
import { useSafeAreaInsets } from "react-native-safe-area-context"
88

@@ -51,8 +51,12 @@ export const ProfileScreen = () => {
5151
const textLabelColor = useColor("label")
5252
const openShareUrl = useCallback(() => {
5353
if (!whoami?.id) return
54-
Linking.openURL(`https://app.follow.is/share/users/${whoami.id}`)
55-
}, [whoami?.id])
54+
Share.share({
55+
url: `https://app.follow.is/share/users/${whoami.id}`,
56+
title: `Follow | ${whoami.name}'s Profile`,
57+
})
58+
}, [whoami?.id, whoami?.name])
59+
5660
return (
5761
<View className="bg-system-grouped-background flex-1">
5862
<ReAnimatedScrollView
@@ -68,35 +72,39 @@ export const ProfileScreen = () => {
6872
{!isLoading && subscriptions && <SubscriptionList subscriptions={subscriptions.data} />}
6973
</ReAnimatedScrollView>
7074
{/* Top transparent header buttons */}
71-
<Pressable
75+
<TouchableOpacity
7276
onPress={() => settingNavigation.goBack()}
7377
className="absolute left-4"
7478
style={{ top: insets.top }}
7579
>
7680
<MingcuteLeftLineIcon color="#fff" />
77-
</Pressable>
81+
</TouchableOpacity>
7882

79-
<Pressable onPress={openShareUrl} className="absolute right-4" style={{ top: insets.top }}>
83+
<TouchableOpacity
84+
onPress={openShareUrl}
85+
className="absolute right-4"
86+
style={{ top: insets.top }}
87+
>
8088
<Share3CuteReIcon color="#fff" />
81-
</Pressable>
89+
</TouchableOpacity>
8290
{/* Header */}
8391
<Animated.View
8492
pointerEvents="none"
8593
className="border-b-hairline border-opaque-separator absolute inset-x-0 top-0 flex-row items-center px-4 pb-2 pt-safe"
8694
style={{ opacity: headerOpacity }}
8795
>
8896
<BlurEffect />
89-
<Pressable pointerEvents="auto" onPress={() => settingNavigation.goBack()}>
97+
<TouchableOpacity pointerEvents="auto" onPress={() => settingNavigation.goBack()}>
9098
<MingcuteLeftLineIcon color={textLabelColor} />
91-
</Pressable>
99+
</TouchableOpacity>
92100

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

97-
<Pressable onPress={openShareUrl}>
105+
<TouchableOpacity onPress={openShareUrl}>
98106
<Share3CuteReIcon color={textLabelColor} />
99-
</Pressable>
107+
</TouchableOpacity>
100108
</Animated.View>
101109
</View>
102110
)

0 commit comments

Comments
 (0)