This component will fade in/out an overlay and will pop in a modal with a cancel button. You can pass any view that you want to the component and it will be shown in the modal. In the example below I am passing a date picker.
npm install react-native-custom-action-sheet --save
var CustomActionSheet = require('react-native-custom-action-sheet');
var SomeComponent = React.createClass({
render: function() {
return (
<View>
<CustomActionSheet modalVisible={this.state.modalVisible} onCancel={this.toggleModal}>
<View style={styles.datePickerContainer}>
<DatePickerIOS mode={"date"} date={@state.dateForPicker} onDateChange={@dateChanged} />
</View>
</CustomActionSheet>
</View>
);
}
});
modalVisible
(Boolean) - Decide if the component should be visible or not.onCancel
(Function) - Function to run when the cancel button/background has been pressed.buttonText
(String) - The text of the onCancel button. Defaults to Cancel.backgroundColor
(String) - The color of the fade-in effect background. Defaults to 'black'.
Feel free to open an issue on github, send suggestions, fork this repository or contact me at eyal.eizenberg@samanage.com
This package was developed during my work at Samanage.
Thanks and Enjoy! :)