Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save danielglans/3d5785eb25ee456f9ccb2e1dca2478fd to your computer and use it in GitHub Desktop.

Select an option

Save danielglans/3d5785eb25ee456f9ccb2e1dca2478fd to your computer and use it in GitHub Desktop.
class HomeView extends React.Component {
state = {
modalVisible: false
};
setModalVisible = visible => {
this.setState({ modalVisible: visible });
};
render() {
return (
<Background>
<Container onButtonPress={this.setModalVisible} />
<Modal
animationType="slide"
transparent={false}
visible={this.state.modalVisible}
>
<View style={{ marginTop: 30 }}>
<View>
<Text>Please set the time</Text>
</View>
<CloseModal
onButtonClosePress={this.setModalVisible}
style={{ flex: 1 }}
text="Close Modal"
/>
</View>
</Modal>
</Background>
);
}
}
class CloseModal extends React.Component {
render() {
console.log(this.props);
return (
<TouchableHighlight
onPress={this.props.onButtonClosePress}
style={{
width: "80%",
padding: 10,
justifyContent: "center",
backgroundColor: "#2196F3",
borderRadius: 50
}}
>
<Text
style={{
color: "white",
textAlign: "center"
}}
>
{this.props.text}
</Text>
</TouchableHighlight>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment