File tree 5 files changed +43
-4
lines changed 5 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -78,12 +78,16 @@ const propTypes = {
78
78
79
79
/** Additional events passed to the core Picker for specific platforms such as web */
80
80
additionalPickerEvents : PropTypes . func ,
81
+
82
+ /** Hint text that appears below the picker */
83
+ hintText : PropTypes . string ,
81
84
} ;
82
85
83
86
const defaultProps = {
84
87
label : '' ,
85
88
isDisabled : false ,
86
89
errorText : '' ,
90
+ hintText : '' ,
87
91
containerStyles : [ ] ,
88
92
backgroundColor : undefined ,
89
93
inputID : undefined ,
@@ -172,6 +176,27 @@ class Picker extends PureComponent {
172
176
render ( ) {
173
177
const hasError = ! _ . isEmpty ( this . props . errorText ) ;
174
178
179
+ if ( this . props . isDisabled ) {
180
+ return (
181
+ < View >
182
+ { this . props . label && (
183
+ < Text style = { [ styles . textLabelSupporting , styles . mb1 ] } numberOfLines = { 1 } >
184
+ { this . props . label }
185
+ </ Text >
186
+ ) }
187
+ < Text numberOfLines = { 1 } >
188
+ { this . props . value }
189
+ </ Text >
190
+ { this . props . hintText
191
+ && (
192
+ < Text style = { [ styles . textLabel , styles . colorMuted , styles . mt2 ] } >
193
+ { this . props . hintText }
194
+ </ Text >
195
+ ) }
196
+ </ View >
197
+ ) ;
198
+ }
199
+
175
200
return (
176
201
< >
177
202
< View
@@ -230,6 +255,12 @@ class Picker extends PureComponent {
230
255
/>
231
256
</ View >
232
257
< FormHelpMessage message = { this . props . errorText } />
258
+ { this . props . hintText
259
+ && (
260
+ < Text style = { [ styles . textLabel , styles . colorMuted , styles . mt2 ] } >
261
+ { this . props . hintText }
262
+ </ Text >
263
+ ) }
233
264
</ >
234
265
) ;
235
266
}
Original file line number Diff line number Diff line change @@ -1031,6 +1031,7 @@ export default {
1031
1031
nameIsRequiredError : 'You need to define a name for your workspace.' ,
1032
1032
currencyInputLabel : 'Default currency' ,
1033
1033
currencyInputHelpText : 'All expenses on this workspace will be converted to this currency.' ,
1034
+ currencyInputDisabledText : 'The default currency can\'t be changed because this workspace is linked to a USD bank account.' ,
1034
1035
save : 'Save' ,
1035
1036
genericFailureMessage : 'An error occurred updating the workspace, please try again.' ,
1036
1037
avatarUploadFailureMessage : 'An error occurred uploading the avatar, please try again.' ,
Original file line number Diff line number Diff line change @@ -1032,6 +1032,7 @@ export default {
1032
1032
nameIsRequiredError : 'Debes definir un nombre para tu espacio de trabajo.' ,
1033
1033
currencyInputLabel : 'Moneda por defecto' ,
1034
1034
currencyInputHelpText : 'Todas los gastos en este espacio de trabajo serán convertidos a esta moneda.' ,
1035
+ currencyInputDisabledText : 'La moneda predeterminada no se puede cambiar porque este espacio de trabajo está vinculado a una cuenta bancaria en USD.' ,
1035
1036
save : 'Guardar' ,
1036
1037
genericFailureMessage : 'Se produjo un error al guardar el espacio de trabajo. Por favor, inténtalo de nuevo.' ,
1037
1038
avatarUploadFailureMessage : 'No se pudo subir el avatar. Por favor, inténtalo de nuevo.' ,
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import lodashGet from 'lodash/get';
7
7
import ONYXKEYS from '../../ONYXKEYS' ;
8
8
import withLocalize , { withLocalizePropTypes } from '../../components/withLocalize' ;
9
9
import styles from '../../styles/styles' ;
10
- import Text from '../../components/Text' ;
11
10
import compose from '../../libs/compose' ;
12
11
import * as Policy from '../../libs/actions/Policy' ;
13
12
import * as Expensicons from '../../components/Icon/Expensicons' ;
@@ -143,11 +142,13 @@ class WorkspaceSettingsPage extends React.Component {
143
142
items = { this . getCurrencyItems ( ) }
144
143
isDisabled = { hasVBA }
145
144
defaultValue = { this . props . policy . outputCurrency }
145
+ hintText = {
146
+ hasVBA
147
+ ? this . props . translate ( 'workspace.editor.currencyInputDisabledText' )
148
+ : this . props . translate ( 'workspace.editor.currencyInputHelpText' )
149
+ }
146
150
/>
147
151
</ View >
148
- < Text style = { [ styles . textLabel , styles . colorMuted , styles . mt2 ] } >
149
- { this . props . translate ( 'workspace.editor.currencyInputHelpText' ) }
150
- </ Text >
151
152
</ OfflineWithFeedback >
152
153
</ Form >
153
154
) }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const Default = Template.bind({});
31
31
Default . args = {
32
32
label : 'Default picker' ,
33
33
name : 'Default' ,
34
+ hintText : 'Default hint text' ,
34
35
items : [
35
36
{
36
37
label : 'Orange' ,
@@ -48,6 +49,7 @@ PickerWithValue.args = {
48
49
label : 'Picker with defined value' ,
49
50
name : 'Picker with defined value' ,
50
51
value : 'apple' ,
52
+ hintText : 'Picker with hint text' ,
51
53
items : [
52
54
{
53
55
label : 'Orange' ,
@@ -64,6 +66,7 @@ const ErrorStory = Template.bind({});
64
66
ErrorStory . args = {
65
67
label : 'Picker with error' ,
66
68
name : 'PickerWithError' ,
69
+ hintText : 'Picker hint text' ,
67
70
errorText : 'This field has an error.' ,
68
71
items : [
69
72
{
@@ -81,7 +84,9 @@ const Disabled = Template.bind({});
81
84
Disabled . args = {
82
85
label : 'Picker disabled' ,
83
86
name : 'Disabled' ,
87
+ value : 'orange' ,
84
88
isDisabled : true ,
89
+ hintText : 'Picker hint text' ,
85
90
items : [
86
91
{
87
92
label : 'Orange' ,
You can’t perform that action at this time.
0 commit comments