Skip to content

Commit 646f45d

Browse files
authored
fix(iOS, Paper, Tabs): fix badge value on iOS Paper (#3038)
## Description Fixes missing badge values on iOS Paper. Closes software-mansion/react-native-screens-labs#279. ## Changes - update badge value in tab bar item when setting prop ## Test code and steps to reproduce Run TestBottomTabs and verify if badges are visible. ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
1 parent 767d007 commit 646f45d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (void)resetProps
8484

8585
_overrideScrollViewContentInsetAdjustmentBehavior = YES;
8686
_isOverrideScrollViewContentInsetAdjustmentBehaviorSet = NO;
87-
87+
8888
_iconType = RNSBottomTabsIconTypeSfSymbol;
8989

9090
_iconImageSource = nil;
@@ -228,18 +228,18 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
228228
rnscreens::conversion::RCTImageSourceFromImageSourceAndIconType(&newComponentProps.iconImageSource, _iconType);
229229
tabItemNeedsAppearanceUpdate = YES;
230230
}
231-
231+
232232
if (newComponentProps.iconSfSymbolName != oldComponentProps.iconSfSymbolName) {
233233
_iconSfSymbolName = RCTNSStringFromStringNilIfEmpty(newComponentProps.iconSfSymbolName);
234234
tabItemNeedsAppearanceUpdate = YES;
235235
}
236236

237237
if (newComponentProps.selectedIconImageSource != oldComponentProps.selectedIconImageSource) {
238-
_selectedIconImageSource =
239-
rnscreens::conversion::RCTImageSourceFromImageSourceAndIconType(&newComponentProps.selectedIconImageSource, _iconType);
238+
_selectedIconImageSource = rnscreens::conversion::RCTImageSourceFromImageSourceAndIconType(
239+
&newComponentProps.selectedIconImageSource, _iconType);
240240
tabItemNeedsAppearanceUpdate = YES;
241241
}
242-
242+
243243
if (newComponentProps.selectedIconSfSymbolName != oldComponentProps.selectedIconSfSymbolName) {
244244
_selectedIconSfSymbolName = RCTNSStringFromStringNilIfEmpty(newComponentProps.selectedIconSfSymbolName);
245245
tabItemNeedsAppearanceUpdate = YES;
@@ -358,6 +358,7 @@ - (void)setTitle:(NSString *)title
358358
- (void)setBadgeValue:(NSString *)badgeValue
359359
{
360360
_badgeValue = [NSString rnscreens_stringOrNilIfBlank:badgeValue];
361+
_controller.tabBarItem.badgeValue = _badgeValue;
361362
}
362363

363364
- (void)setTabBarBackgroundColor:(UIColor *)tabBarBackgroundColor

0 commit comments

Comments
 (0)