uilib-native 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -113,6 +113,12 @@ export type KeyboardAccessoryViewProps = {
113
113
  * default: true
114
114
  */
115
115
  useSafeArea?: boolean;
116
+ /**
117
+ * iOS only.
118
+ * Whether or not to include bottom tab bat inset
119
+ * default: true
120
+ */
121
+ usesBottomTabs?: boolean;
116
122
 
117
123
  children?: React.ReactChild;
118
124
  };
@@ -252,7 +258,8 @@ class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
252
258
  kbComponent,
253
259
  onItemSelected,
254
260
  onRequestShowKeyboard,
255
- useSafeArea
261
+ useSafeArea,
262
+ usesBottomTabs
256
263
  } = this.props;
257
264
 
258
265
  return (
@@ -267,6 +274,7 @@ class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
267
274
  requiresSameParentToManageScrollView={requiresSameParentToManageScrollView}
268
275
  addBottomView={addBottomView}
269
276
  allowHitsOutsideBounds={allowHitsOutsideBounds}
277
+ usesBottomTabs={usesBottomTabs}
270
278
  >
271
279
  <>
272
280
  {renderContent?.()}
@@ -20,6 +20,10 @@ export type KeyboardTrackingViewProps = ViewProps & {
20
20
  * Allow control safe area
21
21
  */
22
22
  useSafeArea?: boolean;
23
+ /**
24
+ * Whether or not to include bottom tab bar inset
25
+ */
26
+ usesBottomTabs?: boolean;
23
27
 
24
28
  scrollToFocusedInput?: boolean;
25
29
  scrollBehavior?: number;
@@ -51,6 +51,7 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
51
51
  @property (nonatomic) KeyboardTrackingScrollBehavior scrollBehavior;
52
52
  @property (nonatomic) BOOL addBottomView;
53
53
  @property (nonatomic) BOOL useSafeArea;
54
+ @property (nonatomic) BOOL usesBottomTabs;
54
55
  @property (nonatomic) BOOL scrollToFocusedInput;
55
56
  @property (nonatomic) BOOL allowHitsOutsideBounds;
56
57
 
@@ -82,6 +83,7 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
82
83
 
83
84
  self.addBottomView = NO;
84
85
  self.scrollToFocusedInput = NO;
86
+ self.usesBottomTabs = NO;
85
87
 
86
88
  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rctContentDidAppearNotification:) name:RCTContentDidAppearNotification object:nil];
87
89
  }
@@ -503,14 +505,35 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
503
505
  });
504
506
  }
505
507
 
508
+ #pragma mark - root view controller and presenting style
509
+
510
+
511
+ - (BOOL)isModal {
512
+ UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
513
+ UIViewController *presentedViewController = window.rootViewController.presentedViewController;
514
+
515
+ if (presentedViewController != nil) {
516
+ if ([presentedViewController isKindOfClass:[UINavigationController class]]) {
517
+ UINavigationController *presented = (UINavigationController*)presentedViewController;
518
+ if (presented.visibleViewController) {
519
+ return YES;
520
+ }
521
+ }
522
+ }
523
+ return NO;
524
+ }
525
+
526
+ #pragma mark - TabBarController
527
+
506
528
  -(CGFloat)getTabBarHeight
507
529
  {
508
530
  if (@available(iOS 11.0, *)) {
509
- UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
510
- if ([window.rootViewController isKindOfClass:[UITabBarController class]])
531
+ NSLog(@"INBAL usesBottomTabs: %d", self.usesBottomTabs);
532
+ if (self.usesBottomTabs == YES)
511
533
  {
512
534
  UITabBarController *tabBarController = [UITabBarController new];
513
535
  CGFloat tabBarHeight = tabBarController.tabBar.frame.size.height;
536
+ UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
514
537
  CGFloat bottomPadding = window.safeAreaInsets.bottom;
515
538
  return tabBarHeight + bottomPadding;
516
539
  }
@@ -650,6 +673,7 @@ RCT_REMAP_VIEW_PROPERTY(manageScrollView, manageScrollView, BOOL)
650
673
  RCT_REMAP_VIEW_PROPERTY(requiresSameParentToManageScrollView, requiresSameParentToManageScrollView, BOOL)
651
674
  RCT_REMAP_VIEW_PROPERTY(addBottomView, addBottomView, BOOL)
652
675
  RCT_REMAP_VIEW_PROPERTY(useSafeArea, useSafeArea, BOOL)
676
+ RCT_REMAP_VIEW_PROPERTY(usesBottomTabs, usesBottomTabs, BOOL)
653
677
  RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
654
678
  RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)
655
679
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilib-native",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "homepage": "https://github.com/wix/react-native-ui-lib",
5
5
  "description": "uilib native components (separated from js components)",
6
6
  "main": "components/index.js",