facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
116.98k stars 24.06k forks source link

NSInvalidArgumentException __76-[RCTModalHostViewManager presentModalHostView:withViewController:animated:]_block_invoke.38 Application tried to present modally a view controller <RCTModalHostViewController: 0x7fcf53855110> that is already being presented by <UIViewController: 0x7fcf4791 #44612

Open gkasireddy202 opened 1 month ago

gkasireddy202 commented 1 month ago

Description

App is crashed and showing below error. NSInvalidArgumentException __76-[RCTModalHostViewManager presentModalHostView:withViewController:animated:]_block_invoke.38 Application tried to present modally a view controller <RCTModalHostViewController: 0x7fcf53855110> that is already being presented by <UIViewController: 0x7fcf4791

Steps to reproduce

react-native run-ios

React Native Version

0.73.7

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.2.1
  CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Memory: 572.45 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.3
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.03.13.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/gopi/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "23"
      - "24"
      - "25"
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.3
      - 33.0.1
      - 34.0.0
    System Images:
      - android-29 | Google APIs Intel x86 Atom
      - android-29 | Google Play Intel x86 Atom
      - android-30 | Google APIs Intel x86 Atom
      - android-32 | Google APIs Intel x86 Atom_64
      - android-32 | Google Play Intel x86 Atom_64
      - android-33 | Google APIs Intel x86 Atom_64
      - android-33 | Google Play Intel x86 Atom_64
    Android NDK: Not Found
IDEs:
  Android Studio: 2021.2 AI-212.5712.43.2112.8609683
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/gopi/.rvm/rubies/ruby-2.7.6/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.7
    wanted: 0.73.7
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

NSInvalidArgumentException __76-[RCTModalHostViewManager presentModalHostView:withViewController:animated:]_block_invoke.38 Application tried to present modally a view controller <RCTModalHostViewController: 0x7fcf53855110> that is already being presented by <UIViewController: 0x7fcf4791

Reproducer

https://github.com/gopikrishnacse55/UIExample.git

Screenshots and Videos

No response

github-actions[bot] commented 1 month ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
github-actions[bot] commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
gkasireddy202 commented 1 month ago

"dependencies": { "@bam.tech/react-native-image-resizer": "^3.0.7", "@bugsnag/react-native": "^7.20.2", "@el173/react-native-passcode-auth": "^1.0.1", "@ismnoiet/react-native-dropdown": "0.0.2", "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-community/datetimepicker": "^3.5.2", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^5.9.10", "@react-native-community/toolbar-android": "0.1.0-rc.2", "@react-native-cookies/cookies": "^6.2.1", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "accounting": "^0.4.1", "axios": "^0.21.4", "base-64": "^1.0.0", "buffer": "^6.0.3", "create-react-class": "^15.7.0", "expo": "^50.0.17", "expo-local-authentication": "^13.8.0", "install": "^0.13.0", "intl": "^1.2.5", "mock-async-storage": "^2.2.0", "mockstorage": "^0.1.4", "moment": "^2.30.1", "moment-timezone": "^0.5.43", "native-base": "^2.15.2", "pdf-to-base64": "^1.0.3", "querystring": "^0.2.1", "react": "18.2.0", "react-dom": "^18.2.0", "react-native": "0.73.7", "react-native-alert-pro": "^1.1.2", "react-native-calendar-events": "^2.2.0", "react-native-calendars": "^1.1303.0", "react-native-device-info": "^7.4.0", "react-native-dialog": "^6.2.0", "react-native-document-picker": "^4.3.0", "react-native-drop-down-item": "^1.1.0", "react-native-elements": "^2.3.2", "react-native-file-viewer": "^2.1.5", "react-native-floating-label-text-image-input": "^1.0.1", "react-native-floating-labels": "^1.1.9", "react-native-fs": "^2.20.0", "react-native-geocoding": "^0.4.0", "react-native-geolocation-service": "^5.3.1", "react-native-gesture-handler": "^2.16.2", "react-native-google-maps-directions": "^2.1.1", "react-native-htmlview": "^0.16.0", "react-native-image-base64": "^0.1.4", "react-native-image-crop-picker": "^0.40.3", "react-native-image-progress": "1.1.1", "react-native-indicators": "^0.17.0", "react-native-keychain": "^8.2.0", "react-native-localize": "^2.2.6", "react-native-maps": "^0.27.1", "react-native-material-dropdown": "github:harshitjee/react-native-material-dropdown", "react-native-material-menu": "^1.2.0", "react-native-modal": "^13.0.1", "react-native-modal-datetime-picker": "^11.0.0", "react-native-navigation-directions": "^1.0.4", "react-native-open-maps": "^0.3.6", "react-native-openanything": "0.0.6", "react-native-orientation": "^3.1.3", "react-native-permissions": "^3.10.1", "react-native-popup-dialog": "^0.18.3", "react-native-progress": "^4.1.2", "react-native-read-more-text": "^1.1.2", "react-native-reanimated": "^3.11.0", "react-native-responsive-fontsize": "^0.5.1", "react-native-safe-area-context": "^4.10.1", "react-native-scoped-storage": "^1.9.2", "react-native-screens": "^3.31.1", "react-native-sectioned-multi-select": "^0.10.0", "react-native-signature-capture": "^0.4.12", "react-native-simple-radio-button": "^2.7.4", "react-native-splash-screen": "^3.3.0", "react-native-sqlite-storage": "^6.0.1", "react-native-super-grid": "^4.6.1", "react-native-svg": "^12.1.1", "react-native-tab-view": "^2.16.0", "react-native-textarea": "^1.0.4", "react-native-vector-icons": "^10.0.3", "react-native-whc-toast": "^1.0.0", "react-navigation": "^4.4.4", "react-navigation-drawer": "^2.7.2", "react-navigation-stack": "^2.10.4", "react-navigation-tabs": "^2.11.2", "rn-fetch-blob": "^0.12.0", "uninstall": "0.0.0", "utf8": "^3.0.0" },

cortinico commented 1 month ago

gopikrishnacse55/UIExample.git

How do we trigger the crash?

gkasireddy202 commented 1 month ago

Sorry, my team forgot to provide the issue in github repo.

Loginpage.js import React,{Component} from "react"; import {View,Text,} from 'react-native'; import { CommonActions } from '@react-navigation/native'; class Loginpage extends Component {

constructor(props) {
    super(props);
    this.state = {

    };
  }
handleLogin()
{
    const resetAction =  CommonActions.reset({ index: 0,routes: [ { name: "HomePage" },],})
    this.props.navigation.dispatch(resetAction);
}
render()
{
    return(

        <View style={{flex:1,alignItems:'center',justifyContent:'center'}}>
            <Text onPress={()=>this.handleLogin()}>Login</Text>
        </View>
    )
}

}

export default Loginpage;

HomePage.js import React, { Component } from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; import { CommonActions } from '@react-navigation/native'; import AlertPro from "react-native-alert-pro"; export default class HomePage extends Component { constructor(props) { super(props); this.state = {

};

}

openConfirmationDialog = () => {

this.AlertPro.open();

}

handleLogout() { const resetAction = CommonActions.reset({ index: 0, routes: [ { name:'Loginpage' }, ], }) this.props.navigation.dispatch(resetAction); } render() {

return (

  <View style={{ flex: 1,backgroundColor:'red' }}>

    <TouchableOpacity onPress={()=>this.openConfirmationDialog()}style={{flex:1,alignItems:'center',justifyContent:'center'}}>
      <Text>Logout</Text>
    </TouchableOpacity>
    <AlertPro
      ref={ref => {
        this.AlertPro = ref;
      }}
      title="Logout"
      message="Do you want to Logout ?"
      textCancel="No"
      textConfirm="Yes"
      onConfirm={() => this.handleLogout()}
      onCancel={() => this.AlertPro.close()}
      customStyles={{

        mask: {
          backgroundColor: "rgba(0, 0, 0, 0.6)"
        },
        container: {
          borderWidth: 1,
          borderColor: "#E6E6E6",
          width: 300,
        },
        buttonCancel: {
          backgroundColor:'#5E4D46'

        },
        buttonConfirm: {
          backgroundColor:'#5E4D46'
        }
      }}
    />
  </View>
);

} }

https://github.com/facebook/react-native/assets/90603484/fc10614c-e2b3-4279-b56b-16a85c20a726

testloancare commented 1 month ago

Facing same issue Please let me know if found somthing.

gkasireddy202 commented 1 month ago

@testloancare - I temporarily fixed this issue.

onConfirm={() => this.AlertPro.close(); setTimeout(() => { this.handleLogout(); }, 1000); }