Tcomb-form-native: TextInput not scrolling after being filled

Created on 30 Aug 2017  路  3Comments  路  Source: gcanti/tcomb-form-native

Hi, I am currently having a trouble with the default behavior of the library for t.String items

My configuration

  • tcomb-form-native v0.6.9
  • react-native v0.46.1

Expected behaviour

When typing in the textInput and reaching the end of the visible zone, the visible view should scroll to show what the user is tipping.

Actual behaviour

When typing in the textInput and reaching the end of the visible zone, the user can still type but he can't see what he is typing after that point.

Steps to reproduce

I reproduced it with my own project, and also just using the example simple project (https://github.com/gcanti/tcomb-form-native#example)
I am using a stackNavigator around it but I don't think It may change anything in this case.

Stack trace and console log

No error or stack trace is launched

Most helpful comment

After looking into the style of the library I found out the problem in the ROOT_PROJECT/node_modules/tcomb-form-native/lib/stylesheets/bootstrap.js

 textbox: {
    normal: {
      color: INPUT_COLOR,
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: BORDER_COLOR,
      borderWidth: 1,
      marginBottom: 5
    },
    // the style applied when a validation error occours
    error: {
      color: INPUT_COLOR,
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: ERROR_COLOR,
      borderWidth: 1,
      marginBottom: 5
    },
    // the style applied when the textbox is not editable
    notEditable: {
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: BORDER_COLOR,
      borderWidth: 1,
      marginBottom: 5,
      color: DISABLED_COLOR,
      backgroundColor: DISABLED_BACKGROUND_COLOR
    }
  },

The height:36 block the ui, removing it makes it works

All 3 comments

Video of the problem

Using my project :

var Email = t.refinement(t.String, function (n) {
  var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
  return n.match(emailRegex) ? true : false;
});

var Login = t.struct({
  login: Email,
  password: t.String,
});

var loginOptions = {
  auto: 'placeholders',
  fields: {
    login: {
      error: 'Identifiant incorrect',
      autoCapitalize: "none",
      autoCorrect: false,
      underlineColorAndroid: 'transparent',
      placeholder: 'Identifiant',
      keyboardType: 'email-address',
      blurOnSubmit: true
    },
    password: {
      error: 'Mot de passe incorrect',
      autoCapitalize: "none",
      autoCorrect: false,
      secureTextEntry: true,
      underlineColorAndroid: 'transparent',
      placeholder: 'Mot de passe',
      blurOnSubmit: true,
    }
  }
};
          <Form
            ref="form"
            type={Login}
            options={loginOptions} />

After looking into the style of the library I found out the problem in the ROOT_PROJECT/node_modules/tcomb-form-native/lib/stylesheets/bootstrap.js

 textbox: {
    normal: {
      color: INPUT_COLOR,
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: BORDER_COLOR,
      borderWidth: 1,
      marginBottom: 5
    },
    // the style applied when a validation error occours
    error: {
      color: INPUT_COLOR,
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: ERROR_COLOR,
      borderWidth: 1,
      marginBottom: 5
    },
    // the style applied when the textbox is not editable
    notEditable: {
      fontSize: FONT_SIZE,
      //height: 36,
      paddingVertical: (Platform.OS === 'ios') ? 7 : 0,
      paddingHorizontal: 7,
      borderRadius: 4,
      borderColor: BORDER_COLOR,
      borderWidth: 1,
      marginBottom: 5,
      color: DISABLED_COLOR,
      backgroundColor: DISABLED_BACKGROUND_COLOR
    }
  },

The height:36 block the ui, removing it makes it works

That works! What in the world does height have to do with horizontal scrolling!?!?!?!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muthuraman007 picture muthuraman007  路  4Comments

sibelius picture sibelius  路  4Comments

newbreedofgeek picture newbreedofgeek  路  6Comments

ilyadoroshin picture ilyadoroshin  路  4Comments

casoetan picture casoetan  路  5Comments