import React from 'react'; import * as ImagePicker from 'expo-image-picker'; import { Center, Icon, Pressable, Image } from 'native-base'; import Unicons from '../Unicons'; import { GestureResponderEvent, StyleSheet } from 'react-native'; interface AvatarProps { uri?: string; colorType?: "dark" | "light"; onImagePicked: (uri: string) => void; } export default function Avatar(props: AvatarProps) { const width = "112px"; const height = "112px"; const pickImage = async () => { // No permissions request is necessary for launching the image library let result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.All, quality: 1, }); if (!result.cancelled) { props.onImagePicked(result.uri); } }; return
{!!props.uri ? <> Avatar : }
} function EditButton({ onPress }: { onPress?: (e: GestureResponderEvent) => void}) { const [pressed, setPressed] = React.useState(false); return setPressed(true)} onPressOut={() => setPressed(false)} onPress={onPress} style={{ position: 'absolute', bottom: 0, right: 0, opacity: pressed ? 0.7 : 1 }}>
} export function AvatarWorkingPrototype({ type }: { type: "dark" | "light" }) { const [uri, setUri] = React.useState(); return setUri(u)} /> }