Skip to content

Commit

Permalink
Hides react view button until view size calculated
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd committed Jul 24, 2019
1 parent f39f123 commit 9804c62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ios/RNNUIBarButtonItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ -(instancetype)init:(NSString*)buttonId withCustomView:(RCTRootView *)reactView
reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
reactView.delegate = self;
reactView.backgroundColor = [UIColor clearColor];
reactView.clipsToBounds = YES;
reactView.hidden = YES;

self.widthConstraint = [NSLayoutConstraint constraintWithItem:reactView
attribute:NSLayoutAttributeWidth
Expand Down Expand Up @@ -63,6 +63,7 @@ - (instancetype)init:(NSString*)buttonId withSystemItem:(NSString *)systemItemNa
}

- (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView {
rootView.hidden = NO;
self.widthConstraint.constant = rootView.intrinsicContentSize.width;
self.heightConstraint.constant = rootView.intrinsicContentSize.height;
[rootView setNeedsUpdateConstraints];
Expand Down

0 comments on commit 9804c62

Please sign in to comment.