I have two screens. Screen A and Screen B, Screen A is Parent component and from screen A. I am navigating to Screen B. In screen A I have 3 buttons. and on each click of button screen B will open. and there is form in screen B. on the submit of that form I want that. the first button in screen A will have to green. the same for button 2. on click of button 2 second form will open and then on the submit of second form second button will be green. So pleas help.
here is my screen A code
import { TouchableOpacity, View } from "react-native";
export default class patientReadings extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<View>
<TouchableOpacity
onPress={() => this.props.navigation.navigate("medicalinputs")}
>
button 1
</TouchableOpacity>
<TouchableOpacity
onPress={() => this.props.navigation.navigate("medicalinputs")}
>
button 2
</TouchableOpacity>
<TouchableOpacity
onPress={() => this.props.navigation.navigate("medicalinputs")}
>
button 3
</TouchableOpacity>
</View>
);
}
}
here is screen B
export default class medicalInput extends React.Component {
constructor(props) {
super(props);
this.myRef = React.createRef();
this.state = {};
}
validateInputs = (event) => {
fetch("api", {
method: "POST",
headers: {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",
},
body: JSON.stringify([
{
data,
},
]),
})
.then((returnValue) => returnValue.json())
.then((response) => {
console.log(response);
this.props.navigation.navigate("patientReadings");
});
};
render() {
return (
<TouchableOpacity
onPress={() => this.validateInputs()}
></TouchableOpacity>
);
}
}