Skip to content

feat/tracking view allow safeArea #1017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 3, 2020
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ class KeyboardTrackingView extends PureComponent {
* (This is caused because of the usage of inputAccessory to be able to track the
* keyboard interactive change and it introduces this bug)
*/
trackInteractive: PropTypes.bool
trackInteractive: PropTypes.bool,
/**
* Allow control safe area
*/
useSafeArea: PropTypes.bool
};

/** V6 should be change to default false */
static defaultProps = {
useSafeArea: true
};

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ @interface KeyboardTrackingViewTemp : UIView
@property (nonatomic) CGFloat originalHeight;
@property (nonatomic) KeyboardTrackingScrollBehavior scrollBehavior;
@property (nonatomic) BOOL addBottomView;
@property (nonatomic) BOOL useSafeArea;
@property (nonatomic) BOOL scrollToFocusedInput;
@property (nonatomic) BOOL allowHitsOutsideBounds;

Expand Down Expand Up @@ -483,7 +484,7 @@ -(CGFloat)getBottomSafeArea
{
CGFloat bottomSafeArea = 0;
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
if (@available(iOS 11.0, *)) {
if (@available(iOS 11.0, *) && self.useSafeArea) {
bottomSafeArea = self.superview ? self.superview.safeAreaInsets.bottom : self.safeAreaInsets.bottom;
}
#endif
Expand Down Expand Up @@ -632,6 +633,7 @@ @implementation KeyboardTrackingViewTempManager
RCT_REMAP_VIEW_PROPERTY(manageScrollView, manageScrollView, BOOL)
RCT_REMAP_VIEW_PROPERTY(requiresSameParentToManageScrollView, requiresSameParentToManageScrollView, BOOL)
RCT_REMAP_VIEW_PROPERTY(addBottomView, addBottomView, BOOL)
RCT_REMAP_VIEW_PROPERTY(useSafeArea, useSafeArea, BOOL)
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)

Expand Down