Skip to content

Commit 43657e1

Browse files
Brett-Bestja1ns
authored andcommitted
fix: change -[RNSScreenContainer init] to call -[UIView initWithFrame:] designated initalizer (software-mansion#2161)
## Description Ensures `RNSScreenContainer` `UIView` subclass calls a designated initializer, this fixes an issue where subclassing `RNSScreenContainer` would recursively loop through the inits - ending in a crash. `UIView.h` has: `- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;` ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
1 parent 00d85a1 commit 43657e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ios/RNSScreenContainer.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ @implementation RNSScreenContainerView {
6060

6161
- (instancetype)init
6262
{
63-
if (self = [super init]) {
63+
if (self = [super initWithFrame:CGRectZero]) {
6464
#ifdef RCT_NEW_ARCH_ENABLED
6565
static const auto defaultProps = std::make_shared<const react::RNSScreenContainerProps>();
6666
_props = defaultProps;

0 commit comments

Comments
 (0)