Skip to content

Commit 6793f5c

Browse files
emily8rownmeta-codesync[bot]
authored andcommitted
Fix RCTDevLoadingView crash when adding button constraints (#54690)
Summary: Pull Request resolved: #54690 Changelog: [iOS][Fixed] - Fixed crash from dismiss button in DevLoadingView D86420230 added a dismiss button feature to RCTDevLoadingView. However, when adding layout constraints on line 198, it incorrectly checked the `dismissButton` parameter instead of the `self->_dismissButton` instance variable. This caused NSLayoutConstraint crashes when the parameter was nil/false but the instance variable existed from a previous call, or vice versa. This changes line 198 to check `self->_dismissButton` (the instance variable) instead of `dismissButton` (the function parameter) to properly verify if the button exists before adding constraints to it. Reviewed By: vzaidman, javache Differential Revision: D87871856 fbshipit-source-id: c8fe033bce383c2589041c9cd3fad65f37553d3c
1 parent e23e9ad commit 6793f5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/React/CoreModules/RCTDevLoadingView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ - (void)showMessage:(NSString *)message
195195
]];
196196

197197
// Add button-specific constraints if button exists
198-
if (dismissButton) {
198+
if (self->_dismissButton != nullptr) {
199199
[constraints addObjectsFromArray:@[
200200
[self->_dismissButton.trailingAnchor constraintEqualToAnchor:self->_container.trailingAnchor constant:-10],
201201
[self->_dismissButton.centerYAnchor constraintEqualToAnchor:self->_label.centerYAnchor],

0 commit comments

Comments
 (0)