Rocket.Chat.ReactNative/patches/@react-native-community+dat...

66 lines
2.9 KiB
Diff
Raw Normal View History

2020-02-11 14:01:35 +00:00
diff --git a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
index ad3a9b3..1c347bd 100644
--- a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
+++ b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
@@ -25,6 +25,8 @@ - (instancetype)initWithFrame:(CGRect)frame
[self addTarget:self action:@selector(didChange)
forControlEvents:UIControlEventValueChanged];
_reactMinuteInterval = 1;
+ [self performSelector:@selector(setHighlightsToday:)
+ withObject:[NSNumber numberWithBool:NO]];
}
return self;
}
@@ -38,6 +40,20 @@ - (void)didChange
}
}
+-(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)setColor:(NSString *)color
+{
+ [self setValue:[self colorFromHexString:color] forKey:@"textColor"];
+}
+
- (void)setDatePickerMode:(UIDatePickerMode)datePickerMode
{
[super setDatePickerMode:datePickerMode];
diff --git a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerManager.m b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerManager.m
index 661e1f1..771c0c4 100644
--- a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerManager.m
+++ b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerManager.m
@@ -39,5 +39,6 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, UIDatePickerMode)
RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone)
+RCT_REMAP_VIEW_PROPERTY(color, color, NSString)
@end
diff --git a/node_modules/@react-native-community/datetimepicker/src/datetimepicker.ios.js b/node_modules/@react-native-community/datetimepicker/src/datetimepicker.ios.js
index 3b25e16..4bf210a 100644
--- a/node_modules/@react-native-community/datetimepicker/src/datetimepicker.ios.js
+++ b/node_modules/@react-native-community/datetimepicker/src/datetimepicker.ios.js
@@ -69,6 +69,7 @@ export default class Picker extends React.Component<IOSNativeProps> {
mode,
minuteInterval,
timeZoneOffsetInMinutes,
+ textColor
} = this.props;
invariant(value, 'A date or time should be specified as `value`.');
@@ -92,6 +93,7 @@ export default class Picker extends React.Component<IOSNativeProps> {
onChange={this._onChange}
onStartShouldSetResponder={() => true}
onResponderTerminationRequest={() => false}
+ color={textColor}
/>
</View>
);