[V2][IOS] Alerts are not showing up after dissmissOverlay has been called.
Issue Description
When dissmissOverlay is called , it screws up something in the screen order so that alerts show up behind your application and is thus not visible. This only happens in the IOS Simulator.
Steps to Reproduce / Code Snippets / Screenshots
- setup a new react-native project with react-native-navigation
- create 2 js files with these names: MainScreen and Overlay
- paste below code into the 3 js files.
- run-ios and click "Show Alert" button to see that the alert shows up.
- click "show overlay" and then click "close overlay"
- click "Show Alert" button again to see that its now not showing the alert
App.js
import { Navigation } from 'react-native-navigation';
import MainScreen from "./MainScreen";
import SomeOverlay from "./SomeOverlay";
Navigation.registerComponent("main_screen", () => MainScreen);
Navigation.registerComponent("some_overlay", () => SomeOverlay);
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: "main-screen"
}
}
});
});
MainScreen.js
import React, {Component} from 'react';
import {View, Text, StyleSheet, Button, Alert} from 'react-native';
import {Navigation} from 'react-native-navigation';
export default class MainScreen extends Component {
render() {
return (
<View style={{flex:1, justifyContent: "center", alignItems: "center"}}>
<Button onPress={() => {Alert.alert("--Alert--")}} title="Show Alert" color="#841584"/>
<Button onPress={() => {this.openOverlay()}} title="Show Overlay" color="#841584"/>
</View>
)
}
openOverlay(){
Navigation.showOverlay({
component: {
name: 'overlay'
}
});
}
}
SomeOverlay.js
import React, {Component} from 'react';
import {View, Text, StyleSheet, Button} from 'react-native';
import {Navigation} from 'react-native-navigation';
export default class SomeOverlay extends Component {
render() {
return (
<View style={{flex:1, justifyContent: "center", alignItems: "center", backgroundColor:"#000"}}>
<Text>This is an Overlay</Text>
<Button onPress={() => {this.closeOverlay()}} title="Close Overlay" color="#841584"/>
</View>
)
}
closeOverlay(){
Navigation.dismissOverlay(this.props.componentId);
}
}
Environment
- React Native Navigation version: 2.0.2578
- React Native version: 0.57.2
- Platform: IOS, havent tested Android
- Device info: Debug, Simulator
We have the same problem. It's not just the alerts, native components such as share modals are not working as well.
@orkanylmz Which version of RNN are you using?
@guyca React native version = 0.57.1, RNN = https://github.com/abdullah-sr/react-native-navigation#build, this fork
@orkanylmz Try upgrading to latest version of RNN and see if it reproduces. We've done some work related to Overlays and alerts.
@guyca Does the latest version master support 0.57.1 ?
master is still on v1 which isn't supported. v2 can be found in v2 branch and it supports 0.57.x
We're still experiencing this after upgrading to 2.1.3 with RNN and RN 0.55. For us, it's happening on a device too. If we dismissOverlay before Alert.alert, then the overlay disappears and the alert is shown. But if we Alert.alert, then dismissOverlay, the alert is never shown.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
this is still a problem in v 2.4.0 of RNN
this is still a problem in v 3.2.0 of RNN