Repository: react-native
Issue: Modal flickr in conditial displayed in react native 0.76.5
Labels: Component: Modal,Needs: Repro,Needs: Attention

### Description

in react native 0.76.4, and react native reanimated 3.16.6 and react native navigation 6. my problem if i use condition to display my react native Modal, i have a problem
i have 2 input each one contain a button open conditionaly a modal (instead switching true/false  for visible prop of the modal)
if i use condition to open and close it, when closed should be removed from the memory or dom
but if i try to open the model of the second input the first one fliker a bit before when opened the modal of the second although i close the first modal
in the version previous of react native it work fine

### Steps to reproduce

in react native 0.76.4, and react native reanimated 3.16.6 and react native navigation 6. my problem if i use condition to display my react native Modal, i have a problem
i have 2 input each one contain a button open conditionaly a modal (instead switching true/false  for visible prop of the modal)
if i use condition to open and close it, when closed should be removed from the memory or dom
but if i try to open the model of the second input the first one fliker a bit before when opened the modal of the second although i close the first modal
in the version previous of react native it work fine

### React Native Version

0.76.5

### Affected Platforms

Runtime - iOS

### Output of `npx react-native info`

```text
System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 101.41 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.12.0
    path: ~/.nvm/versions/node/v22.12.0/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.2
    path: ~/Documents/AccuV-Team/Versions/0.76.5/IDP.Mobile/node_modules/.bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.2
      - 33.0.3
      - 34.0.0
      - 35.0.0
    System Images:
      - android-31 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: ^0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
```


### Stacktrace or Logs

```text
...
```


### Reproducer

...

### Screenshots and Videos

_No response_