How can I create a menu like on screenshot for react-native?
you can set backgroundColor: 'rgba(0,0,0,0.2)'.
<Modal
animationType={"slide"}
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {alert("Modal has been closed.")}}
>
<View style={{flex: 1,backgroundColor: 'rgba(0,0,0,0.2)'}}>
<View style ={{flex:1, alignItems: 'center', justifyContent: 'center'}}>
<View style={{backgroundColor: '#ffffff', width: 300, height: 300}}>
<Text>Hello World!</Text>
</View>
<TouchableHighlight
style={{backgroundColor: '#ffffff', width: 300, height: 40, marginTop: 40}}
onPress={() => {this.setModalVisible(!this.state.modalVisible)}}
>
<Text>Hide Modal</Text>
</TouchableHighlight>
</View>
</View>
</Modal>
For iOS in specific there's a component called ActionSheetIOS and you can call it like this:
ActionSheetIOS.showActionSheetWithOptions(
{
options: ["Cancel", ...options],
title: "Select something",
message: "Some description",
cancelButtonIndex: 0
},
index => {
// do something with the selected index
const listIndex = index - 1;
if (index > 0) {
this.setState({ selectedIndex: listIndex });
}
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With