import React, {createRef} from 'react'; import {Modal, TouchableOpacity, View} from 'react-native'; import * as Animatable from 'react-native-animatable'; import {normalize} from '../../common/common'; import {ACTIONS} from '../../provider/actions'; import {eSendEvent} from '../../services/eventManager'; import {eLoginDialogNavigateBack, eSetModalNavigator} from '../../services/events'; import {getElevation, DDS} from '../../utils/utils'; import ForgotPassword from '../../views/ForgotPassword'; import Login from '../../views/Login'; import Signup from '../../views/Signup'; import {updateEvent} from '../DialogManager/recievers'; import {NavigationContainer} from '@react-navigation/native'; import {createStackNavigator} from '@react-navigation/stack'; import Container from '../Container'; const Stack = createStackNavigator(); const modalNavigatorRef2 = createRef(); const ModalNavigator = ({onStateChange}) => { return ( ); }; class LoginDialog extends React.Component { constructor(props) { super(props); this.state = { visible: false, animated: false, }; this.routeIndex = 0; this.count = 0; } open() { updateEvent({type: ACTIONS.LOGIN_NAVIGATOR, enabled: true}); this.setState({ visible: true, }); } close() { this.setState({ visible: false, animated: false, }); } render() { const {visible, animated} = this.state; const {colors} = this.props; return ( { eSendEvent(eSetModalNavigator, true); this.setState({ animated: true, }); }} onRequestClose={() => { if (!this.routeIndex || this.routeIndex === 0) { updateEvent({type: ACTIONS.LOGIN_NAVIGATOR, enabled: false}); eSendEvent(eSetModalNavigator, false); this.close(); } else { eSendEvent(eLoginDialogNavigateBack); } }} visible={visible} transparent={true}> this.close()} style={{ width: '100%', height: '100%', position: 'absolute', zIndex: 1, }} /> { this.routeIndex = event.index; }} /> ); } } export default LoginDialog;