Skip to content

Commit

Permalink
fix: change -[RNSScreenContainer init] to call `-[UIView initWithFr…
Browse files Browse the repository at this point in the history
…ame:]` 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
  • Loading branch information
Brett-Best authored and ja1ns committed Oct 9, 2024
1 parent 00d85a1 commit 43657e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ios/RNSScreenContainer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ @implementation RNSScreenContainerView {

- (instancetype)init
{
if (self = [super init]) {
if (self = [super initWithFrame:CGRectZero]) {
#ifdef RCT_NEW_ARCH_ENABLED
static const auto defaultProps = std::make_shared<const react::RNSScreenContainerProps>();
_props = defaultProps;
Expand Down

0 comments on commit 43657e1

Please sign in to comment.