Надеюсь, это поможет вам
import React, { Component } from 'react';
import { View, Text, StyleSheet, Button } from 'react-native';
export default class Home extends Component {
state = {
value: '',
};
onChangeValue = value => {
if (value !== this.state.value) {
this.setState({
value: value,
});
}
};
render() {
return (
<View style={styles.container}>
{this.state.value.length > 0 ? (
<Text
style={{
fontSize: 40,
alignSelf: 'center',
justifyContent: 'center',
}}>
{this.state.value}
</Text>
) : (
<Text
style={{
fontSize: 40,
alignSelf: 'center',
justifyContent: 'center',
}}>
I identify as you
</Text>
)}
<Button
color="#000"
title="Male"
onPress={() => this.onChangeValue('male')}
/>
<Button title="Female" onPress={() => this.onChangeValue('female')} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignContent: 'center',
justifyContent: 'center',
},
});
Не стесняйтесь дудтов.