Closed reidab closed 3 years ago
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.
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.
Confirmed on iPadOS 14 GM
@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?
That's weird.. I will give it a look today
This issue really looks like a bug in iOS itself.. I will open a ticket for apple.
@yogevbd Does Apple give some solution about this issue😂
@yogevbd Can you please add a link to the ticket? Thanks! 👍
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 Nice, do you want to create a PR for it?
@danilobuerger can do- https://github.com/wix/react-native-navigation/pull/6690
Reopening as #6690 was reverted. @bennettk let's reproduce the regression pointed out by @danilobuerger and submit a new PR?
@guyca hi, sorry- been buried with a lot of day job work :) should have a chance to take a look early next week.
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.
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, 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 thanks for fontSize tip. Removing that options works, but i need it)
@Adegeminas thanks for confirming this. @guyca can we reopen this one?
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
.
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.
Removing fontSize does not work for me. Please ignore - I don't see this issue at all after updating from 6.7.5 to 7.11.2
In case that helps someone, I had a similar issue like @Adegeminas, fixed it by changing default appareance's custom font / fontsize. I added this line in AppDelegate.m, ahead of RNN initialization.
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:@“SomeFont-Bold” size:10.0f]} forState:UIControlStateNormal];
Issue is still replicating. I have even upgraded the latest library version "react-native-navigation": "7.11.3", But still issue is happening, when switching the Apps from background and then come back.
@priyak-sdei i opened a separate issue for this a while ago see: https://github.com/wix/react-native-navigation/issues/6923
@Brett-Best can you share your example pls?
@kabus202
func configure(itemAppearance: UITabBarItemAppearance) -> UITabBarItemAppearance {
with(itemAppearance) {
// Setting a paragraph style worksaround an issue where the tab title would be truncated on iPadOS.
//
// SEE: https://github.com/Tencent/QMUI_iOS/issues/1110 & https://github.com/wix/react-native-navigation/issues/6533
let paragraphStyle = NSParagraphStyle.default
with($0.normal) {
$0.iconColor = .asset(.tabBarUnselectedTint)
$0.titleTextAttributes.merge([
.foregroundColor: UIColor.asset(.tabBarUnselectedTint),
.paragraphStyle: paragraphStyle
]) { _, new in new }
}
with($0.selected) {
$0.iconColor = .asset(.tabBarTint)
$0.titleTextAttributes.merge([
.foregroundColor: UIColor.asset(.tabBarTint),
.paragraphStyle: paragraphStyle
]) { _, new in new }
}
}
}
@Brett-Best where to put this?
Did you guys find a proper solution for this?
Bug is still appearing on iPhones.
Properly view:
Bug:
any updates ?
@arcziby revert those 2 lines https://github.com/wix/react-native-navigation/pull/6784/files and it will be working for the mobile part but on ipad it's still existing...
Here's a fix that is working for us:
self.tabBar.subviews.forEach {
if let label = $0.subviews[1] as? UILabel {
label.lineBreakMode = .byClipping
}
}
We set the tab bar titles in viewWillAppear
for our UITabBar subclass, calling this code after setting the label title works every time. It's a bit of a hack but it seems simpler than most of the other solutions. This fix is inspired by a solution posted in StackOverflow.
This issue still persists on iOS 15.4 with react-native-navigation 7.26.0 and React Native version 0.67.4. Strangely, if no text or icon color is applied to selected or unselected tabs, the text is not truncated but selecting tabs makes the text and icon move around / change size.
Happening for me as well...
react-native
: 0.66.1react-native-navigation
: 7.25.1Yeah, this is definitely still happening on iOS with the recent react-native + react-native-navigation.
On iOS 15.4, this issue happens again 😂
Ok, guys, let's solve it together here: https://github.com/wix/react-native-navigation/issues/7506#issuecomment-1160668701
I have a simple solution. It is weird but just works :) Why not just add some extra space after text like:
const extraSpace = ' ';
bottomTab: {
text: 'Screen Title' + extraSpace
}
Otherwise the issue still exists even after i have tried the solutions above.
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
Environment
master