Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigating to a full screen modal with custom header props causes crash #2317

Closed
ha3 opened this issue Aug 23, 2024 · 2 comments · Fixed by #2336
Closed

Navigating to a full screen modal with custom header props causes crash #2317

ha3 opened this issue Aug 23, 2024 · 2 comments · Fixed by #2336
Assignees
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@ha3
Copy link

ha3 commented Aug 23, 2024

Description

On iOS, if a full-screen modal screen has a custom headerLeft, headerRight, or headerTitle prop, then navigating to it causes a crash after several times.

This is the error message:

Exception thrown while executing UI block: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

I am positive that this regression was introduced somewhere after 3.32.0.

Steps to reproduce

  1. Have two screens, one being a full-screen modal
  2. Add either custom headerLeft, headerRight, or headerTitle function.
  3. Navigate to the modal and go back several times
  4. Observe the crash

Snack or a link to a repository

https://github.com/ha3/rns-fullscreen-repro

Screens version

3.34.0

React Native version

0.75.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 13 (iOS 15.5)

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided labels Aug 23, 2024
@louis-openspace
Copy link

I can confirm this worked in 3.32.0 and broken when I used 3.34.0

@maksg maksg self-assigned this Sep 6, 2024
@jakecurreri
Copy link

+1

Patch from @maksg's PR until bundled into a release?

ios/RNSScreenStackHeaderConfig.mm

// When modal is shown the underlying RNSScreen isn't attached to any navigation controller.
// During the modal dismissal transition this update method is called on this RNSScreen resulting in nil navctr.
// After the transition is completed it will be called again and will configure the navigation controller correctly.
// Also see: https://github.com/software-mansion/react-native-screens/pull/2336
if (navctr == nil) {
  return;
}

@kkafar kkafar closed this as completed in af30489 Oct 4, 2024
ja1ns pushed a commit to WiseOwlTech/react-native-screens that referenced this issue Oct 9, 2024
## Description

Full screen modal was crashing sometimes on Paper.
Fixes software-mansion#2317.

## Test code and steps to reproduce

Added `Test2317` to tests.

## Checklist

- [x] Included code example that can be used to test this change
- [ ] Ensured that CI passes

---------

Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
4 participants