Coder Social home page Coder Social logo

Comments (4)

gcanti avatar gcanti commented on August 23, 2024

This is my test case and it works fine:

  • tcomb-form-native v0.2.2
  • react-native v0.5.0
  • XCode 6.2
  • IOS Simulator 8.2 (iPhone 6)

Which version of react-native are you using?

'use strict';

var React = require('react-native');
var t = require('.');
var stylesheet = require('./lib/stylesheets/bootstrap');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
  TextInput
} = React;

var Form = t.form.Form;

var Credentials = t.struct({
  username: t.Str,
  password: t.Str
});

var AwesomeProject = React.createClass({

  getInitialState() {
    return {
      value: {},
      options: {
        fields: {
          password: {
            label: 'mylabel',
            placeholder: 'my placeholder',
            error: 'my error',
            password: true
          }
        }
      }
    };
  },

  onChange(value) {
    this.setState({value});
  },

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

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

var styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: 50,
    padding: 20,
    //backgroundColor: '#333333'
    backgroundColor: '#ffffff'
  },
  title: {
    fontSize: 30,
    alignSelf: 'center',
    marginBottom: 30
  },
  buttonText: {
    fontSize: 18,
    color: 'white',
    alignSelf: 'center'
  },
  button: {
    height: 36,
    backgroundColor: '#48BBEC',
    borderColor: '#48BBEC',
    borderWidth: 1,
    borderRadius: 8,
    marginBottom: 10,
    alignSelf: 'stretch',
    justifyContent: 'center'
  }
});

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

from tcomb-form-native.

mschipperheyn avatar mschipperheyn commented on August 23, 2024

Hmm, weird. I'm on
react-native v.0.6.0 (the problem occurred after upgrading)
IOS Simulator 8.2 (iPhone 6, tried a variety of deployment targets)

from tcomb-form-native.

eyaleizenberg avatar eyaleizenberg commented on August 23, 2024

@mschipperheyn you need to add secureTextEntry so it looks like this

password: {
      password: true,
      secureTextEntry: true
}

from tcomb-form-native.

mschipperheyn avatar mschipperheyn commented on August 23, 2024

ah ok. I wasn't aware of that. Ah, ok. This allows you to implement a "show password" feature

from tcomb-form-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.