Tcomb-form-native: Password field type?

Created on 3 Apr 2015  Â·  4Comments  Â·  Source: gcanti/tcomb-form-native

Awesome plugin!

Is there a way to set a field type as password so the characters become dotted out and not viewable while typing?

Thanks,
-Tim

Enhancement

Most helpful comment

It seems ok. This is my test case and it works (tcomb-form-native v0.1.6, react-native v0.3.4):

var Type = t.struct({
  password: t.Str
});

var options = {
  fields: {
    password: {
      password: true,
      secureTextEntry: true
    }
  }
};

var AwesomeProject = React.createClass({

  onPress: function () {
    var value = this.refs.form.getValue();
    if (value) {
      console.log(value);
    }
  },

  render: function() {
    return (
      <View style={styles.container}>
        <Form
          ref="form"
          type={Type}
          options={options}
        />
        <TouchableHighlight style={styles.button} onPress={this.onPress} underlayColor='#99d9f4'>
          <Text style={styles.buttonText}>Save</Text>
        </TouchableHighlight>
      </View>
    );
  }
});

All 4 comments

It will lend soon: secureTextEntry https://github.com/facebook/react-native/pull/265

Is my structure or syntax incorrect for this?

var options = {
fields: {
password: {
password: true,
secureTextEntry: true,
}
}
};

On Sun, Apr 5, 2015 at 10:24 AM, Giulio Canti [email protected]
wrote:

Closed #4 https://github.com/gcanti/tcomb-form-native/issues/4 via
6a61000
https://github.com/gcanti/tcomb-form-native/commit/6a61000c49924a277fc5fb8bb4cc170123c42091
.

—
Reply to this email directly or view it on GitHub
https://github.com/gcanti/tcomb-form-native/issues/4#event-273669922.

It seems ok. This is my test case and it works (tcomb-form-native v0.1.6, react-native v0.3.4):

var Type = t.struct({
  password: t.Str
});

var options = {
  fields: {
    password: {
      password: true,
      secureTextEntry: true
    }
  }
};

var AwesomeProject = React.createClass({

  onPress: function () {
    var value = this.refs.form.getValue();
    if (value) {
      console.log(value);
    }
  },

  render: function() {
    return (
      <View style={styles.container}>
        <Form
          ref="form"
          type={Type}
          options={options}
        />
        <TouchableHighlight style={styles.button} onPress={this.onPress} underlayColor='#99d9f4'>
          <Text style={styles.buttonText}>Save</Text>
        </TouchableHighlight>
      </View>
    );
  }
});

which is the 'password' option used for? is not enough with secureTextEntry?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BogdanHossu picture BogdanHossu  Â·  6Comments

abdelghafourzguindou picture abdelghafourzguindou  Â·  4Comments

newbreedofgeek picture newbreedofgeek  Â·  6Comments

ishigamii picture ishigamii  Â·  3Comments

flyingace picture flyingace  Â·  5Comments