Rocket.Chat.ReactNative/patches/react-native-ui-lib+7.0.0.p...

159 lines
6.9 KiB
Diff
Raw Normal View History

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..a191c82 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,12 @@ class KeyboardAccessoryView extends Component {
* Whether or not to handle SafeArea
* default: true
*/
- useSafeArea: PropTypes.bool
+ useSafeArea: PropTypes.bool,
+
+ onHeightChange: PropTypes.shape({
+ height: PropTypes.number,
+ keyboardHeight: PropTypes.number
+ })
};
static iosScrollBehaviors = IOS_SCROLL_BEHAVIORS;
@@ -271,6 +276,7 @@ class KeyboardAccessoryView extends Component {
addBottomView={addBottomView}
bottomViewColor={this.props.bottomViewColor}
allowHitsOutsideBounds={allowHitsOutsideBounds}
+ onHeightChange={this.props.onHeightChange}
>
{renderContent && renderContent()}
<CustomKeyboardView
diff --git a/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView.ios.js b/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView.ios.js
index 60e3fe6..cad78a6 100644
--- a/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView.ios.js
+++ b/node_modules/react-native-ui-lib/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView.ios.js
@@ -33,7 +33,8 @@ class KeyboardTrackingView extends PureComponent {
/**
* Allow control safe area
*/
- useSafeArea: PropTypes.bool
+ useSafeArea: PropTypes.bool,
+ onHeightChange: PropTypes.func,
};
/** V6 should be change to default false */
2024-01-25 14:11:07 +00:00
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 97255d2..3e5537c 100644
2024-01-25 14:11:07 +00:00
--- 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
@@ -54,6 +54,7 @@ @interface KeyboardTrackingViewTemp : UIView
@property (nonatomic) BOOL useSafeArea;
@property (nonatomic) BOOL scrollToFocusedInput;
@property (nonatomic) BOOL allowHitsOutsideBounds;
+@property (nonatomic, copy) RCTBubblingEventBlock onHeightChange;
@end
@@ -364,6 +365,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
2024-01-25 14:11:07 +00:00
- (void)ObservingInputAccessoryViewTempKeyboardWillDisappear:(ObservingInputAccessoryViewTemp *)ObservingInputAccessoryViewTemp
{
_bottomViewHeight = kBottomViewHeightTemp;
+ _ObservingInputAccessoryViewTemp.height = 0;
[self updateBottomViewFrame];
}
@@ -554,6 +556,11 @@ -(void)updateTransformAndInsets
self.transform = CGAffineTransformMakeTranslation(0, accessoryTranslation);
[self _updateScrollViewInsets];
+
+ if (self.onHeightChange) {
+ self.onHeightChange(@{ @"height": @(self.bounds.size.height), @"keyboardHeight": @(_ObservingInputAccessoryViewTemp.keyboardHeight) });
+ }
+
}
- (void)performScrollToFocusedInput
@@ -673,6 +680,9 @@ @implementation KeyboardTrackingViewTempManager
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)
+RCT_EXPORT_VIEW_PROPERTY(onHeightChange, RCTBubblingEventBlock)
+
+
+ (BOOL)requiresMainQueueSetup
{
return YES;
diff --git a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m
2024-01-25 14:11:07 +00:00
index 1ca52e8..69ac77a 100644
--- a/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m
+++ b/node_modules/react-native-ui-lib/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m
2024-01-25 14:11:07 +00:00
@@ -111,44 +111,57 @@ - (void)setHeight:(CGFloat)height
_height = height;
[self invalidateIntrinsicContentSize];
+ [_delegate ObservingInputAccessoryViewTempDidChangeFrame:self];
}
- (void)_keyboardWillShowNotification:(NSNotification*)notification
{
- _keyboardState = KeyboardStateWillShow;
2024-01-25 14:11:07 +00:00
+ if (_keyboardState == KeyboardStateHidden) {
+ _keyboardState = KeyboardStateWillShow;
2024-01-25 14:11:07 +00:00
- [self invalidateIntrinsicContentSize];
+ [self invalidateIntrinsicContentSize];
2024-01-25 14:11:07 +00:00
- if([_delegate respondsToSelector:@selector(ObservingInputAccessoryViewTempKeyboardWillAppear:keyboardDelta:)])
- {
- [_delegate ObservingInputAccessoryViewTempKeyboardWillAppear:self keyboardDelta:_keyboardHeight - _previousKeyboardHeight];
+ if([_delegate respondsToSelector:@selector(ObservingInputAccessoryViewTempKeyboardWillAppear:keyboardDelta:)])
+ {
+ [_delegate ObservingInputAccessoryViewTempKeyboardWillAppear:self keyboardDelta:_keyboardHeight - _previousKeyboardHeight];
+ }
}
}
- (void)_keyboardDidShowNotification:(NSNotification*)notification
{
- _keyboardState = KeyboardStateShown;
2024-01-25 14:11:07 +00:00
+ if (_keyboardState == KeyboardStateWillShow) {
+ _keyboardState = KeyboardStateShown;
2024-01-25 14:11:07 +00:00
- [self invalidateIntrinsicContentSize];
+ [self invalidateIntrinsicContentSize];
+ }
}
- (void)_keyboardWillHideNotification:(NSNotification*)notification
2024-01-25 14:11:07 +00:00
{
- _keyboardState = KeyboardStateWillHide;
+ if (_keyboardState == KeyboardStateShown) {
+ _keyboardState = KeyboardStateWillHide;
2024-01-25 14:11:07 +00:00
- [self invalidateIntrinsicContentSize];
+ [self invalidateIntrinsicContentSize];
2024-01-25 14:11:07 +00:00
- if([_delegate respondsToSelector:@selector(ObservingInputAccessoryViewTempKeyboardWillDisappear:)])
- {
- [_delegate ObservingInputAccessoryViewTempKeyboardWillDisappear:self];
+ [_delegate ObservingInputAccessoryViewTempDidChangeFrame:self];
+
+ if([_delegate respondsToSelector:@selector(ObservingInputAccessoryViewTempKeyboardWillDisappear:)])
+ {
+ [_delegate ObservingInputAccessoryViewTempKeyboardWillDisappear:self];
+ }
}
}
- (void)_keyboardDidHideNotification:(NSNotification*)notification
{
- _keyboardState = KeyboardStateHidden;
+ if (_keyboardState == KeyboardStateWillHide) {
+ _keyboardState = KeyboardStateHidden;
2024-01-25 14:11:07 +00:00
- [self invalidateIntrinsicContentSize];
+ [self invalidateIntrinsicContentSize];
+
+ [_delegate ObservingInputAccessoryViewTempDidChangeFrame:self];
+ }
}
- (void)_keyboardWillChangeFrameNotification:(NSNotification*)notification