Skip to content

Commit cdfd149

Browse files
committed
fix(iOS): Replace calls to UIOffset ctors with calls to UIOffsetMake
Seems that `UIOffset(float, float)` ctor does not exist on tvOS. I decided to switch to the main factory function.
1 parent f9f330d commit cdfd149

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

ios/bottom-tabs/RNSBottomTabsHostComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ - (void)resetProps
7777
_tabBarItemTitleFontWeight = nil;
7878
_tabBarItemTitleFontStyle = nil;
7979
_tabBarItemTitleFontColor = nil;
80-
_tabBarItemTitlePositionAdjustment = UIOffset(0.0, 0.0);
80+
_tabBarItemTitlePositionAdjustment = UIOffsetMake(0.0, 0.0);
8181

8282
_tabBarItemIconColor = nil;
8383

ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#import "NSString+RNSUtility.h"
33
#import "RNSConversions.h"
44
#import "RNSDefines.h"
5-
#import "RNSTabBarController.h"
65
#import "RNSScrollViewHelper.h"
6+
#import "RNSTabBarController.h"
77

88
#if RCT_NEW_ARCH_ENABLED
99
#import <React/RCTConversions.h>
@@ -24,7 +24,7 @@ @implementation RNSBottomTabsScreenComponentView {
2424
RNSBottomTabsHostComponentView *__weak _Nullable _reactSuperview;
2525

2626
RNSBottomTabsScreenEventEmitter *_Nonnull _reactEventEmitter;
27-
27+
2828
// We need this information to warn users about dynamic changes to behavior being currently unsupported.
2929
BOOL _isOverrideScrollViewContentInsetAdjustmentBehaviorSet;
3030
#if !RCT_NEW_ARCH_ENABLED
@@ -72,7 +72,7 @@ - (void)resetProps
7272
_tabBarItemTitleFontWeight = nil;
7373
_tabBarItemTitleFontStyle = nil;
7474
_tabBarItemTitleFontColor = nil;
75-
_tabBarItemTitlePositionAdjustment = UIOffset(0.0, 0.0);
75+
_tabBarItemTitlePositionAdjustment = UIOffsetMake(0.0, 0.0);
7676

7777
_tabBarItemIconColor = nil;
7878

@@ -231,15 +231,17 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
231231
newComponentProps.specialEffects.repeatedTabSelection.scrollToTop;
232232
}
233233

234-
if (newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior
235-
!= oldComponentProps.overrideScrollViewContentInsetAdjustmentBehavior) {
236-
_overrideScrollViewContentInsetAdjustmentBehavior = newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior;
237-
234+
if (newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior !=
235+
oldComponentProps.overrideScrollViewContentInsetAdjustmentBehavior) {
236+
_overrideScrollViewContentInsetAdjustmentBehavior =
237+
newComponentProps.overrideScrollViewContentInsetAdjustmentBehavior;
238+
238239
if (_isOverrideScrollViewContentInsetAdjustmentBehaviorSet) {
239-
RCTLogWarn(@"[RNScreens] changing overrideScrollViewContentInsetAdjustmentBehavior dynamically is currently unsupported");
240+
RCTLogWarn(
241+
@"[RNScreens] changing overrideScrollViewContentInsetAdjustmentBehavior dynamically is currently unsupported");
240242
}
241243
}
242-
244+
243245
// This flag is set to YES when overrideScrollViewContentInsetAdjustmentBehavior prop
244246
// is assigned for the first time. This allows us to identify any subsequent changes to this prop,
245247
// enabling us to warn users that dynamic changes are not supported.

ios/conversion/RNSConversions-BottomTabs.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
UIOffset RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct(
8484
react::RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct titlePositionAdjustment)
8585
{
86-
return UIOffset(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
86+
return UIOffsetMake(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
8787
}
8888

8989
std::optional<UIBlurEffectStyle> RNSMaybeUIBlurEffectStyleFromRNSBottomTabsScreenTabBarBlurEffect(
@@ -169,7 +169,7 @@ UIOffset RNSBottomTabsTabBarItemTitlePositionAdjustmentStruct(
169169
UIOffset RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct(
170170
react::RNSBottomTabsScreenTabBarItemTitlePositionAdjustmentStruct titlePositionAdjustment)
171171
{
172-
return UIOffset(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
172+
return UIOffsetMake(titlePositionAdjustment.horizontal, titlePositionAdjustment.vertical);
173173
}
174174

175175
}; // namespace rnscreens::conversion

0 commit comments

Comments
 (0)