Skip to content

Commit

Permalink
Fix flickering react view button
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd committed Jul 22, 2019
1 parent 80f8fd5 commit 77ee4df
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ios/RNNUIBarButtonItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ -(instancetype)init:(NSString*)buttonId withTitle:(NSString*)title {
-(instancetype)init:(NSString*)buttonId withCustomView:(RCTRootView *)reactView {
self = [super initWithCustomView:reactView];

reactView.hidden = YES;
reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
reactView.delegate = self;
reactView.backgroundColor = [UIColor clearColor];
reactView.clipsToBounds = YES;

self.widthConstraint = [NSLayoutConstraint constraintWithItem:reactView
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
Expand Down Expand Up @@ -62,10 +63,8 @@ - (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 setFrame:CGRectMake(0, 0, rootView.intrinsicContentSize.width, rootView.intrinsicContentSize.height)];
[rootView setNeedsUpdateConstraints];
[rootView updateConstraintsIfNeeded];
}
Expand Down

0 comments on commit 77ee4df

Please sign in to comment.