uilib-native 5.0.0-snapshot.7233 → 5.0.0-snapshot.7240

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.
@@ -11,11 +11,12 @@
11
11
  #import "UIResponder+FirstResponderTemp.h"
12
12
 
13
13
  #import <WebKit/WebKit.h>
14
- #import <React/RCTScrollView.h>
14
+
15
15
  #import <React/RCTBridge.h>
16
16
  #import <React/RCTUIManager.h>
17
17
  #import <React/UIView+React.h>
18
18
  #import <React/RCTUIManagerUtils.h>
19
+ #import <React/RCTSurfaceHostingView.h>
19
20
 
20
21
  #import <objc/runtime.h>
21
22
 
@@ -70,7 +71,7 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
70
71
 
71
72
  if (self)
72
73
  {
73
- [self addObserver:self forKeyPath:@"bounds" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
74
+ [self addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
74
75
  _inputViewsMap = [NSMapTable weakToWeakObjectsMapTable];
75
76
  _deferedInitializeAccessoryViewsCount = 0;
76
77
 
@@ -93,20 +94,21 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
93
94
  return self;
94
95
  }
95
96
 
96
- -(RCTRootView*)getRootView
97
+ -(UIView*)getRootView
97
98
  {
98
99
  UIView *view = self;
99
100
  while (view.superview != nil)
100
101
  {
101
102
  view = view.superview;
102
- if ([view isKindOfClass:[RCTRootView class]])
103
+ if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
103
104
  break;
105
+ }
104
106
  }
105
107
 
106
- if ([view isKindOfClass:[RCTRootView class]])
107
- {
108
- return (RCTRootView*)view;
108
+ if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
109
+ return view;
109
110
  }
111
+
110
112
  return nil;
111
113
  }
112
114
 
@@ -169,10 +171,20 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
169
171
  [self updateBottomViewFrame];
170
172
  }
171
173
 
174
+ - (UIScrollView*)extractUIScrollView:(UIView*)view
175
+ {
176
+ for (UIView* subview in view.subviews) {
177
+ if ([subview isKindOfClass:[UIScrollView class]]) {
178
+ return (UIScrollView*)subview;
179
+ }
180
+ }
181
+
182
+ return nil;
183
+ }
184
+
172
185
  - (void)initializeAccessoryViewsAndHandleInsets
173
186
  {
174
187
  NSArray<UIView*>* allSubviews = [self getBreadthFirstSubviewsForView:[self getRootView]];
175
- NSMutableArray<RCTScrollView*>* rctScrollViewsArray = [NSMutableArray array];
176
188
 
177
189
  for (UIView* subview in allSubviews)
178
190
  {
@@ -180,26 +192,29 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
180
192
  {
181
193
  if(_scrollViewToManage == nil)
182
194
  {
183
- if(_requiresSameParentToManageScrollView && [subview isKindOfClass:[RCTScrollView class]] && subview.superview == self.superview)
184
- {
185
- _scrollViewToManage = ((RCTScrollView*)subview).scrollView;
186
- }
187
- else if(!_requiresSameParentToManageScrollView && [subview isKindOfClass:[UIScrollView class]])
188
- {
189
- _scrollViewToManage = (UIScrollView*)subview;
195
+ if ([NSStringFromClass([subview class]) isEqualToString:@"RCTScrollViewComponentView"]) {
196
+ UIScrollView *scrollView = [self extractUIScrollView:subview];
197
+
198
+ if ([scrollView isKindOfClass:[UIScrollView class]])
199
+ {
200
+ if(_requiresSameParentToManageScrollView && subview.superview == self.superview)
201
+ {
202
+ _scrollViewToManage = scrollView;
203
+ }
204
+ else if(!_requiresSameParentToManageScrollView)
205
+ {
206
+ _scrollViewToManage = scrollView;
207
+ }
208
+
209
+ if(_scrollViewToManage != nil)
210
+ {
211
+ _scrollIsInverted = CGAffineTransformEqualToTransform(subview.superview.transform, CGAffineTransformMakeScale(1, -1));
212
+ }
213
+ }
190
214
  }
191
-
192
- if(_scrollViewToManage != nil)
193
- {
194
- _scrollIsInverted = CGAffineTransformEqualToTransform(_scrollViewToManage.superview.transform, CGAffineTransformMakeScale(1, -1));
195
- }
196
- }
197
-
198
- if([subview isKindOfClass:[RCTScrollView class]])
199
- {
200
- [rctScrollViewsArray addObject:(RCTScrollView*)subview];
201
215
  }
202
216
  }
217
+
203
218
 
204
219
  if ([subview isKindOfClass:NSClassFromString(@"RCTTextField")])
205
220
  {
@@ -247,13 +262,11 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
247
262
  }
248
263
  }
249
264
 
250
- for (RCTScrollView *scrollView in rctScrollViewsArray)
265
+ if(_scrollViewToManage != nil)
251
266
  {
252
- if(scrollView.scrollView == _scrollViewToManage)
267
+ if(_scrollViewToManage.delegate == nil)
253
268
  {
254
- [scrollView removeScrollListener:self];
255
- [scrollView addScrollListener:self];
256
- break;
269
+ _scrollViewToManage.delegate = self;
257
270
  }
258
271
  }
259
272
 
@@ -338,12 +351,12 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
338
351
 
339
352
  -(void)dealloc
340
353
  {
341
- [self removeObserver:self forKeyPath:@"bounds"];
354
+ [self removeObserver:self forKeyPath:@"frame"];
342
355
  }
343
356
 
344
357
  - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
345
358
  {
346
- _ObservingInputAccessoryViewTemp.height = self.bounds.size.height;
359
+ _ObservingInputAccessoryViewTemp.height = self.frame.size.height;
347
360
  }
348
361
 
349
362
  - (void)ObservingInputAccessoryViewTempKeyboardWillDisappear:(ObservingInputAccessoryViewTemp *)ObservingInputAccessoryViewTemp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilib-native",
3
- "version": "5.0.0-snapshot.7233",
3
+ "version": "5.0.0-snapshot.7240",
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",