import React, {Component} from 'react'; import {Alert, StyleSheet} from 'react-native'; import {Navigation} from 'react-native-navigation'; import {Colors, Carousel, PageControl, Modal, View, Text, Assets} from 'react-native-ui-lib'; // eslint-disable-line const BUTTONS_HIT_SLOP = {right: 5, left: 5, top: 10, bottom: 10}; interface ModalScreenProps { componentId: string; } interface State { currentPage: number; } export default class ModalScreen extends Component { static options() { return { topBar: { drawBehind: true, visible: false } }; } constructor(props: ModalScreenProps) { super(props); this.state = { currentPage: 0 }; } closeScreen() { Navigation.pop(this.props.componentId); } render() { return ( this.setState({currentPage})} containerStyle={{flex: 1}}> this.closeScreen()} onDone={() => Alert.alert('done')} doneButtonProps={{ disabled: true }} /> This is an example of a custom modal top bar. By default you get the 'x' cancel icon and 'save' as done label Alert.alert('cancel')} onDone={() => Alert.alert('done')} cancelIcon={null} cancelLabel="back" /> You can of course change it by changing the values of cancelIcon, cancelLabel, doneIcon, doneLabel and other props.. Alert.alert('cancel')} onDone={() => Alert.alert('done')} cancelIcon={null} cancelLabel="back" /> Sending onDone/onCancel is required for rendering done/cancel actions Alert.alert('cancel')} onDone={() => Alert.alert('done')} doneButtonProps={{color: Colors.orange30}} cancelButtonProps={{iconStyle: {tintColor: Colors.orange30}}} /> use doneButtonProps/cancelButtonProps properties to have custom behaviour or style for done/cancel actions Alert.alert('save') }, { icon: Assets.icons.demo.settings, onPress: () => Alert.alert('settings'), buttonProps: {hitSlop: BUTTONS_HIT_SLOP, iconStyle: {tintColor: Colors.yellow10}} } ]} leftButtons={[ { icon: Assets.icons.demo.x, onPress: () => Alert.alert('back'), buttonProps: {hitSlop: BUTTONS_HIT_SLOP, iconStyle: {tintColor: Colors.yellow10}} } ]} /> This is an example for using the rightButtons and leftButtons props for having more than one button each side ); } } const styles = StyleSheet.create({ page: { flex: 1 }, pageControl: { zIndex: 1 }, absoluteContainer: { position: 'absolute', bottom: 20, left: 20, right: 0 } });