mirror of
https://github.com/hanzo-io/chat.git
synced 2026-10-30 18:57:58 +00:00
* feat: Camera functionality and UI changes * chore: moved all buttons to Buttons folder * chore: add back comments --------- Co-authored-by: Nikhil Kothari <[email protected]>
33 lines
920 B
TypeScript
33 lines
920 B
TypeScript
import ShareIcon from "@assets/icons/ShareIcon.svg"
|
|
import { toast } from 'sonner-native'
|
|
import { useColorScheme } from "@hooks/useColorScheme"
|
|
import { SvgProps } from "react-native-svg"
|
|
import useFileShare from "@hooks/useFileShare"
|
|
import { TouchableOpacity } from "react-native-gesture-handler"
|
|
|
|
interface ShareButtonProps {
|
|
uri: string
|
|
iconProps?: SvgProps
|
|
}
|
|
|
|
const ShareButton = ({ uri, iconProps }: ShareButtonProps) => {
|
|
|
|
const { colors } = useColorScheme()
|
|
|
|
const { shareFile, loading, error } = useFileShare(uri)
|
|
|
|
const handleShare = () => {
|
|
shareFile()
|
|
if (error) {
|
|
toast.error(error)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<TouchableOpacity hitSlop={10} className="m-4" onPress={handleShare} disabled={loading} >
|
|
<ShareIcon height={20} width={20} color={colors.icon} {...iconProps} />
|
|
</TouchableOpacity>
|
|
)
|
|
}
|
|
|
|
export default ShareButton |