verdnatura-chat/patches/react-native-keyboard-track...

85 lines
3.6 KiB
Diff
Raw Normal View History

2019-12-04 16:39:53 +00:00
diff --git a/node_modules/react-native-keyboard-tracking-view/lib/KeyboardTrackingViewManager.m b/node_modules/react-native-keyboard-tracking-view/lib/KeyboardTrackingViewManager.m
index 800bd35..6e98112 100644
--- a/node_modules/react-native-keyboard-tracking-view/lib/KeyboardTrackingViewManager.m
+++ b/node_modules/react-native-keyboard-tracking-view/lib/KeyboardTrackingViewManager.m
@@ -49,6 +49,7 @@ @interface KeyboardTrackingView : UIView
@property (nonatomic) CGFloat originalHeight;
@property (nonatomic) KeyboardTrackingScrollBehavior scrollBehavior;
@property (nonatomic) BOOL addBottomView;
+@property (nonatomic) NSString* bottomViewColor;
@property (nonatomic) BOOL scrollToFocusedInput;
@property (nonatomic) BOOL allowHitsOutsideBounds;
@@ -79,6 +80,7 @@ -(instancetype)init
_bottomViewHeight = kBottomViewHeight;
self.addBottomView = NO;
+ self.bottomViewColor = nil;
self.scrollToFocusedInput = NO;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rctContentDidAppearNotification:) name:RCTContentDidAppearNotification object:nil];
@@ -442,12 +444,28 @@ -(void)setAddBottomView:(BOOL)addBottomView
[self addBottomViewIfNecessary];
}
+-(UIColor *)colorFromHexString:(NSString *)hexString
+{
+ unsigned rgbValue = 0;
+ NSScanner *scanner = [NSScanner scannerWithString:hexString];
+ [scanner setScanLocation:1]; // bypass '#' character
+ [scanner scanHexInt:&rgbValue];
+ return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
+}
+
-(void)addBottomViewIfNecessary
{
if (self.addBottomView && _bottomView == nil)
{
_bottomView = [UIView new];
- _bottomView.backgroundColor = [UIColor whiteColor];
+ if (self.bottomViewColor)
+ {
+ _bottomView.backgroundColor = [self colorFromHexString:self.bottomViewColor];
+ }
+ else
+ {
+ _bottomView.backgroundColor = [UIColor whiteColor];
+ }
[self addSubview:_bottomView];
[self updateBottomViewFrame];
}
@@ -631,6 +649,7 @@ @implementation KeyboardTrackingViewManager
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(bottomViewColor, bottomViewColor, NSString)
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)
diff --git a/node_modules/react-native-keyboard-tracking-view/react-native-keyboard-tracking-view.podspec b/node_modules/react-native-keyboard-tracking-view/react-native-keyboard-tracking-view.podspec
new file mode 100644
index 0000000..a6dbe01
--- /dev/null
+++ b/node_modules/react-native-keyboard-tracking-view/react-native-keyboard-tracking-view.podspec
@@ -0,0 +1,19 @@
+require 'json'
+
+package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
+
+Pod::Spec.new do |s|
+ s.name = package['name']
+ s.version = package['version']
+ s.summary = package['description']
+ s.license = package['license']
+
+ s.authors = package['author']
+ s.homepage = package['homepage']
+ s.platform = :ios, "9.0"
+
+ s.source = { :git => "https://github.com/wix/react-native-keyboard-tracking-view.git", :tag => "v#{s.version}" }
+ s.source_files = "lib/**/*.{h,m}"
+
+ s.dependency 'React'
+end
\ No newline at end of file