I have an application and I would like to have certain navigation routes display modals over the current page when the user clicks them as opposed to navigating to an entirely different page. My existing code is:
const DrawerNavigator = () => {
return (
<Drawer.Navigator>
<Drawer.Screen name="My Porfolio" component={Portfolio} />
<Drawer.Screen name="Account" component={Account} />
<Drawer.Screen name="NBA" component = {NBALobby} />
<Drawer.Screen name="NFL" component = {NFLLobby} />
<Drawer.Screen name="How To Play" component = {HowToPlayModal} />
</Drawer.Navigator>
);
}
My modal displays as expected, however it seems to display over a new, completely blank page. Is there a way to maybe call a function from the Drawer Navigator that would display the modal?
My Modal code is:
import React, { Component, useState } from 'react';
import {Text, TextInput, View, TouchableOpacity} from 'react-native';
import Modal from 'react-native-modal';
import {styles} from '../styles/signUpIn';
const HowToPlayModal = () => {
return(
<Modal isVisible = {true}>
<View style={styles.container2}>
<View style={{flexDirection: 'row'}}>
<Text style={styles.title}>How To Play</Text>
<View style= {{flex:1, alignItems: 'flex-end'}}>
<Text style={[styles.fieldTitle, {marginLeft: 0}]}>Remember?</Text>
<Text style={styles.accent} >Sign In</Text>
</View>
</View>
</View>
</Modal>
);
}
export default HowToPlayModal;