Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions KeyboardTrackingView.podspec
Original file line number Diff line number Diff line change
@@ -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
14 changes: 13 additions & 1 deletion lib/KeyboardTrackingViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/ObservingInputAccessoryView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down