Skip to content

Commit

Permalink
Input: added disabled prop
Browse files Browse the repository at this point in the history
  • Loading branch information
budiadiono committed Oct 17, 2018
1 parent 5419afb commit ca58682
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@ import React from 'react'
import { FormInput, FormInputProps } from 'react-native-elements'
import { globalStyles } from '../styles'
import { FormField, FormFieldProps } from './FormField'
import { StaticField } from './StaticField'

export interface InputProps extends FormInputProps {}
export interface InputProps extends FormInputProps {
disabled?: boolean
}

export const Input = withTheme<InputProps & FormFieldProps>(
({ theme, label, errors, inputStyle, ...rest }) => {
({ theme, label, errors, inputStyle, disabled, ...rest }) => {
if (disabled) {
return (
<StaticField
label={label}
value={rest.value || ''}
labelStyle={rest.labelStyle}
containerStyle={rest.containerStyle}
valueStyle={inputStyle}
/>
)
}

return (
<FormField
label={label}
Expand Down

0 comments on commit ca58682

Please sign in to comment.