resetting state after submit (todo: add confirmation message), update posts screen after aprove or deny

This commit is contained in:
Will Baumbach
2025-08-05 10:22:48 -05:00
parent e49674a755
commit 813cb44637
7 changed files with 107 additions and 37 deletions

View File

@@ -9,6 +9,12 @@ export default function App() {
const [notes, setNotes] = useState('')
const cameraRef = useRef<CameraView>(null)
async function resetState() {
setPhoto('')
setAddress('')
setNotes('')
}
async function _takePhoto() {
if (cameraRef.current) {
let pic = await cameraRef.current.takePictureAsync({
@@ -34,6 +40,11 @@ export default function App() {
address,
notes
})
}).then((res) => {
console.log(res.status)
if (res.status === 200) {
resetState()
}
})
}
@@ -78,7 +89,7 @@ export default function App() {
/>
</View>
<View style={styles.buttonContainer}>
<TouchableOpacity style={styles.button} onPress={() => setPhoto('')}>
<TouchableOpacity style={styles.button} onPress={() => resetState()}>
<Text style={styles.text}>Retake</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={sendData}>