I use react-native
.
I have TouchableOpacity
named SmallButton below.
and if you see onPress
, I give handleSubmit
when it is pressed.
<SmallButton
styleB={{ backgroundColor: `${colors.normal}` }}
styleBT={{ color: `${colors.lightgray}`, fontSize: 20 }}
text={"확인"}
onPress={handleSubmit(EditValid)} // want to add navigate.goBack()
/>
it works well.
but my question is I want to navigate.goBack()
after handleSubmit
.
But don't know how.
First I wanted to make one function like
const onClick = () => {
handleSubmit(EditValid);
navigation.goBack()
}
then onPress={onClick}
.
but of course since handleSubmit
is not a function
, this handleSubmit doesn't work.
How to make it work handleSubmit and navigation both in 1 onPress?
CodePudding user response:
I am assuming EditValid is a custom function made by you, so you can call navigation.goBack() in it.