1- import React from "react" ;
2- import PropTypes from "prop-types" ;
3- import {
4- StyleSheet ,
5- Text ,
6- TouchableHighlight ,
7- View ,
8- Appearance ,
9- } from "react-native" ;
10- import DateTimePicker from "@react-native-community/datetimepicker" ;
11- import Modal from "./Modal" ;
12- import { isIphoneX } from "./utils" ;
1+ import React from 'react' ;
2+ import PropTypes from 'prop-types' ;
3+ import { StyleSheet , Text , TouchableHighlight , View , Appearance } from 'react-native' ;
4+ import DateTimePicker from '@react-native-community/datetimepicker' ;
5+ import Modal from './Modal' ;
6+ import { isIphoneX } from './utils' ;
137
14- export const BACKGROUND_COLOR_LIGHT = " white" ;
15- export const BACKGROUND_COLOR_DARK = " #0E0E0E" ;
16- export const BORDER_COLOR = " #d5d5d5" ;
17- export const BORDER_COLOR_DARK = " #272729" ;
8+ export const BACKGROUND_COLOR_LIGHT = ' white' ;
9+ export const BACKGROUND_COLOR_DARK = ' #0E0E0E' ;
10+ export const BORDER_COLOR = ' #d5d5d5' ;
11+ export const BORDER_COLOR_DARK = ' #272729' ;
1812export const BORDER_RADIUS = 13 ;
19- export const BUTTON_FONT_WEIGHT = " normal" ;
20- export const BUTTON_FONT_COLOR = " #007ff9" ;
13+ export const BUTTON_FONT_WEIGHT = ' normal' ;
14+ export const BUTTON_FONT_COLOR = ' #007ff9' ;
2115export const BUTTON_FONT_SIZE = 20 ;
22- export const HIGHLIGHT_COLOR_DARK = " #444444" ;
23- export const HIGHLIGHT_COLOR_LIGHT = " #ebebeb" ;
16+ export const HIGHLIGHT_COLOR_DARK = ' #444444' ;
17+ export const HIGHLIGHT_COLOR_LIGHT = ' #ebebeb' ;
2418
2519export class DateTimePickerModal extends React . PureComponent {
2620 static propTypes = {
@@ -50,8 +44,8 @@ export class DateTimePickerModal extends React.PureComponent {
5044 } ;
5145
5246 static defaultProps = {
53- cancelTextIOS : " Cancel" ,
54- confirmTextIOS : " Confirm" ,
47+ cancelTextIOS : ' Cancel' ,
48+ confirmTextIOS : ' Confirm' ,
5549 modalPropsIOS : { } ,
5650 date : new Date ( ) ,
5751 isDarkModeEnabled : undefined ,
@@ -126,12 +120,10 @@ export class DateTimePickerModal extends React.PureComponent {
126120 buttonTextColorIOS,
127121 ...otherProps
128122 } = this . props ;
129- const isAppearanceModuleAvailable = ! ! (
130- Appearance && Appearance . getColorScheme
131- ) ;
123+ const isAppearanceModuleAvailable = ! ! ( Appearance && Appearance . getColorScheme ) ;
132124 const _isDarkModeEnabled =
133125 isDarkModeEnabled === undefined && isAppearanceModuleAvailable
134- ? Appearance . getColorScheme ( ) === " dark"
126+ ? Appearance . getColorScheme ( ) === ' dark'
135127 : isDarkModeEnabled || false ;
136128
137129 const ConfirmButtonComponent = customConfirmButtonIOS || ConfirmButton ;
@@ -152,27 +144,17 @@ export class DateTimePickerModal extends React.PureComponent {
152144 backdropStyle = { backdropStyleIOS }
153145 { ...modalPropsIOS }
154146 >
155- < View
156- style = { [
157- pickerStyles . container ,
158- themedContainerStyle ,
159- pickerContainerStyleIOS ,
160- ] }
161- >
147+ < View style = { [ pickerStyles . container , themedContainerStyle , pickerContainerStyleIOS ] } >
162148 { HeaderComponent && < HeaderComponent /> }
163- { ! HeaderComponent && display === "inline" && (
164- < View style = { pickerStyles . headerFiller } />
165- ) }
149+ { ! HeaderComponent && display === 'inline' && < View style = { pickerStyles . headerFiller } /> }
166150 < View
167151 style = { [
168- display === "inline"
169- ? pickerStyles . pickerInline
170- : pickerStyles . pickerSpinner ,
152+ display === 'inline' ? pickerStyles . pickerInline : pickerStyles . pickerSpinner ,
171153 pickerStyleIOS ,
172154 ] }
173155 >
174156 < PickerComponent
175- display = { display || " spinner" }
157+ display = { display || ' spinner' }
176158 { ...otherProps }
177159 value = { this . state . currentDate }
178160 onChange = { this . handleChange }
@@ -200,13 +182,13 @@ export class DateTimePickerModal extends React.PureComponent {
200182
201183const pickerStyles = StyleSheet . create ( {
202184 modal : {
203- justifyContent : " flex-end" ,
185+ justifyContent : ' flex-end' ,
204186 margin : 10 ,
205187 } ,
206188 container : {
207189 borderRadius : BORDER_RADIUS ,
208190 marginBottom : 8 ,
209- overflow : " hidden" ,
191+ overflow : ' hidden' ,
210192 } ,
211193 pickerSpinner : {
212194 marginBottom : 8 ,
@@ -235,9 +217,7 @@ export const ConfirmButton = ({
235217 ? confirmButtonStyles . buttonDark
236218 : confirmButtonStyles . buttonLight ;
237219
238- const underlayColor = isDarkModeEnabled
239- ? HIGHLIGHT_COLOR_DARK
240- : HIGHLIGHT_COLOR_LIGHT ;
220+ const underlayColor = isDarkModeEnabled ? HIGHLIGHT_COLOR_DARK : HIGHLIGHT_COLOR_LIGHT ;
241221 return (
242222 < TouchableHighlight
243223 testID = { confirmButtonTestID }
@@ -248,24 +228,17 @@ export const ConfirmButton = ({
248228 accessibilityRole = "button"
249229 accessibilityLabel = { label }
250230 >
251- < Text
252- style = { [
253- style . text ,
254- buttonTextColorIOS && { color : buttonTextColorIOS } ,
255- ] }
256- >
257- { label }
258- </ Text >
231+ < Text style = { [ style . text , buttonTextColorIOS && { color : buttonTextColorIOS } ] } > { label } </ Text >
259232 </ TouchableHighlight >
260233 ) ;
261234} ;
262235
263236export const confirmButtonStyles = StyleSheet . create ( {
264237 button : {
265238 borderTopWidth : StyleSheet . hairlineWidth ,
266- backgroundColor : " transparent" ,
239+ backgroundColor : ' transparent' ,
267240 height : 57 ,
268- justifyContent : " center" ,
241+ justifyContent : ' center' ,
269242 } ,
270243 buttonLight : {
271244 borderColor : BORDER_COLOR ,
@@ -274,11 +247,11 @@ export const confirmButtonStyles = StyleSheet.create({
274247 borderColor : BORDER_COLOR_DARK ,
275248 } ,
276249 text : {
277- textAlign : " center" ,
250+ textAlign : ' center' ,
278251 color : BUTTON_FONT_COLOR ,
279252 fontSize : BUTTON_FONT_SIZE ,
280253 fontWeight : BUTTON_FONT_WEIGHT ,
281- backgroundColor : " transparent" ,
254+ backgroundColor : ' transparent' ,
282255 } ,
283256} ) ;
284257
@@ -293,9 +266,7 @@ export const CancelButton = ({
293266 const themedButtonStyle = isDarkModeEnabled
294267 ? cancelButtonStyles . buttonDark
295268 : cancelButtonStyles . buttonLight ;
296- const underlayColor = isDarkModeEnabled
297- ? HIGHLIGHT_COLOR_DARK
298- : HIGHLIGHT_COLOR_LIGHT ;
269+ const underlayColor = isDarkModeEnabled ? HIGHLIGHT_COLOR_DARK : HIGHLIGHT_COLOR_LIGHT ;
299270 return (
300271 < TouchableHighlight
301272 testID = { cancelButtonTestID }
@@ -306,14 +277,7 @@ export const CancelButton = ({
306277 accessibilityRole = "button"
307278 accessibilityLabel = { label }
308279 >
309- < Text
310- style = { [
311- style . text ,
312- buttonTextColorIOS && { color : buttonTextColorIOS } ,
313- ] }
314- >
315- { label }
316- </ Text >
280+ < Text style = { [ style . text , buttonTextColorIOS && { color : buttonTextColorIOS } ] } > { label } </ Text >
317281 </ TouchableHighlight >
318282 ) ;
319283} ;
@@ -323,7 +287,7 @@ export const cancelButtonStyles = StyleSheet.create({
323287 borderRadius : BORDER_RADIUS ,
324288 height : 57 ,
325289 marginBottom : isIphoneX ( ) ? 20 : 0 ,
326- justifyContent : " center" ,
290+ justifyContent : ' center' ,
327291 } ,
328292 buttonLight : {
329293 backgroundColor : BACKGROUND_COLOR_LIGHT ,
@@ -333,10 +297,10 @@ export const cancelButtonStyles = StyleSheet.create({
333297 } ,
334298 text : {
335299 padding : 10 ,
336- textAlign : " center" ,
300+ textAlign : ' center' ,
337301 color : BUTTON_FONT_COLOR ,
338302 fontSize : BUTTON_FONT_SIZE ,
339- fontWeight : " 600" ,
340- backgroundColor : " transparent" ,
303+ fontWeight : ' 600' ,
304+ backgroundColor : ' transparent' ,
341305 } ,
342306} ) ;
0 commit comments