chore: add small loading user feedback

This commit is contained in:
2024-11-17 00:45:48 +01:00
parent 518181eb6b
commit 367365f0e7

View File

@@ -1,16 +1,22 @@
import * as WebBrowser from 'expo-web-browser'
import { useState } from 'react'
import { Pressable, View } from 'react-native'
import { Icon, Text } from 'react-native-paper'
export default function SimpleAttachment(props: Props) {
const [clicked, setClicked] = useState(false)
return (
<Pressable
onPress={async () => {
await WebBrowser.openBrowserAsync(props.link)
setClicked(true)
const browse = await WebBrowser.openBrowserAsync(props.link)
if (browse.type) {
setClicked(false)
}
}}
>
<View className="flex flex-row gap-3 items-center pt-2">
<Icon source="attachment" size={20} />
<Icon source={clicked ? 'dots-horizontal' : 'attachment'} size={20} />
<Text className="text-xl">{props.title}</Text>
</View>
</Pressable>