score:0

export default class TextInputField extends React.Component<IComponentProps, IComponentState> {

    constructor(props: IComponentProps) {
        super(props)
    }
    static defaultProps = {
       isMultiline: false,
       nextButtonText: "Next",
       onSubmit: () => true,
       showNextButton: true,
    }
    public render() {
        const {
        keyboardType,
        label,
        nextButtonText,
        onSubmit,
        placeholderText,
        showNextButton,
        isMultiline
        } = this.props

    const textBoxHeight = isMultiline ? 150 : 50

        return (
        <View>
          <Text style={styles.label}> {this.props.label} </Text>
          <TextInput
            multiline={isMultiline}
            numberOfLines={5}
            style={[styles.textInput, { height: textBoxHeight }]}
            placeholder={placeholderText}
            placeholderTextColor={colors.light_gray}
            keyboardType={keyboardType}
            onBlur={showNextButton ? undefined : onSubmit}
          />

          {showNextButton &&
            <MyButton
              title={nextButtonText}
              onPress={onSubmit}
            />
          }
        </View>
    )

  }
}

Related Query

More Query from same tag