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

fix: prevent crash when there is no appearance model built #2375

Merged
merged 6 commits into from
Oct 3, 2024

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Oct 2, 2024

Description

I haven't investigated it carefully, but there were case when updating sheetCornerRadius the appearance
model has not been built yet leading to a crash when casting to a non-null type.

Additionally, this PR prevents calls to onSheetCornerRadiusUpdate when not in formSheet presentation
or not in native stack.

Changes

  • Prevent calls to onSheetCornerRadiusUpdate when not in formSheet presentation.
  • Check for nullish view background before attempt to set the corner radius.
  • Update the corner radius after all updates are applied, so that the stackPresentation has change of being updated.

Test code and steps to reproduce

Test1649. Try setting the corner radius now, should work properly.

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

@kkafar kkafar merged commit bf83e4b into main Oct 3, 2024
4 checks passed
@kkafar kkafar deleted the @kkafar/fix-crash-on-non-form-sheet-examples branch October 3, 2024 08:13
ja1ns pushed a commit to WiseOwlTech/react-native-screens that referenced this pull request Oct 9, 2024
…mansion#2375)

## Description

I haven't investigated it carefully, but there were case when updating
`sheetCornerRadius` the appearance
model has not been built yet leading to a crash when casting to a
non-null type.

Additionally, this PR prevents calls to `onSheetCornerRadiusUpdate` when
not in `formSheet` presentation
or not in native stack.

## Changes

* Prevent calls to `onSheetCornerRadiusUpdate` when not in `formSheet`
presentation.
* Check for nullish view background before attempt to set the corner
radius.
* Update the corner radius after all updates are applied, so that the
`stackPresentation` has change of being updated.

## Test code and steps to reproduce

`Test1649`. Try setting the corner radius now, should work properly.

## Checklist

- [x] Included code example that can be used to test this change
- [ ] Ensured that CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants