react-native-true-sheet icon indicating copy to clipboard operation
react-native-true-sheet copied to clipboard

Navigating back does not open modal with initialIndex

Open believer opened this issue 7 months ago • 0 comments

Before submitting a new issue

  • [x] I tested using the latest version of the library, as the bug might be already fixed.
  • [x] I tested using a supported version of react native.
  • [x] I checked for possible duplicate issues, with possible answers.

Bug summary

If I have a sheet with initialIndex and navigate to a modal view in React Navigation, the sheet is closed. This is great! But, if I decide to go back in the navigation stack, I would expect the sheet to be displayed again.

I've tried combinations of TrueSheet.present and useFocusEffect as well as other things to display the sheet again, but nothing is happening. It seems like the sheet has been unmounted or something? We see that the FAB is still floating where the sheet used to be.

https://github.com/user-attachments/assets/d05f02d2-bb0f-4743-abb1-3a142e746e13

Library version

2.0.5

Environment info

info Fetching system and libraries information...
System:
  OS: macOS 15.3.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 101.58 MB / 16.00 GB
  Shell:
    version: 3.7.1
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 20.13.1
    path: /private/var/folders/0y/s_dvgd7d065037d1wshpq8_r0000gn/T/xfs-74b21765/node
  Yarn:
    version: 4.3.1
    path: /private/var/folders/0y/s_dvgd7d065037d1wshpq8_r0000gn/T/xfs-74b21765/yarn
  npm:
    version: 10.5.2
    path: ~/.local/state/fnm_multishells/18872_1745918290027/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/rickard/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.13103373
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.3.5
    path: /Users/rickard/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.1
    wanted: 0.79.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.79.2 is now available (your project is running on v0.79.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.79.1&to=0.79.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Steps to reproduce

  1. Press “Open modal” from map view. This opens a new screen with presentation: 'modal'.
  2. Press “Go back”
  3. Expect map sheet to be visible

Reproducible example repository

https://github.com/believer/react-native-true-sheet

believer avatar May 09 '25 09:05 believer