{"action":"closed","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/1202","labels_url":"https://api.github.com/repos/facebook/react-native/issues/1202/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/1202/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/1202/events","html_url":"https://github.com/facebook/react-native/issues/1202","id":74421913,"number":1202,"title":"TextInput preventDefault","user":{"login":"ranyefet","id":1016375,"avatar_url":"https://avatars.githubusercontent.com/u/1016375?v=3","gravatar_id":"","url":"https://api.github.com/users/ranyefet","html_url":"https://github.com/ranyefet","followers_url":"https://api.github.com/users/ranyefet/followers","following_url":"https://api.github.com/users/ranyefet/following{/other_user}","gists_url":"https://api.github.com/users/ranyefet/gists{/gist_id}","starred_url":"https://api.github.com/users/ranyefet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ranyefet/subscriptions","organizations_url":"https://api.github.com/users/ranyefet/orgs","repos_url":"https://api.github.com/users/ranyefet/repos","events_url":"https://api.github.com/users/ranyefet/events{/privacy}","received_events_url":"https://api.github.com/users/ranyefet/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-08T16:42:02Z","updated_at":"2015-05-29T18:23:21Z","closed_at":"2015-05-29T18:23:21Z","body":"Hello,\r\n\r\nI'm trying to do some custom validation on TextInput.\r\nI'de to limit the max chars to 4 characters. I've tried the following:\r\n```js\r\nvalidate(event) {\r\n    if( event.nativeEvent.text.length > 4 ) {\r\n      event.preventDefault();\r\n      return false;\r\n    }\r\n    this.setState({pinCode: event.nativeEvent.text});\r\n    return true;\r\n  }\r\n\r\n<TextInput\r\n  style={styles.pinInput}\r\n  placeholder=\"PIN Code\"\r\n  value={this.state.pinCode}\r\n  keyboardType=\"number-pad\"\r\n  onChange={this.validate.bind(this)}\r\n/>\r\n```\r\n\r\nYour help is appreciated."}}