@@ -19,125 +19,6 @@ import {NO_DATA} from "../../constants/Autocomplete";
19
19
import { theme } from "../../constants/Theme" ;
20
20
import locales from "../../constants/Locales" ;
21
21
export default class Dropdown extends PureComponent {
22
- static defaultProps = {
23
- noDataText : locales . components . Autocomplete . noData ,
24
- hitSlop : { top : 6 , right : 4 , bottom : 6 , left : 4 } ,
25
- disabled : false ,
26
- data : [ ] ,
27
- valueExtractor : ( { value} = { } ) => value ,
28
- propsExtractor : ( ) => null ,
29
- dropdownOffset : {
30
- top : 50 ,
31
- left : 20 ,
32
- } ,
33
- dropdownMargins : {
34
- min : 8 ,
35
- max : 16 ,
36
- } ,
37
- rippleCentered : false ,
38
- rippleSequential : true ,
39
- rippleInsets : {
40
- top : 16 ,
41
- right : 0 ,
42
- bottom : - 8 ,
43
- left : 0 ,
44
- } ,
45
- rippleOpacity : 0.54 ,
46
- shadeOpacity : 0.12 ,
47
- rippleDuration : 400 ,
48
- animationDuration : 225 ,
49
- fontSize : theme . sizes . size16 ,
50
- textColor : "rgba(0, 0, 0, .87)" ,
51
- itemColor : "rgba(0, 0, 0, .54)" ,
52
- baseColor : "rgba(0, 0, 0, .38)" ,
53
- itemCount : 4 ,
54
- itemPadding : 8 ,
55
- supportedOrientations : [
56
- "portrait" ,
57
- "portrait-upside-down" ,
58
- "landscape" ,
59
- "landscape-left" ,
60
- "landscape-right" ,
61
- ] ,
62
- useNativeDriver : false ,
63
- } ;
64
-
65
- static propTypes = {
66
- disabled : PropTypes . bool ,
67
-
68
- value : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
69
-
70
- data : PropTypes . arrayOf (
71
- PropTypes . oneOfType ( PropTypes . object , PropTypes . string ) ,
72
- ) ,
73
-
74
- valueExtractor : PropTypes . func ,
75
- labelExtractor : PropTypes . func ,
76
- propsExtractor : PropTypes . func ,
77
-
78
- absoluteRTLLayout : PropTypes . bool ,
79
-
80
- dropdownOffset : PropTypes . shape ( {
81
- top : PropTypes . number . isRequired ,
82
- left : PropTypes . number . isRequired ,
83
- } ) ,
84
-
85
- dropdownMargins : PropTypes . shape ( {
86
- min : PropTypes . number . isRequired ,
87
- max : PropTypes . number . isRequired ,
88
- } ) ,
89
-
90
- dropdownPosition : PropTypes . number ,
91
-
92
- rippleColor : PropTypes . string ,
93
- rippleCentered : PropTypes . bool ,
94
- rippleSequential : PropTypes . bool ,
95
-
96
- rippleInsets : PropTypes . shape ( {
97
- top : PropTypes . number ,
98
- right : PropTypes . number ,
99
- bottom : PropTypes . number ,
100
- left : PropTypes . number ,
101
- } ) ,
102
-
103
- rippleOpacity : PropTypes . number ,
104
- shadeOpacity : PropTypes . number ,
105
-
106
- rippleDuration : PropTypes . number ,
107
- animationDuration : PropTypes . number ,
108
-
109
- fontSize : PropTypes . number ,
110
-
111
- textColor : PropTypes . string ,
112
- itemColor : PropTypes . string ,
113
- selectedItemColor : PropTypes . string ,
114
- disabledItemColor : PropTypes . string ,
115
- baseColor : PropTypes . string ,
116
-
117
- itemTextStyle : Text . propTypes . style ,
118
- separatorStyle : ( ViewPropTypes || View . propTypes ) . style ,
119
- listFooterStyle : ( ViewPropTypes || View . propTypes ) . style ,
120
-
121
- itemCount : PropTypes . number ,
122
- itemPadding : PropTypes . number ,
123
-
124
- onLayout : PropTypes . func ,
125
- onFocus : PropTypes . func ,
126
- onBlur : PropTypes . func ,
127
- onChangeText : PropTypes . func ,
128
-
129
- renderBase : PropTypes . func ,
130
- renderAccessory : PropTypes . func ,
131
-
132
- containerStyle : ( ViewPropTypes || View . propTypes ) . style ,
133
- overlayStyle : ( ViewPropTypes || View . propTypes ) . style ,
134
- pickerStyle : ( ViewPropTypes || View . propTypes ) . style ,
135
-
136
- supportedOrientations : PropTypes . arrayOf ( PropTypes . string ) ,
137
-
138
- useNativeDriver : PropTypes . bool ,
139
- } ;
140
-
141
22
constructor ( props ) {
142
23
super ( props ) ;
143
24
@@ -507,11 +388,11 @@ export default class Dropdown extends PureComponent {
507
388
} ,
508
389
rightContent
509
390
? {
510
- display : "flex" ,
511
- flexDirection : "row" ,
512
- justifyContent : "space-between" ,
513
- alignItems : "center" ,
514
- }
391
+ display : "flex" ,
392
+ flexDirection : "row" ,
393
+ justifyContent : "space-between" ,
394
+ alignItems : "center" ,
395
+ }
515
396
: { } ,
516
397
] ;
517
398
@@ -555,10 +436,10 @@ export default class Dropdown extends PureComponent {
555
436
}
556
437
557
438
renderHeader ( ) {
558
- const { listHeader} = this . props ;
439
+ const { listHeader, listHeaderStyle } = this . props ;
559
440
560
441
return listHeader ? (
561
- < View style = { [ styles . listItem , styles . listHeader ] } >
442
+ < View style = { [ styles . listItem , styles . listHeader , listHeaderStyle ] } >
562
443
< Text style = { styles . listHeaderText } key = { listHeader } size = { 17 } >
563
444
{ listHeader . toUpperCase ( ) }
564
445
</ Text >
@@ -627,3 +508,127 @@ export default class Dropdown extends PureComponent {
627
508
) ;
628
509
}
629
510
}
511
+
512
+ Dropdown . propTypes = {
513
+ noDataText : PropTypes . string ,
514
+ hitSlop : PropTypes . object ,
515
+ onChangeValue : PropTypes . func ,
516
+ inputValue : PropTypes . string ,
517
+ listHeader : PropTypes . string ,
518
+ disabled : PropTypes . bool ,
519
+
520
+ value : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
521
+
522
+ data : PropTypes . arrayOf (
523
+ PropTypes . oneOfType ( [ PropTypes . object , PropTypes . string ] ) ,
524
+ ) ,
525
+
526
+ valueExtractor : PropTypes . func ,
527
+ labelExtractor : PropTypes . func ,
528
+ propsExtractor : PropTypes . func ,
529
+
530
+ absoluteRTLLayout : PropTypes . bool ,
531
+
532
+ dropdownOffset : PropTypes . shape ( {
533
+ top : PropTypes . number . isRequired ,
534
+ left : PropTypes . number . isRequired ,
535
+ } ) ,
536
+
537
+ dropdownMargins : PropTypes . shape ( {
538
+ min : PropTypes . number . isRequired ,
539
+ max : PropTypes . number . isRequired ,
540
+ } ) ,
541
+
542
+ dropdownPosition : PropTypes . number ,
543
+
544
+ rippleColor : PropTypes . string ,
545
+ rippleCentered : PropTypes . bool ,
546
+ rippleSequential : PropTypes . bool ,
547
+
548
+ rippleInsets : PropTypes . shape ( {
549
+ top : PropTypes . number ,
550
+ right : PropTypes . number ,
551
+ bottom : PropTypes . number ,
552
+ left : PropTypes . number ,
553
+ } ) ,
554
+
555
+ rippleOpacity : PropTypes . number ,
556
+ shadeOpacity : PropTypes . number ,
557
+
558
+ rippleDuration : PropTypes . number ,
559
+ animationDuration : PropTypes . number ,
560
+
561
+ fontSize : PropTypes . number ,
562
+
563
+ textColor : PropTypes . string ,
564
+ itemColor : PropTypes . string ,
565
+ selectedItemColor : PropTypes . string ,
566
+ disabledItemColor : PropTypes . string ,
567
+ baseColor : PropTypes . string ,
568
+
569
+ itemTextStyle : Text . propTypes . style ,
570
+ separatorStyle : ( ViewPropTypes || View . propTypes ) . style ,
571
+ listFooterStyle : ( ViewPropTypes || View . propTypes ) . style ,
572
+ listHeaderStyle : ( ViewPropTypes || View . propTypes ) . style ,
573
+ itemCount : PropTypes . number ,
574
+ itemPadding : PropTypes . number ,
575
+
576
+ onLayout : PropTypes . func ,
577
+ onFocus : PropTypes . func ,
578
+ onBlur : PropTypes . func ,
579
+ onChangeText : PropTypes . func ,
580
+
581
+ renderBase : PropTypes . func ,
582
+ renderAccessory : PropTypes . func ,
583
+
584
+ containerStyle : ( ViewPropTypes || View . propTypes ) . style ,
585
+ overlayStyle : ( ViewPropTypes || View . propTypes ) . style ,
586
+ pickerStyle : ( ViewPropTypes || View . propTypes ) . style ,
587
+
588
+ supportedOrientations : PropTypes . arrayOf ( PropTypes . string ) ,
589
+
590
+ useNativeDriver : PropTypes . bool ,
591
+ } ;
592
+
593
+ Dropdown . defaultProps = {
594
+ noDataText : locales . components . Autocomplete . noData ,
595
+ hitSlop : { top : 6 , right : 4 , bottom : 6 , left : 4 } ,
596
+ disabled : false ,
597
+ data : [ ] ,
598
+ valueExtractor : ( { value} = { } ) => value ,
599
+ propsExtractor : ( ) => null ,
600
+ dropdownOffset : {
601
+ top : 50 ,
602
+ left : 20 ,
603
+ } ,
604
+ dropdownMargins : {
605
+ min : 8 ,
606
+ max : 16 ,
607
+ } ,
608
+ rippleCentered : false ,
609
+ rippleSequential : true ,
610
+ rippleInsets : {
611
+ top : 16 ,
612
+ right : 0 ,
613
+ bottom : - 8 ,
614
+ left : 0 ,
615
+ } ,
616
+ rippleOpacity : 0.54 ,
617
+ shadeOpacity : 0.12 ,
618
+ rippleDuration : 400 ,
619
+ animationDuration : 225 ,
620
+ fontSize : theme . sizes . size16 ,
621
+ textColor : "rgba(0, 0, 0, .87)" ,
622
+ itemColor : "rgba(0, 0, 0, .54)" ,
623
+ baseColor : "rgba(0, 0, 0, .38)" ,
624
+ itemCount : 4 ,
625
+ itemPadding : 8 ,
626
+ supportedOrientations : [
627
+ "portrait" ,
628
+ "portrait-upside-down" ,
629
+ "landscape" ,
630
+ "landscape-left" ,
631
+ "landscape-right" ,
632
+ ] ,
633
+ useNativeDriver : false ,
634
+ } ;
0 commit comments