react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Tab bar text cut off and ellipsized on iPadOS 14

Open reidab opened this issue 6 years ago • 37 comments

Issue Description

When rendering a tab bar on an iPad running iPadOS Public Beta 6, text labels for tab bar items are truncated.

Steps to Reproduce / Code Snippets / Screenshots

IMG_0292


Environment

  • React Native Navigation version: Reproduced on playground app built from master
  • React Native version: 0.63.2
  • Platform(s) (iOS, Android, or both?): iOS: iPadOS 14 Public Beta 6
  • Device info (Simulator/Device? OS version? Debug/Release?): iPad Pro 11" 2018

reidab avatar Sep 03 '20 02:09 reidab

I can reproduce this. However, I am not sure if it is worth pursuing as this could very well just be an iPadOS beta bug. Maybe we should circle back on this once the GM is out.

danilobuerger avatar Sep 11 '20 13:09 danilobuerger

FWIW- this is also an issue when running on an Apple Silicon Mac, since that effectively runs your app as an iPad. No GM there yet either, but it seems like we're nearing the end of the beta period.

bennettk avatar Sep 14 '20 17:09 bennettk

Confirmed on iPadOS 14 GM

danilobuerger avatar Sep 16 '20 09:09 danilobuerger

@yogevbd This seems to be caused by applying NSForegroundColorAttributeName to the UITabBarItem standardAppearance. When removing the color, the labels are not truncated. However, on a fresh iOS project (no rn) this doesn't happen. Suggesting we have some further code that modifies this behavior. Any idea?

danilobuerger avatar Sep 16 '20 10:09 danilobuerger

That's weird.. I will give it a look today

yogevbd avatar Sep 17 '20 09:09 yogevbd

This issue really looks like a bug in iOS itself.. I will open a ticket for apple.

yogevbd avatar Sep 22 '20 08:09 yogevbd

@yogevbd Does Apple give some solution about this issue😂

leejunhui avatar Oct 12 '20 02:10 leejunhui

@yogevbd Can you please add a link to the ticket? Thanks! 👍

guyca avatar Oct 18 '20 04:10 guyca

FWIW- a team member found a workaround for this by adding an NSForegroundColorAttributeName to the titleTextAttributes in setTitleAttributes / setSelectedTitleAttributes in TabBarItemAppearanceCreator:

    if (@available(iOS 14.0, *)) {
      UIColor *color = [selectedTitleAttributes valueForKey:@"NSColor"];
      if (color) {
        tabItem.standardAppearance.inlineLayoutAppearance.selected.titleTextAttributes = @{NSForegroundColorAttributeName: color};
      }
    }

not sure if this fixes all cases, but it works for us so far so we're swizzling the RNN implementation for now... but obviously if the fix landed in RNN, we'd much prefer to use that. :)

bennettk avatar Oct 19 '20 18:10 bennettk

@bennettk Nice, do you want to create a PR for it?

danilobuerger avatar Oct 19 '20 18:10 danilobuerger

@danilobuerger can do- https://github.com/wix/react-native-navigation/pull/6690

bennettk avatar Oct 19 '20 20:10 bennettk

Reopening as #6690 was reverted. @bennettk let's reproduce the regression pointed out by @danilobuerger and submit a new PR?

guyca avatar Oct 20 '20 08:10 guyca

@guyca hi, sorry- been buried with a lot of day job work :) should have a chance to take a look early next week.

bennettk avatar Oct 23 '20 22:10 bennettk

Curious if there is a workaround that anyone has found around this issue. I've started hearing more complaints from users as more people update to IOS 14.

zzorba avatar Nov 14 '20 17:11 zzorba

Hi guys!

Looks like there is a way to reproduce this even after bugfix in iOS 14.2 (simulator and production)

"react-native": "^0.63.3" "react-native-navigation": "^7.4.0-snapshot.1328" (and the same story with 7.8.1)

I'm re-setting root after going to background (using hardware button) and back again like this:

Navigation.events().registerAppLaunchedListener(() => that.startApp())

So, for the first time i'm returning from background state i see truncated text of bottom tabs.

Any idea?

Adegeminas avatar Jan 11 '21 15:01 Adegeminas

@Adegeminas, i have the sam on iOS/* and i have this only on the first resume.

To reproduce: background -> resume app -> { ellipsis dots } -> click on each tab -> background -> resume -> all visible

What i also discovered is: when you remove fontSize from bottomTab options, it's also working without any problems

kabus202 avatar Jan 18 '21 08:01 kabus202

@kabus202 thanks for fontSize tip. Removing that options works, but i need it)

Adegeminas avatar Jan 18 '21 10:01 Adegeminas

@Adegeminas thanks for confirming this. @guyca can we reopen this one?

kabus202 avatar Jan 18 '21 10:01 kabus202

Related to https://github.com/Tencent/QMUI_iOS/issues/1110 which was fixed by https://github.com/Tencent/QMUI_iOS/blob/09cdc055f63a4ef88a75cfeefc3e5521eef7bbd1/QMUIKit/UIKitExtensions/UITabBar%2BQMUI.m#L198-L226.

I also was able to workaround the issue in a blank project by setting the attribute paragraphStyle to NSParagraphStyle.default of the titleTextAttributes.

Brett-Best avatar Jan 28 '21 03:01 Brett-Best

I was able to get this working by reverting the change made in #6784, per @ryanbourneuk's comment. I will be using patch-package to handle this for now.

wilsontr avatar Feb 10 '21 15:02 wilsontr