Select
October 11, 2018 ยท View on GitHub
User-interactive component.
Select should be wrapped into FormGroup
Public interface
Props
Select contains Picker component from react-native lib. All props for Picker are valid for Select.
Select provide value to Picker by itself, you can't set it manually
Select provide on change to Picker by itself, you can intercept it but you can't take control on value
Select doesn't have onBlur and onFocus events
Also Select (via props) represents FormGroupProvider context from react-formawesome-core package.
Provide own props:
options- values that should be rendered inSelectasPicker.Item.Required.onErrorStyles- styles that applies after failed validation.Optional.
Example
<Form
onSubmit={async (values) => await someRequest(values)}
validator={new SchemaValidator(ExampleSchema)}
errorParser={(error) => myCustomParser(error)}
>
{/*
You can provide 'blur' or 'focus' values to `validateOn` prop,
but it will not take effect, so use 'change' value or function
*/}
<FormGroup attribute="surname" validateOn="change">
<Select
options={[{ value: "java", label: "Java" }, { value: "js", label: "JavaScript" }]}
onErrorStyles={{ borderColor: "red" }}
/>
</FormGroup>
</Form>