resetting state after submit (todo: add confirmation message), update posts screen after aprove or deny
This commit is contained in:
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user