Skip to content

Commit

Permalink
Fix topBar.title.component fill alignment (#5044)
Browse files Browse the repository at this point in the history
* Fix topBar.title.component fill alignment

* Lock react-native-ui-lib version
  • Loading branch information
yogevbd authored Apr 30, 2019
1 parent 0e8880d commit 9f439da
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ios/RNNReactView.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);
@property (nonatomic, copy) void (^rootViewDidChangeIntrinsicSize)(CGSize intrinsicSize);
@property (nonatomic, copy) RNNReactViewReadyCompletionBlock reactViewReadyBlock;

- (void)setAlignment:(NSString *)alignment;
- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame;

@end
3 changes: 2 additions & 1 deletion lib/ios/RNNReactView.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ - (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView {
}
}

- (void)setAlignment:(NSString *)alignment {
- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame {
if ([alignment isEqualToString:@"fill"]) {
self.sizeFlexibility = RCTRootViewSizeFlexibilityNone;
[self setFrame:frame];
} else {
self.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
__weak RNNReactView *weakSelf = self;
Expand Down
2 changes: 1 addition & 1 deletion lib/ios/RNNViewControllerPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (void)setCustomNavigationTitleView:(RNNNavigationOptions *)options perform:(RN
_customTitleView = (RNNReactView*)[_componentRegistry createComponentIfNotExists:options.topBar.title.component parentComponentId:viewController.layoutInfo.componentId reactViewReadyBlock:readyBlock];
_customTitleView.backgroundColor = UIColor.clearColor;
NSString* alignment = [options.topBar.title.component.alignment getWithDefaultValue:@""];
[_customTitleView setAlignment:alignment];
[_customTitleView setAlignment:alignment inFrame:viewController.navigationController.navigationBar.frame];

viewController.navigationItem.titleView = nil;
viewController.navigationItem.titleView = _customTitleView;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@types/react-test-renderer": "16.x.x",
"jsc-android": "236355.x.x",
"detox": "12.1.x",
"react-native-ui-lib": "3.x.x",
"react-native-ui-lib": "3.24.2",
"handlebars": "4.x.x",
"jest": "23.x.x",
"metro-react-native-babel-preset": "0.50.0",
Expand Down

0 comments on commit 9f439da

Please sign in to comment.