MCPcopy Create free account
hub / github.com/expo/examples / takePictureAsync

Function takePictureAsync

with-google-vision/App.js:49–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 const [status, setStatus] = useState(null);
48
49 const takePictureAsync = async () => {
50 const result = await ImagePicker.launchCameraAsync({
51 base64: true,
52 });
53 if (!result.canceled && result.assets && result.assets.length > 0) {
54 const { uri, base64 } = result.assets[0];
55 setImage(uri);
56 setStatus("Loading...");
57 try {
58 const result = await callGoogleVisionAsync(base64);
59 setStatus(result);
60 } catch (error) {
61 console.log(error);
62 setStatus(`Error: ${error.message}`);
63 }
64 } else {
65 setImage(null);
66 setStatus(null);
67 }
68 };
69
70 return (
71 <View style={styles.container}>

Callers

nothing calls this directly

Calls 1

callGoogleVisionAsyncFunction · 0.85

Tested by

no test coverage detected