From 1fc181cc617336f4bdd0b0a8bc2d931111cfb423 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 28 Sep 2023 22:17:16 +0300 Subject: [PATCH] MM-54499 Patch react-native-navigation to fix button text wrapping (#7557) (#7574) * MM-54499 Downgrade react-native-navigation to fix button text wrapping * Revert "MM-54499 Downgrade react-native-navigation to fix button text wrapping" This reverts commit b8f65cda426bb02d26fd85d8b8436597b2ae1722. * MM-54499 Patch react-native-navigation to fix button text wrapping (cherry picked from commit b562e67d02abcdc37c3c91e60b35ce485222351d) Co-authored-by: Harrison Healey --- patches/react-native-navigation+7.37.0.patch | 39 +++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/patches/react-native-navigation+7.37.0.patch b/patches/react-native-navigation+7.37.0.patch index dc21c31c9..5dbb6400d 100644 --- a/patches/react-native-navigation+7.37.0.patch +++ b/patches/react-native-navigation+7.37.0.patch @@ -186,7 +186,7 @@ diff --git a/node_modules/react-native-navigation/lib/ios/RNNComponentViewContro index fc482a6..9406bbf 100644 --- a/node_modules/react-native-navigation/lib/ios/RNNComponentViewController.m +++ b/node_modules/react-native-navigation/lib/ios/RNNComponentViewController.m -@@ -94,6 +94,7 @@ +@@ -94,6 +94,7 @@ - (void)renderReactViewIfNeeded { }]; }]; self.reactView.backgroundColor = UIColor.clearColor; @@ -207,7 +207,7 @@ index b44f24f..bf4e1c3 100644 @implementation RNNOverlayWindow -@@ -9,6 +11,8 @@ +@@ -9,6 +11,8 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if ([hitTestResult isKindOfClass:[UIWindow class]] || [hitTestResult.subviews.firstObject isKindOfClass:RNNReactView.class] || @@ -216,6 +216,41 @@ index b44f24f..bf4e1c3 100644 [hitTestResult isKindOfClass:[RCTModalHostView class]] || [hitTestResult isKindOfClass:NSClassFromString(@"RCTRootComponentView")]) { return nil; +diff --git a/node_modules/react-native-navigation/lib/ios/RNNUIBarButtonItem.m b/node_modules/react-native-navigation/lib/ios/RNNUIBarButtonItem.m +index ece1da1..26730ae 100644 +--- a/node_modules/react-native-navigation/lib/ios/RNNUIBarButtonItem.m ++++ b/node_modules/react-native-navigation/lib/ios/RNNUIBarButtonItem.m +@@ -87,9 +87,28 @@ - (instancetype)initWithCustomView:(RNNReactView *)reactView + buttonOptions:(RNNButtonOptions *)buttonOptions + onPress:(RNNButtonPressCallback)onPress { + self = [super initWithCustomView:reactView]; +- [reactView setFrame:CGRectMake(0, 0, 50, 50)]; + [self applyOptions:buttonOptions]; +- ++ reactView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight; ++ reactView.hidden = CGRectEqualToRect(reactView.frame, CGRectZero); ++ ++ [NSLayoutConstraint deactivateConstraints:reactView.constraints]; ++ self.widthConstraint = ++ [NSLayoutConstraint constraintWithItem:reactView ++ attribute:NSLayoutAttributeWidth ++ relatedBy:NSLayoutRelationEqual ++ toItem:nil ++ attribute:NSLayoutAttributeNotAnAttribute ++ multiplier:1.0 ++ constant:reactView.intrinsicContentSize.width]; ++ self.heightConstraint = ++ [NSLayoutConstraint constraintWithItem:reactView ++ attribute:NSLayoutAttributeHeight ++ relatedBy:NSLayoutRelationEqual ++ toItem:nil ++ attribute:NSLayoutAttributeNotAnAttribute ++ multiplier:1.0 ++ constant:reactView.intrinsicContentSize.height]; ++ [NSLayoutConstraint activateConstraints:@[ self.widthConstraint, self.heightConstraint ]]; + reactView.delegate = self; + + reactView.backgroundColor = [UIColor clearColor]; diff --git a/node_modules/react-native-navigation/lib/src/interfaces/Options.ts b/node_modules/react-native-navigation/lib/src/interfaces/Options.ts index 4851b40..e891183 100644 --- a/node_modules/react-native-navigation/lib/src/interfaces/Options.ts