Skip to content

Commit 2fdcad1

Browse files
committed
Moving back to UIColor
1 parent 6dc16e0 commit 2fdcad1

File tree

6 files changed

+20
-45
lines changed

6 files changed

+20
-45
lines changed

demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
6262
const {trackInteractive} = this.state;
6363

6464
return (
65-
<View flex bg-blue80 paddingT-page>
65+
<View flex bg-grey80 paddingT-page>
6666
<ScrollView
6767
contentContainerStyle={styles.scrollContainer}
6868
keyboardDismissMode={trackInteractive ? 'interactive' : 'none'}
@@ -89,9 +89,9 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
8989
trackInteractive={trackInteractive}
9090
useSafeArea
9191
addBottomView
92-
bottomViewColor={Colors.grey80}
92+
bottomViewColor={Colors.violet80}
9393
>
94-
<View bg-grey80 row spread centerV paddingH-s5 paddingV-s3>
94+
<View bg-violet80 row spread centerV paddingH-s5 paddingV-s3>
9595
<TextField
9696
migrate
9797
containerStyle={styles.textField}
@@ -121,7 +121,7 @@ const styles = StyleSheet.create({
121121
},
122122
textField: {
123123
flex: 1,
124-
backgroundColor: Colors.grey50,
124+
backgroundColor: Colors.grey80,
125125
paddingVertical: Spacings.s2,
126126
paddingHorizontal: Spacings.s4,
127127
borderRadius: 8

lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export type KeyboardAccessoryViewProps = {
102102
addBottomView?: boolean;
103103
/**
104104
* iOS only.
105-
* The bottom view's color as an hex string
106-
* default: '#ffffff'
105+
* The bottom view's color
106+
* default: 'white'
107107
*/
108108
bottomViewColor?: string;
109109
/**

lib/components/Keyboard/KeyboardInput/keyboardAccessoryView.api.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@
8888
{
8989
"name": "bottomViewColor",
9090
"type": "string",
91-
"description": "The bottom view's color as an hex string\niOS only.",
91+
"description": "The bottom view's color\niOS only.",
9292
"note": "KeyboardTrackingView prop. iOS only",
93-
"default": "#ffffff"
93+
"default": "white"
9494
},
9595
{
9696
"name": "useSafeArea",

lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export type KeyboardTrackingViewProps = ViewProps & {
5555
addBottomView?: boolean;
5656
/**
5757
* iOS only.
58-
* The bottom view's color as an hex string
59-
* default: '#ffffff'
58+
* The bottom view's color
59+
* default: 'white'
6060
*/
6161
bottomViewColor?: string;
6262
/**

lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/keyboardTrackingView.api.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
{
5454
"name": "bottomViewColor",
5555
"type": "string",
56-
"description": "The bottom view's color as an hex string\niOS only.",
56+
"description": "The bottom view's color\niOS only.",
5757
"note": "iOS only",
58-
"default": "#ffffff"
58+
"default": "white"
5959
},
6060
{
6161
"name": "useSafeArea",

lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ @interface KeyboardTrackingViewTemp : UIView
5050
@property (nonatomic) CGFloat originalHeight;
5151
@property (nonatomic) KeyboardTrackingScrollBehavior scrollBehavior;
5252
@property (nonatomic) BOOL addBottomView;
53-
@property (nonatomic, strong) NSString *bottomViewColor;
53+
@property (nonatomic, strong) UIColor *bottomViewColor;
5454
@property (nonatomic) BOOL useSafeArea;
5555
@property (nonatomic) BOOL usesBottomTabs;
5656
@property (nonatomic) BOOL scrollToFocusedInput;
@@ -83,7 +83,7 @@ -(instancetype)init
8383
_bottomViewHeight = kBottomViewHeightTemp;
8484

8585
self.addBottomView = NO;
86-
self.bottomViewColor = @"#ffffff";
86+
self.bottomViewColor = [UIColor whiteColor];
8787
self.scrollToFocusedInput = NO;
8888
self.usesBottomTabs = NO;
8989

@@ -442,44 +442,19 @@ - (void)_updateScrollViewInsets
442442

443443
#pragma mark - bottom view
444444

445-
- (unsigned int)intFromHexString:(NSString *)hexStr
446-
{
447-
unsigned int hexInt = 0;
448-
// Create scanner
449-
NSScanner *scanner = [NSScanner scannerWithString:hexStr];
450-
// Tell scanner to skip the # character
451-
[scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"#"]];
452-
// Scan hex value
453-
[scanner scanHexInt:&hexInt];
454-
return hexInt;
455-
}
456-
457-
- (UIColor *)getUIColorObjectFromHexString:(NSString *)hexStr alpha:(CGFloat)alpha
458-
{
459-
// Convert hex string to an integer
460-
unsigned int hexint = [self intFromHexString:hexStr];
461-
// Create a color object, specifying alpha as well
462-
UIColor *color =
463-
[UIColor colorWithRed:((CGFloat) ((hexint & 0xFF0000) >> 16))/255
464-
green:((CGFloat) ((hexint & 0xFF00) >> 8))/255
465-
blue:((CGFloat) (hexint & 0xFF))/255
466-
alpha:alpha];
467-
return color;
468-
}
469-
470445
-(void)setAddBottomView:(BOOL)addBottomView
471446
{
472447
_addBottomView = addBottomView;
473448

474449
[self addBottomViewIfNecessary];
475450
}
476451

477-
-(void)setBottomViewColor:(NSString *)bottomViewColor
452+
-(void)setBottomViewColor:(UIColor *)bottomViewColor
478453
{
479454
_bottomViewColor = bottomViewColor;
480-
455+
481456
if (self.addBottomView && _bottomView != nil) {
482-
_bottomView.backgroundColor = [self getUIColorObjectFromHexString:_bottomViewColor alpha:1];
457+
_bottomView.backgroundColor = _bottomViewColor;
483458
}
484459
}
485460

@@ -488,8 +463,8 @@ -(void)addBottomViewIfNecessary
488463
if (self.addBottomView && _bottomView == nil)
489464
{
490465
_bottomView = [UIView new];
491-
_bottomView.backgroundColor = [self getUIColorObjectFromHexString:self.bottomViewColor alpha:1];
492-
466+
_bottomView.backgroundColor = self.bottomViewColor;
467+
493468
[self addSubview:_bottomView];
494469
[self updateBottomViewFrame];
495470
}
@@ -691,7 +666,7 @@ @implementation KeyboardTrackingViewTempManager
691666
RCT_REMAP_VIEW_PROPERTY(manageScrollView, manageScrollView, BOOL)
692667
RCT_REMAP_VIEW_PROPERTY(requiresSameParentToManageScrollView, requiresSameParentToManageScrollView, BOOL)
693668
RCT_REMAP_VIEW_PROPERTY(addBottomView, addBottomView, BOOL)
694-
RCT_REMAP_VIEW_PROPERTY(bottomViewColor, bottomViewColor, NSString)
669+
RCT_REMAP_VIEW_PROPERTY(bottomViewColor, bottomViewColor, UIColor)
695670
RCT_REMAP_VIEW_PROPERTY(useSafeArea, useSafeArea, BOOL)
696671
RCT_REMAP_VIEW_PROPERTY(usesBottomTabs, usesBottomTabs, BOOL)
697672
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)

0 commit comments

Comments
 (0)