-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statepicker refactored to compatible with form #8758
Changes from 6 commits
ee883a3
0aba0ff
339d441
9e93cda
cee55cb
3a09b5c
a8d30f4
cae92e8
7597a8a
2349a7c
dcdb112
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ class CompanyStep extends React.Component { | |
incorporationDateFuture: 'bankAccount.error.incorporationDateFuture', | ||
incorporationType: 'bankAccount.error.companyType', | ||
hasNoConnectionToCannabis: 'bankAccount.error.restrictedBusiness', | ||
incorporationState: 'bankAccount.error.incorporationState', | ||
}; | ||
|
||
this.getErrorText = inputKey => ReimbursementAccountUtils.getErrorText(this.props, this.errorTranslationKeys, inputKey); | ||
|
@@ -287,9 +288,9 @@ class CompanyStep extends React.Component { | |
<View style={styles.mt4}> | ||
<StatePicker | ||
label={this.props.translate('companyStep.incorporationState')} | ||
onChange={value => this.clearErrorAndSetValue('incorporationState', value)} | ||
onInputChange={value => this.clearErrorAndSetValue('incorporationState', value)} | ||
value={this.state.incorporationState} | ||
hasError={this.getErrors().incorporationState} | ||
errorText={this.getErrorText('incorporationState')} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
/> | ||
</View> | ||
<CheckboxWithLabel | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import React, {useState} from 'react'; | |
import {View} from 'react-native'; | ||
import TextInput from '../components/TextInput'; | ||
import Picker from '../components/Picker'; | ||
import StatePicker from '../components/StatePicker'; | ||
import AddressSearch from '../components/AddressSearch'; | ||
import Form from '../components/Form'; | ||
import * as FormActions from '../libs/actions/FormActions'; | ||
|
@@ -22,6 +23,7 @@ const story = { | |
AddressSearch, | ||
CheckboxWithLabel, | ||
Picker, | ||
StatePicker, | ||
}, | ||
}; | ||
|
||
|
@@ -97,6 +99,13 @@ const Template = (args) => { | |
]} | ||
isFormInput | ||
/> | ||
<View style={styles.mt4}> | ||
<StatePicker | ||
inputID="pickState" | ||
shouldSaveDraft | ||
isFormInput | ||
/> | ||
</View> | ||
<CheckboxWithLabel | ||
inputID="checkbox" | ||
style={[styles.mb4, styles.mt5]} | ||
|
@@ -164,6 +173,9 @@ const defaultArgs = { | |
if (!values.pickAnotherFruit) { | ||
errors.pickAnotherFruit = 'Please select a fruit'; | ||
} | ||
if (!values.pickState) { | ||
errors.pickState = 'Please select a state'; | ||
} | ||
if (!values.checkbox) { | ||
errors.checkbox = 'You must accept the Terms of Service to continue'; | ||
} | ||
|
@@ -198,6 +210,7 @@ InputError.args = { | |
accountNumber: '', | ||
pickFruit: '', | ||
pickAnotherFruit: '', | ||
pickState: '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add a non-empty default value for During my testing, the default value didn't seem to work properly on page load. storybook.movThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have to add 1 more prop in StatePicker for this change, we need to pass defaultValue to make it work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a default value for pickState, but we also have to pass defaultValue in StatePicker component, please let me know your thought on this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds similar to what I'm doing in the Datepicker refactor. If that's the case I think it's fine :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, then its fine There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm the default value still doesn't load for me. Can you please check? default.movThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @luacmartins we need to pass defaultValue as a prop in StatePicker here
as this value is being used in the BasePicker |
||
checkbox: false, | ||
}, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I see this console warning:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's solved now, now tested the app in the web and no error is there and picker is working
tested in storybook , its working fine and no console error
storybook-test.mov