({onChoose}: ChooseImageButtonProps)
| 13 | } |
| 14 | |
| 15 | const ChooseImageButton = ({onChoose}: ChooseImageButtonProps) => { |
| 16 | const handlePress = async () => { |
| 17 | const imageResult = await ImagePicker.launchImageLibraryAsync(); |
| 18 | if (imageResult.canceled) { |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | const asset = imageResult.assets![0]; |
| 23 | const currentImage = { |
| 24 | path: asset.uri, |
| 25 | width: asset.width, |
| 26 | height: asset.height, |
| 27 | }; |
| 28 | |
| 29 | onChoose(currentImage); |
| 30 | }; |
| 31 | |
| 32 | return <Button title="Choose an Image" onPress={handlePress} />; |
| 33 | }; |
| 34 | |
| 35 | export default ChooseImageButton; |
nothing calls this directly
no outgoing calls
no test coverage detected