Skip to content

Commit 9eb7365

Browse files
committed
fix(iOS,Tabs): fix title being errorneously assigned to tabKey (#124)
Fixes #121
1 parent cfc23ac commit 9eb7365

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

ios/bottom-tabs/RNSBottomTabsHostComponentView.mm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ - (void)resetProps
6161
_props = defaultProps;
6262
_tabBarBlurEffect = nil;
6363
_tabBarBackgroundColor = nil;
64-
64+
6565
_tabBarItemTitleFontFamily = nil;
6666
_tabBarItemTitleFontSize = nil;
6767
_tabBarItemTitleFontWeight = nil;
6868
_tabBarItemTitleFontStyle = nil;
6969
_tabBarItemTitleFontColor = nil;
70-
70+
7171
_tabBarItemBadgeBackgroundColor = nil;
7272
}
7373

@@ -180,7 +180,7 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
180180
_tabBarBlurEffect =
181181
rnscreens::conversion::RNSUIBlurEffectFromRNSBottomTabsTabBarBlurEffect(newComponentProps.tabBarBlurEffect);
182182
}
183-
183+
184184
if (newComponentProps.tabBarItemTitleFontFamily != oldComponentProps.tabBarItemTitleFontFamily) {
185185
_tabBarItemTitleFontFamily = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontFamily);
186186
_needsTabBarAppearanceUpdate = YES;
@@ -190,22 +190,22 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
190190
_tabBarItemTitleFontSize = [NSNumber numberWithFloat:newComponentProps.tabBarItemTitleFontSize];
191191
_needsTabBarAppearanceUpdate = YES;
192192
}
193-
193+
194194
if (newComponentProps.tabBarItemTitleFontWeight != oldComponentProps.tabBarItemTitleFontWeight) {
195195
_tabBarItemTitleFontWeight = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontWeight);
196196
_needsTabBarAppearanceUpdate = YES;
197197
}
198-
198+
199199
if (newComponentProps.tabBarItemTitleFontStyle != oldComponentProps.tabBarItemTitleFontStyle) {
200200
_tabBarItemTitleFontStyle = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontStyle);
201201
_needsTabBarAppearanceUpdate = YES;
202202
}
203-
203+
204204
if (newComponentProps.tabBarItemTitleFontColor != oldComponentProps.tabBarItemTitleFontColor) {
205205
_tabBarItemTitleFontColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemTitleFontColor);
206206
_needsTabBarAppearanceUpdate = YES;
207207
}
208-
208+
209209
if (newComponentProps.tabBarItemBadgeBackgroundColor != oldComponentProps.tabBarItemBadgeBackgroundColor) {
210210
_tabBarItemBadgeBackgroundColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemBadgeBackgroundColor);
211211
_needsTabBarAppearanceUpdate = YES;

ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "RNSBottomTabsScreenComponentView.h"
2+
#import "RNSConversions.h"
23
#import "RNSDefines.h"
34
#import "RNSTabBarController.h"
4-
#import "RNSConversions.h"
55

66
#import <React/RCTConversions.h>
77
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
@@ -55,7 +55,7 @@ - (void)resetProps
5555
_tabBarItemTitleFontWeight = nil;
5656
_tabBarItemTitleFontStyle = nil;
5757
_tabBarItemTitleFontColor = nil;
58-
58+
5959
_tabBarItemBadgeBackgroundColor = nil;
6060
}
6161

@@ -96,7 +96,7 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
9696

9797
if (newComponentProps.tabKey != oldComponentProps.tabKey) {
9898
RCTAssert(!newComponentProps.tabKey.empty(), @"[RNScreens] tabKey must not be empty!");
99-
_tabKey = RCTNSStringFromString(newComponentProps.title);
99+
_tabKey = RCTNSStringFromString(newComponentProps.tabKey);
100100
}
101101

102102
if (newComponentProps.isFocused != oldComponentProps.isFocused) {
@@ -116,15 +116,15 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
116116
NSLog(@"TabsScreen [%ld] update badgeColor to %@", self.tag, _tabBarItemBadgeBackgroundColor);
117117
tabItemNeedsAppearanceUpdate = YES;
118118
}
119-
119+
120120
if (newComponentProps.tabBarBackgroundColor != oldComponentProps.tabBarBackgroundColor) {
121121
_tabBarBackgroundColor = RCTUIColorFromSharedColor(newComponentProps.tabBarBackgroundColor);
122122
tabItemNeedsAppearanceUpdate = YES;
123123
}
124124

125125
if (newComponentProps.tabBarBlurEffect != oldComponentProps.tabBarBlurEffect) {
126-
_tabBarBlurEffect =
127-
rnscreens::conversion::RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(newComponentProps.tabBarBlurEffect);
126+
_tabBarBlurEffect = rnscreens::conversion::RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(
127+
newComponentProps.tabBarBlurEffect);
128128
tabItemNeedsAppearanceUpdate = YES;
129129
}
130130

@@ -137,17 +137,17 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
137137
_tabBarItemTitleFontSize = [NSNumber numberWithFloat:newComponentProps.tabBarItemTitleFontSize];
138138
tabItemNeedsAppearanceUpdate = YES;
139139
}
140-
140+
141141
if (newComponentProps.tabBarItemTitleFontWeight != oldComponentProps.tabBarItemTitleFontWeight) {
142142
_tabBarItemTitleFontWeight = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontWeight);
143143
tabItemNeedsAppearanceUpdate = YES;
144144
}
145-
145+
146146
if (newComponentProps.tabBarItemTitleFontStyle != oldComponentProps.tabBarItemTitleFontStyle) {
147147
_tabBarItemTitleFontStyle = RCTNSStringFromStringNilIfEmpty(newComponentProps.tabBarItemTitleFontStyle);
148148
tabItemNeedsAppearanceUpdate = YES;
149149
}
150-
150+
151151
if (newComponentProps.tabBarItemTitleFontColor != oldComponentProps.tabBarItemTitleFontColor) {
152152
_tabBarItemTitleFontColor = RCTUIColorFromSharedColor(newComponentProps.tabBarItemTitleFontColor);
153153
tabItemNeedsAppearanceUpdate = YES;

ios/bottom-tabs/RNSTabBarAppearanceProvider.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ NS_ASSUME_NONNULL_BEGIN
44

55
@protocol RNSTabBarAppearanceProvider
66

7-
-(UIColor *)tabBarBackgroundColor;
8-
-(UIBlurEffect *)tabBarBlurEffect;
7+
- (UIColor *)tabBarBackgroundColor;
8+
- (UIBlurEffect *)tabBarBlurEffect;
99

10-
-(NSString *)tabBarItemTitleFontFamily;
11-
-(NSNumber *)tabBarItemTitleFontSize;
12-
-(NSString *)tabBarItemTitleFontWeight;
13-
-(NSString *)tabBarItemTitleFontStyle;
14-
-(UIColor *)tabBarItemTitleFontColor;
10+
- (NSString *)tabBarItemTitleFontFamily;
11+
- (NSNumber *)tabBarItemTitleFontSize;
12+
- (NSString *)tabBarItemTitleFontWeight;
13+
- (NSString *)tabBarItemTitleFontStyle;
14+
- (UIColor *)tabBarItemTitleFontColor;
1515

16-
-(UIColor *)tabBarItemBadgeBackgroundColor;
16+
- (UIColor *)tabBarItemBadgeBackgroundColor;
1717

1818
@end
1919

ios/conversion/RNSConversions-BottomTabs.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@
149149
}
150150
}
151151

152-
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(react::RNSBottomTabsScreenTabBarBlurEffect blurEffect)
152+
UIBlurEffect *RNSUIBlurEffectFromRNSBottomTabsScreenTabBarBlurEffect(
153+
react::RNSBottomTabsScreenTabBarBlurEffect blurEffect)
153154
{
154-
std::optional<UIBlurEffectStyle> maybeStyle = RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(blurEffect);
155+
std::optional<UIBlurEffectStyle> maybeStyle =
156+
RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(blurEffect);
155157
if (maybeStyle) {
156158
return [UIBlurEffect effectWithStyle:maybeStyle.value()];
157159
}

0 commit comments

Comments
 (0)