импорт React, {useState} из "реакции"; import {StyleSheet, Text, View, TouchableOpacity} из "act-native ";
const DifficultScreen = (props) => {
const [activeBtn, setActiveBtn] = useState(styles.btnRed);
const confirmHandler = () => {
setActiveBtn(styles.btnGreen);
};
return (
<View>
<View style={styles.container}>
<Text style={styles.title}>Difficult screen is showing</Text>
</View>
<View>
<TouchableOpacity onPress={confirmHandler} style={activeBtn}>
<Text>Confirm</Text>
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: activeBtn,
alignItems: "center",
justifyContent: "center",
width: "100%",
height: 90,
padding: 35,
},
title: {
color: "black",
fontSize: 18,
},
btnRed: {
color: "black",
padding: "10%",
backgroundColor: "white",
borderRadius: "5px",
alignSelf: "center",
textAlign: "center",
margin: "5%",
},
btnGreen: {
color: "green",
padding: "10%",
backgroundColor: "white",
borderRadius: "5px",
alignSelf: "center",
textAlign: "center",
margin: "5%",
},
});
export default DifficultScreen;