function textbox(locals) {
  let stylesheet = locals.stylesheet
  let errorBlockStyle = stylesheet.errorBlock
  let textboxStyle = stylesheet.textbox.normal
  let controlLabelStyle = stylesheet.controlLabel.normal

  if (locals.hasError) {
    textboxStyle = stylesheet.textbox.error
  }

  if (locals.editable === false) {
    textboxStyle = stylesheet.textbox.notEditable
  }

  if (locals.multiline === true) {
    textboxStyle = stylesheet.textbox.multiline
  }

  let error = locals.hasError && locals.error ? <Text style={errorBlockStyle}>{locals.error}</Text> : null
  let label = locals.label ? <View style={[BaseStyles.marginVert, BaseStyles.marginHorz]}><Text style={controlLabelStyle}>{locals.label}</Text></View> : null

  return (
    <View>
      {label}
      <View style={[
        BaseStyles.whiteBg,
        BaseStyles.paddingHorz,
        BaseStyles.paddingVertSmall
      ]}>
        <View style={[
          BaseStyles.borderBottomLight
        ]}>
          <TextInput
            ref="input"
            autoCapitalize={locals.autoCapitalize}
            autoCorrect={locals.autoCorrect}
            autoFocus={locals.autoFocus}
            bufferDelay={locals.bufferDelay}
            clearButtonMode={locals.clearButtonMode}
            editable={locals.editable}
            enablesReturnKeyAutomatically={locals.enablesReturnKeyAutomatically}
            keyboardType={locals.keyboardType}
            multiline={locals.multiline}
            onBlur={locals.onBlur}
            onEndEditing={locals.onEndEditing}
            onFocus={locals.onFocus}
            onSubmitEditing={locals.onSubmitEditing}
            password={locals.password}
            placeholderTextColor={locals.placeholderTextColor}
            returnKeyType={locals.returnKeyType}
            selectTextOnFocus={locals.selectTextOnFocus}
            secureTextEntry={locals.secureTextEntry}
            selectionState={locals.selectionState}
            onChangeText={(value) => locals.onChange(value)}
            placeholder={locals.placeholder}
            style={textboxStyle}
            value={locals.value} />
        </View>
        {error}
      </View>
    </View>
  )
}
/**
 * Custom textbox to be use with the Tcomb form plugin.
 *
 * @param  {object} locals - props passed from tcomb library
 * @return {object} component
 */
Custom textbox to be use with the Tcomb form plugin.
@param  {object} locals - props passed from tcomb library
@return {object} component
Custom textbox to be use with the Tcomb form plugin . @param { object } locals - props passed from tcomb library @return { object } component
function textbox(locals) {
  let stylesheet = locals.stylesheet
  let errorBlockStyle = stylesheet.errorBlock
  let textboxStyle = stylesheet.textbox.normal
  let controlLabelStyle = stylesheet.controlLabel.normal
  if (locals.hasError) {
    textboxStyle = stylesheet.textbox.error
  }
  if (locals.editable === false) {
    textboxStyle = stylesheet.textbox.notEditable
  }
  if (locals.multiline === true) {
    textboxStyle = stylesheet.textbox.multiline
  }
  let error = locals.hasError && locals.error ? <Text style={errorBlockStyle}>{locals.error}</Text> : null
  let label = locals.label ? <View style={[BaseStyles.marginVert, BaseStyles.marginHorz]}><Text style={controlLabelStyle}>{locals.label}</Text></View> : null
  return (
    <View>
      {label}
      <View style={[
        BaseStyles.whiteBg,
        BaseStyles.paddingHorz,
        BaseStyles.paddingVertSmall
      ]}>
        <View style={[
          BaseStyles.borderBottomLight
        ]}>
          <TextInput
            ref="input"
            autoCapitalize={locals.autoCapitalize}
            autoCorrect={locals.autoCorrect}
            autoFocus={locals.autoFocus}
            bufferDelay={locals.bufferDelay}
            clearButtonMode={locals.clearButtonMode}
            editable={locals.editable}
            enablesReturnKeyAutomatically={locals.enablesReturnKeyAutomatically}
            keyboardType={locals.keyboardType}
            multiline={locals.multiline}
            onBlur={locals.onBlur}
            onEndEditing={locals.onEndEditing}
            onFocus={locals.onFocus}
            onSubmitEditing={locals.onSubmitEditing}
            password={locals.password}
            placeholderTextColor={locals.placeholderTextColor}
            returnKeyType={locals.returnKeyType}
            selectTextOnFocus={locals.selectTextOnFocus}
            secureTextEntry={locals.secureTextEntry}
            selectionState={locals.selectionState}
            onChangeText={(value) => locals.onChange(value)}
            placeholder={locals.placeholder}
            style={textboxStyle}
            value={locals.value} />
        </View>
        {error}
      </View>
    </View>
  )
}
function textbox ( locals ) { let stylesheet = locals . stylesheet let errorBlockStyle = stylesheet . errorBlock let textboxStyle = stylesheet . textbox . normal let controlLabelStyle = stylesheet . controlLabel . normal if ( locals . hasError ) { textboxStyle = stylesheet . textbox . error } if ( locals . editable === false ) { textboxStyle = stylesheet . textbox . notEditable } if ( locals . multiline === true ) { textboxStyle = stylesheet . textbox . multiline } let error = locals . hasError && locals . error ? < Text style = { errorBlockStyle } > { locals . error } < / Text > : null let label = locals . label ? < View style = { [ BaseStyles . marginVert , BaseStyles . marginHorz ] } > < Text style = { controlLabelStyle } > { locals . label } < / Text > < / View > : null return ( < View > { label } < View style = { [ BaseStyles . whiteBg , BaseStyles . paddingHorz , BaseStyles . paddingVertSmall ] } > < View style = { [ BaseStyles . borderBottomLight ] } > < TextInput ref = "input" autoCapitalize = { locals . autoCapitalize } autoCorrect = { locals . autoCorrect } autoFocus = { locals . autoFocus } bufferDelay = { locals . bufferDelay } clearButtonMode = { locals . clearButtonMode } editable = { locals . editable } enablesReturnKeyAutomatically = { locals . enablesReturnKeyAutomatically } keyboardType = { locals . keyboardType } multiline = { locals . multiline } onBlur = { locals . onBlur } onEndEditing = { locals . onEndEditing } onFocus = { locals . onFocus } onSubmitEditing = { locals . onSubmitEditing } password = { locals . password } placeholderTextColor = { locals . placeholderTextColor } returnKeyType = { locals . returnKeyType } selectTextOnFocus = { locals . selectTextOnFocus } secureTextEntry = { locals . secureTextEntry } selectionState = { locals . selectionState } onChangeText = { ( value ) => locals . onChange ( value ) } placeholder = { locals . placeholder } style = { textboxStyle } value = { locals . value } / > < / View > { error } < / View > < / View > ) }
Custom textbox to be use with the Tcomb form plugin.
Custom textbox to be use with the Tcomb form plugin .