diff --git a/KeyboardTrackingView.podspec b/KeyboardTrackingView.podspec new file mode 100644 index 0000000..5df290f --- /dev/null +++ b/KeyboardTrackingView.podspec @@ -0,0 +1,19 @@ +require 'json' +package = JSON.parse(File.read('./package.json')) + +Pod::Spec.new do |s| + s.name = 'KeyboardTrackingView' + s.dependency "React" + + s.version = package["version"] + s.license = package["license"] + s.summary = package["description"] + s.authors = package["author"] + s.homepage = package["homepage"] + + s.platform = :ios, "9.0" + s.requires_arc = true + + s.source = { :git => s.homepage, :tag => s.version } + s.source_files = "lib/**/*.{h,m}" +end diff --git a/lib/KeyboardTrackingViewManager.m b/lib/KeyboardTrackingViewManager.m index 800bd35..f2747cf 100644 --- a/lib/KeyboardTrackingViewManager.m +++ b/lib/KeyboardTrackingViewManager.m @@ -501,12 +501,24 @@ - (void) rctContentDidAppearNotification:(NSNotification*)notification }); } +-(CGFloat)getTabBarHeight { + UITabBarController *tabBarController = (UITabBarController *)[[[UIApplication sharedApplication] delegate] window].rootViewController; + CGFloat tabbarHeight = 0.0f; + + if (!tabBarController.tabBar.isHidden) { + tabbarHeight = tabBarController.tabBar.bounds.size.height; + } + + return tabbarHeight; +} + #pragma mark - ObservingInputAccessoryViewDelegate methods -(void)updateTransformAndInsets { CGFloat bottomSafeArea = [self getBottomSafeArea]; - CGFloat accessoryTranslation = MIN(-bottomSafeArea, -_observingInputAccessoryView.keyboardHeight); + CGFloat tabBarHeight = [self getTabBarHeight]; + CGFloat accessoryTranslation = MIN(-bottomSafeArea, -(_observingInputAccessoryView.keyboardHeight - tabBarHeight)); if (_observingInputAccessoryView.keyboardHeight <= bottomSafeArea) { _bottomViewHeight = kBottomViewHeight; diff --git a/lib/ObservingInputAccessoryView.m b/lib/ObservingInputAccessoryView.m index e472679..0025a45 100644 --- a/lib/ObservingInputAccessoryView.m +++ b/lib/ObservingInputAccessoryView.m @@ -88,8 +88,8 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N CGFloat boundsH = self.superview.bounds.size.height; _previousKeyboardHeight = _keyboardHeight; - _keyboardHeight = MAX(0, self.window.bounds.size.height - (centerY - boundsH / 2) - self.intrinsicContentSize.height); - + _keyboardHeight = MAX(0, self.window.bounds.size.height - (centerY - boundsH / 2) - self.intrinsicContentSize.height); + [_delegate observingInputAccessoryViewDidChangeFrame:self]; } } diff --git a/package.json b/package.json index 13d2c3b..2179f55 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/wix/react-native-keyboard-tracking-view.git" }, - "version": "5.5.0", + "version": "5.5.1", "description": "React Native UI component which tracks the keyboard", "nativePackage": true, "bugs": {