Skip to content

Commit 7dd5d62

Browse files
committed
feat: make dimensions dynamic on ios
1 parent 9df70d7 commit 7dd5d62

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

example/ios/RenderLynxExample.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@
380380
"-DFOLLY_CFG_NO_COROUTINES=1",
381381
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
382382
);
383-
OTHER_LDFLAGS = "$(inherited) ";
383+
OTHER_LDFLAGS = (
384+
"$(inherited)",
385+
" ",
386+
);
384387
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
385388
SDKROOT = iphoneos;
386389
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -449,7 +452,10 @@
449452
"-DFOLLY_CFG_NO_COROUTINES=1",
450453
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
451454
);
452-
OTHER_LDFLAGS = "$(inherited) ";
455+
OTHER_LDFLAGS = (
456+
"$(inherited)",
457+
" ",
458+
);
453459
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
454460
SDKROOT = iphoneos;
455461
USE_HERMES = true;

ios/RenderLynxView.mm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ - (instancetype)initWithFrame:(CGRect)frame
3434
_view = [[LynxView alloc] initWithBuilderBlock:^(LynxViewBuilder *builder) {
3535
builder.config = [[LynxConfig alloc] initWithProvider:[[RenderLynxTemplateProvider alloc] init]];
3636
}];
37-
_view.preferredLayoutWidth = 300;
38-
_view.preferredLayoutHeight = 700;
3937
_view.layoutWidthMode = LynxViewSizeModeExact;
4038
_view.layoutHeightMode = LynxViewSizeModeExact;
4139

@@ -45,6 +43,15 @@ - (instancetype)initWithFrame:(CGRect)frame
4543
return self;
4644
}
4745

46+
- (void)layoutSubviews {
47+
[super layoutSubviews];
48+
49+
_view.preferredLayoutWidth = self.frame.size.width;
50+
_view.preferredLayoutHeight = self.frame.size.height;
51+
52+
[_view triggerLayout];
53+
}
54+
4855
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
4956
{
5057
const auto &oldViewProps = *std::static_pointer_cast<RenderLynxViewProps const>(_props);

0 commit comments

Comments
 (0)