@@ -74,108 +74,111 @@ const Select = ({
7474 // TODO: native prop to use native select
7575
7676 return (
77- < TouchableHighlight
78- { ...rest }
79- onPress = { ( ) => setIsOpen ( currentIsOpen => ! currentIsOpen ) }
80- activeOpacity = { 1 }
81- disabled = { disabled }
82- onHideUnderlay = { ( ) => setIsPressed ( false ) }
83- onShowUnderlay = { ( ) => setIsPressed ( true ) }
84- // TODO: accessibility
85- // accessibilityTraits
86- // accessibilityComponentType
87- // accessibilityRole
88- // accessibilityState
89- underlayColor = 'none'
90- >
91- < View style = { [ styles . wrapper , style ] } >
92- < Border variant = 'cutout' />
93- < View style = { [ styles . flex ] } >
94- < View
95- style = { [
96- styles . selectValue ,
97- { backgroundColor : disabled ? theme . material : theme . canvas } ,
98- ] }
99- >
77+ < View style = { [ styles . wrapper , style ] } { ...rest } >
78+ < Border variant = 'cutout' />
79+ < TouchableHighlight
80+ onPress = { ( ) => setIsOpen ( currentIsOpen => ! currentIsOpen ) }
81+ activeOpacity = { 1 }
82+ disabled = { disabled }
83+ onHideUnderlay = { ( ) => setIsPressed ( false ) }
84+ onShowUnderlay = { ( ) => setIsPressed ( true ) }
85+ // TODO: accessibility
86+ // accessibilityTraits
87+ // accessibilityComponentType
88+ // accessibilityRole
89+ // accessibilityState
90+ underlayColor = 'none'
91+ >
92+ < View style = { [ styles . inner ] } >
93+ < View style = { [ styles . flex ] } >
10094 < View
10195 style = { [
102- styles . center ,
103- {
104- borderWidth : 2 ,
105- borderColor : disabled ? theme . material : theme . canvas ,
106- backgroundColor : getLabelContainerBackgroundColor ( ) ,
107- } ,
108-
109- isPressed && theme . border . focusSecondaryOutline ,
96+ styles . selectValue ,
97+ { backgroundColor : disabled ? theme . material : theme . canvas } ,
11098 ] }
11199 >
112- < Text
100+ < View
113101 style = { [
114- styles . textValue ,
115- disabled ? theme . text . disabled : theme . text . default ,
116- ! disabled &&
117- isPressed && {
118- color : isPressed
119- ? theme . canvasTextInvert
120- : theme . canvasText ,
121- } ,
102+ styles . center ,
103+ {
104+ borderWidth : 2 ,
105+ borderColor : disabled ? theme . material : theme . canvas ,
106+ backgroundColor : getLabelContainerBackgroundColor ( ) ,
107+ } ,
108+
109+ isPressed && theme . border . focusSecondaryOutline ,
122110 ] }
123111 >
124- { selectedOption . label }
125- </ Text >
112+ < Text
113+ style = { [
114+ styles . textValue ,
115+ disabled ? theme . text . disabled : theme . text . default ,
116+ ! disabled &&
117+ isPressed && {
118+ color : isPressed
119+ ? theme . canvasTextInvert
120+ : theme . canvasText ,
121+ } ,
122+ ] }
123+ >
124+ { selectedOption . label }
125+ </ Text >
126+ </ View >
127+ </ View >
128+ < View
129+ style = { [ styles . fakeButton , { backgroundColor : theme . material } ] }
130+ >
131+ < ImageBackground
132+ style = { [
133+ {
134+ marginTop : isPressed ? 1 : 0 ,
135+ width : '100%' ,
136+ height : '100%' ,
137+ } ,
138+ ] }
139+ imageStyle = { {
140+ resizeMode : 'contain' ,
141+ flex : 1 ,
142+ } }
143+ source = { {
144+ uri : dropdownSymbol [ disabled ? 'disabled' : 'default' ] ,
145+ } }
146+ />
147+ < Border
148+ variant = { isPressed ? 'default' : 'outside' }
149+ invert = { isPressed }
150+ />
126151 </ View >
127152 </ View >
128- < View
129- style = { [ styles . fakeButton , { backgroundColor : theme . material } ] }
130- >
131- < ImageBackground
153+ { isOpen && (
154+ < View
132155 style = { [
156+ styles . options ,
133157 {
134- marginTop : isPressed ? 1 : 0 ,
135- width : '100%' ,
136- height : '100%' ,
158+ height : menuMaxHeight || 'auto' ,
159+ backgroundColor : theme . canvas ,
160+ borderColor : theme . borderDarkest ,
137161 } ,
138162 ] }
139- imageStyle = { {
140- resizeMode : 'contain' ,
141- flex : 1 ,
142- } }
143- source = { {
144- uri : dropdownSymbol [ disabled ? 'disabled' : 'default' ] ,
145- } }
146- />
147- < Border
148- variant = { isPressed ? 'default' : 'outside' }
149- invert = { isPressed }
150- />
151- </ View >
163+ >
164+ < ScrollView > { selectOptions } </ ScrollView >
165+ </ View >
166+ ) }
152167 </ View >
153- { isOpen && (
154- < View
155- style = { [
156- styles . options ,
157- {
158- height : menuMaxHeight || 'auto' ,
159- backgroundColor : theme . canvas ,
160- borderColor : theme . borderDarkest ,
161- } ,
162- ] }
163- >
164- < ScrollView > { selectOptions } </ ScrollView >
165- </ View >
166- ) }
167- </ View >
168- </ TouchableHighlight >
168+ </ TouchableHighlight >
169+ </ View >
169170 ) ;
170171} ;
171172
172173const selectHeight = blockSizes . md ;
173174
174175const styles = StyleSheet . create ( {
175176 wrapper : {
176- position : 'relative' ,
177177 height : selectHeight ,
178178 alignSelf : 'flex-start' ,
179+ } ,
180+ inner : {
181+ position : 'relative' ,
179182 padding : 4 ,
180183 } ,
181184 flex : {
0 commit comments