wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

Bottom tabs text is cut off on iPad #7855

Closed d4vidi closed 6 months ago

d4vidi commented 7 months ago

What happened?

Complete info: WOARNN-568

The text in some of the bottom tabs is cut off -

image

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: React Native version: Has Fabric (React Native's new rendering system) enabled: (yes/no) Node version: Device model: iOS version:

phuongwd commented 6 months ago

Related to

  1. https://github.com/wix/react-native-navigation/issues/7506
  2. https://github.com/wix/react-native-navigation/issues/7827

Patch

diff --git a/node_modules/react-native-navigation/lib/ios/RNNTabBarItemCreator.m b/node_modules/react-native-navigation/lib/ios/RNNTabBarItemCreator.m
index d313bfc..c22f984 100644
--- a/node_modules/react-native-navigation/lib/ios/RNNTabBarItemCreator.m
+++ b/node_modules/react-native-navigation/lib/ios/RNNTabBarItemCreator.m
@@ -91,13 +91,19 @@
     NSNumber *fontSize = [bottomTabOptions.fontSize withDefault:@(10)];
     NSString *fontWeight = [bottomTabOptions.fontWeight withDefault:nil];

+    /**
+     * The title of tabbar item has been cut off in iPad 12.9 with iOS 15.4.
+     * It was mentioned at https://github.com/wix/react-native-navigation/issues/7506
+     * Hotfix: centered the text will resolve problem.
+     */
+
     NSDictionary *normalAttributes = [RNNFontAttributesCreator
         createFromDictionary:[tabItem titleTextAttributesForState:UIControlStateNormal]
                   fontFamily:fontFamily
                     fontSize:fontSize
                   fontWeight:fontWeight
                        color:textColor
-                    centered:NO];
+                    centered:TRUE];
     [self setTitleAttributes:tabItem titleAttributes:normalAttributes];

     NSDictionary *selectedAttributes = [RNNFontAttributesCreator
@@ -106,7 +112,7 @@
                     fontSize:fontSize
                   fontWeight:fontWeight
                        color:selectedTextColor
-                    centered:NO];
+                    centered:TRUE];
     [self setSelectedTitleAttributes:tabItem selectedTitleAttributes:selectedAttributes];
 }
asafkorem commented 6 months ago

Thanks for the patch suggestion @phuongwd, I will check that now 🙂

asafkorem commented 6 months ago

Fix is here: https://github.com/wix/react-native-navigation/pull/7863, will release a patch version soon

phuongwd commented 6 months ago

Thanks for the patch suggestion @phuongwd, I will check that now 🙂

Credit to thuongtv-vn https://github.com/wix/react-native-navigation/issues/7506#issuecomment-1600381275

asafkorem commented 6 months ago

The fix will be released in the next patch version. @phuongwd you will both get credit in the release notes 😄

asafkorem commented 6 months ago

Released with 7.38.4