231 lines
11 KiB
Diff
231 lines
11 KiB
Diff
diff --git a/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js b/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js
|
|
index cfe1d35..7ce5105 100644
|
|
--- a/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js
|
|
+++ b/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js
|
|
@@ -123,7 +123,13 @@ class KeyboardAccessoryView extends Component {
|
|
* Whether or not to handle SafeArea
|
|
* default: true
|
|
*/
|
|
- useSafeArea: PropTypes.bool
|
|
+ useSafeArea: PropTypes.bool,
|
|
+
|
|
+ /**
|
|
+ * iOS only.
|
|
+ * Scroll view to track
|
|
+ */
|
|
+ scrollViewNativeID: PropTypes.string
|
|
};
|
|
|
|
static iosScrollBehaviors = IOS_SCROLL_BEHAVIORS;
|
|
@@ -256,7 +262,8 @@ class KeyboardAccessoryView extends Component {
|
|
kbComponent,
|
|
onItemSelected,
|
|
onRequestShowKeyboard,
|
|
- useSafeArea
|
|
+ useSafeArea,
|
|
+ scrollViewNativeID
|
|
} = this.props;
|
|
|
|
return (
|
|
@@ -271,6 +278,7 @@ class KeyboardAccessoryView extends Component {
|
|
addBottomView={addBottomView}
|
|
bottomViewColor={this.props.bottomViewColor}
|
|
allowHitsOutsideBounds={allowHitsOutsideBounds}
|
|
+ scrollViewNativeID={scrollViewNativeID}
|
|
>
|
|
{renderContent && renderContent()}
|
|
<CustomKeyboardView
|
|
diff --git a/node_modules/react-native-ui-lib/lib/ios/.DS_Store b/node_modules/react-native-ui-lib/lib/ios/.DS_Store
|
|
new file mode 100644
|
|
index 0000000..e69de29
|
|
diff --git a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h
|
|
index b3864d0..e78322f 100644
|
|
--- a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h
|
|
+++ b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h
|
|
@@ -8,7 +8,7 @@
|
|
#if __has_include(<React/RCTEventEmitter.h>)
|
|
#import <React/RCTEventEmitter.h>
|
|
#else
|
|
-#import "RCTEventEmitter.h"
|
|
+#import <React/RCTEventEmitter.h>
|
|
#endif
|
|
|
|
@interface RCTCustomInputControllerTemp : RCTEventEmitter
|
|
diff --git a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h
|
|
index 4344724..2786051 100644
|
|
--- a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h
|
|
+++ b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h
|
|
@@ -10,7 +10,7 @@
|
|
#if __has_include(<React/RCTRootView.h>)
|
|
#import <React/RCTRootView.h>
|
|
#else
|
|
-#import "RCTRootView.h"
|
|
+#import <React/RCTRootView.h>
|
|
#endif
|
|
|
|
@interface RCTCustomKeyboardViewControllerTemp : UIInputViewController
|
|
diff --git a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m
|
|
index 8f8446e..728bedd 100644
|
|
--- a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m
|
|
+++ b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m
|
|
@@ -43,7 +43,6 @@ @interface KeyboardTrackingViewTemp : UIView
|
|
@property (nonatomic, strong) UIScrollView *scrollViewToManage;
|
|
@property (nonatomic) BOOL scrollIsInverted;
|
|
@property (nonatomic) BOOL revealKeyboardInteractive;
|
|
-@property (nonatomic) BOOL isDraggingScrollView;
|
|
@property (nonatomic) BOOL manageScrollView;
|
|
@property (nonatomic) BOOL requiresSameParentToManageScrollView;
|
|
@property (nonatomic) NSUInteger deferedInitializeAccessoryViewsCount;
|
|
@@ -54,6 +53,7 @@ @interface KeyboardTrackingViewTemp : UIView
|
|
@property (nonatomic) BOOL useSafeArea;
|
|
@property (nonatomic) BOOL scrollToFocusedInput;
|
|
@property (nonatomic) BOOL allowHitsOutsideBounds;
|
|
+@property (nonatomic) NSString* scrollViewNativeID;
|
|
|
|
@end
|
|
|
|
@@ -84,6 +84,7 @@ -(instancetype)init
|
|
self.addBottomView = NO;
|
|
self.bottomViewColor = nil;
|
|
self.scrollToFocusedInput = NO;
|
|
+ self.scrollIsInverted = YES;
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rctContentDidAppearNotification:) name:RCTContentDidAppearNotification object:nil];
|
|
}
|
|
@@ -170,7 +171,6 @@ -(void)layoutSubviews
|
|
- (void)initializeAccessoryViewsAndHandleInsets
|
|
{
|
|
NSArray<UIView*>* allSubviews = [self getBreadthFirstSubviewsForView:[self getRootView]];
|
|
- NSMutableArray<RCTScrollView*>* rctScrollViewsArray = [NSMutableArray array];
|
|
|
|
for (UIView* subview in allSubviews)
|
|
{
|
|
@@ -179,24 +179,13 @@ - (void)initializeAccessoryViewsAndHandleInsets
|
|
{
|
|
if(_scrollViewToManage == nil)
|
|
{
|
|
- if(_requiresSameParentToManageScrollView && [subview isKindOfClass:[RCTScrollView class]] && subview.superview == self.superview)
|
|
+ if([subview isKindOfClass:[RCTScrollView class]])
|
|
{
|
|
- _scrollViewToManage = ((RCTScrollView*)subview).scrollView;
|
|
+ RCTScrollView *scrollView = (RCTScrollView*)subview;
|
|
+ if (subview.nativeID && [subview.nativeID isEqualToString:self.scrollViewNativeID]) {
|
|
+ _scrollViewToManage = scrollView.scrollView;
|
|
+ }
|
|
}
|
|
- else if(!_requiresSameParentToManageScrollView && [subview isKindOfClass:[UIScrollView class]])
|
|
- {
|
|
- _scrollViewToManage = (UIScrollView*)subview;
|
|
- }
|
|
-
|
|
- if(_scrollViewToManage != nil)
|
|
- {
|
|
- _scrollIsInverted = CGAffineTransformEqualToTransform(_scrollViewToManage.superview.transform, CGAffineTransformMakeScale(1, -1));
|
|
- }
|
|
- }
|
|
-
|
|
- if([subview isKindOfClass:[RCTScrollView class]])
|
|
- {
|
|
- [rctScrollViewsArray addObject:(RCTScrollView*)subview];
|
|
}
|
|
}
|
|
|
|
@@ -246,15 +235,15 @@ - (void)initializeAccessoryViewsAndHandleInsets
|
|
}
|
|
}
|
|
|
|
- for (RCTScrollView *scrollView in rctScrollViewsArray)
|
|
- {
|
|
- if(scrollView.scrollView == _scrollViewToManage)
|
|
- {
|
|
- [scrollView removeScrollListener:self];
|
|
- [scrollView addScrollListener:self];
|
|
- break;
|
|
- }
|
|
- }
|
|
+// for (RCTScrollView *scrollView in [_rctScrollViewsArray allValues])
|
|
+// {
|
|
+// if(scrollView.scrollView == _scrollViewToManage)
|
|
+// {
|
|
+// [scrollView removeScrollListener:self];
|
|
+// [scrollView addScrollListener:self];
|
|
+// break;
|
|
+// }
|
|
+// }
|
|
|
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
|
|
if (@available(iOS 11.0, *)) {
|
|
@@ -412,9 +401,6 @@ - (void)_updateScrollViewInsets
|
|
CGFloat bottomSafeArea = [self getBottomSafeArea];
|
|
CGFloat bottomInset = MAX(self.bounds.size.height, _ObservingInputAccessoryViewTemp.keyboardHeight + _ObservingInputAccessoryViewTemp.height);
|
|
|
|
- CGFloat originalBottomInset = self.scrollIsInverted ? insets.top : insets.bottom;
|
|
- CGPoint originalOffset = self.scrollViewToManage.contentOffset;
|
|
-
|
|
bottomInset += (_ObservingInputAccessoryViewTemp.keyboardHeight == 0 ? bottomSafeArea : 0);
|
|
if(self.scrollIsInverted)
|
|
{
|
|
@@ -426,20 +412,11 @@ - (void)_updateScrollViewInsets
|
|
}
|
|
self.scrollViewToManage.contentInset = insets;
|
|
|
|
- if(self.scrollBehavior == KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly && _scrollIsInverted)
|
|
+ BOOL firstTime = _ObservingInputAccessoryViewTemp.keyboardHeight == 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
+ BOOL willOpen = _ObservingInputAccessoryViewTemp.keyboardHeight != 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
+ if(firstTime || willOpen)
|
|
{
|
|
- BOOL fisrtTime = _ObservingInputAccessoryViewTemp.keyboardHeight == 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
- BOOL willOpen = _ObservingInputAccessoryViewTemp.keyboardHeight != 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
- BOOL isOpen = _ObservingInputAccessoryViewTemp.keyboardHeight != 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateShown;
|
|
- if(fisrtTime || willOpen || (isOpen && !self.isDraggingScrollView))
|
|
- {
|
|
- [self.scrollViewToManage setContentOffset:CGPointMake(self.scrollViewToManage.contentOffset.x, -self.scrollViewToManage.contentInset.top) animated:!fisrtTime];
|
|
- }
|
|
- }
|
|
- else if(self.scrollBehavior == KeyboardTrackingScrollBehaviorFixedOffset && !self.isDraggingScrollView)
|
|
- {
|
|
- CGFloat insetsDiff = (bottomInset - originalBottomInset) * (self.scrollIsInverted ? -1 : 1);
|
|
- self.scrollViewToManage.contentOffset = CGPointMake(originalOffset.x, originalOffset.y + insetsDiff);
|
|
+ [self.scrollViewToManage setContentOffset:CGPointMake(self.scrollViewToManage.contentOffset.x, -self.scrollViewToManage.contentInset.top) animated:!firstTime];
|
|
}
|
|
|
|
insets = self.scrollViewToManage.contentInset;
|
|
@@ -468,7 +445,6 @@ -(void)addBottomViewIfNecessary
|
|
if (self.addBottomView && _bottomView == nil)
|
|
{
|
|
_bottomView = [UIView new];
|
|
- // _bottomView.backgroundColor = [UIColor whiteColor];
|
|
if (self.bottomViewColor)
|
|
{
|
|
_bottomView.backgroundColor = [self colorFromHexString:self.bottomViewColor];
|
|
@@ -607,21 +583,6 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
|
}
|
|
}
|
|
|
|
-- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
|
-{
|
|
- self.isDraggingScrollView = YES;
|
|
-}
|
|
-
|
|
-- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
|
|
-{
|
|
- self.isDraggingScrollView = NO;
|
|
-}
|
|
-
|
|
-- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
|
-{
|
|
- self.isDraggingScrollView = NO;
|
|
-}
|
|
-
|
|
- (CGFloat)getKeyboardHeight
|
|
{
|
|
return _ObservingInputAccessoryViewTemp ? _ObservingInputAccessoryViewTemp.keyboardHeight : 0;
|
|
@@ -664,6 +625,7 @@ @implementation KeyboardTrackingViewTempManager
|
|
RCT_REMAP_VIEW_PROPERTY(useSafeArea, useSafeArea, BOOL)
|
|
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
|
|
RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)
|
|
+RCT_EXPORT_VIEW_PROPERTY(scrollViewNativeID, NSString)
|
|
|
|
+ (BOOL)requiresMainQueueSetup
|
|
{
|