{"action":"created","issue":{"url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/298","repository_url":"https://api.github.com/repos/christianalfoni/formsy-react","labels_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/298/comments","events_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/298/events","html_url":"https://github.com/christianalfoni/formsy-react/issues/298","id":126534572,"number":298,"title":"RangeError: Maximum call stack size exceeded with custom validator","user":{"login":"dgcoffman","id":1711204,"avatar_url":"https://avatars.githubusercontent.com/u/1711204?v=3","gravatar_id":"","url":"https://api.github.com/users/dgcoffman","html_url":"https://github.com/dgcoffman","followers_url":"https://api.github.com/users/dgcoffman/followers","following_url":"https://api.github.com/users/dgcoffman/following{/other_user}","gists_url":"https://api.github.com/users/dgcoffman/gists{/gist_id}","starred_url":"https://api.github.com/users/dgcoffman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgcoffman/subscriptions","organizations_url":"https://api.github.com/users/dgcoffman/orgs","repos_url":"https://api.github.com/users/dgcoffman/repos","events_url":"https://api.github.com/users/dgcoffman/events{/privacy}","received_events_url":"https://api.github.com/users/dgcoffman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-01-13T22:49:18Z","updated_at":"2016-03-21T10:03:46Z","closed_at":null,"body":"`\"react\": \"0.14.2\",`\r\n`\"formsy-react\": \"0.17.0\",`\r\n\r\nWe have a component `Form`:\r\n```javascript\r\nimport Formsy from 'lib/Formsy';\r\nimport FormInput from 'FormInput.jsx';\r\nimport React from 'react';\r\n\r\nconst Form = React.createClass({\r\n  render()\r\n  {\r\n    return (\r\n      <div>\r\n        <Formsy.Form onValid={() =>  this.setState({anything: true})}>\r\n          <FormInput name=\"uid\" validations={{ customValidator: () => true }} />\r\n        </Formsy.Form>\r\n      </div>\r\n    );\r\n  },\r\n});\r\nexport default Form;\r\n```\r\n\r\nusing `FormInput`:\r\n```javascript\r\nconst React = require('React');\r\nconst Formsy = require('lib/Formsy');\r\n\r\nconst FormInput = React.createClass({\r\n  mixins: [Formsy.Mixin],\r\n\r\n  changeValue: function (event) {\r\n    this.setValue(event.currentTarget.value);\r\n  },\r\n\r\n  render() {\r\n    return <input type=\"text\" onChange={this.changeValue}/>\r\n  },\r\n});\r\n\r\nmodule.exports = FormInput;\r\n```\r\n\r\nMounting the component or typing a character in the input causes `RangeError: Maximum call stack size exceeded` to be thrown to the console. \r\n\r\nFWIW, here is a screenshot of the stacktrace for the exception thrown on component mount:\r\n![stack trace](http://i.imgur.com/OfMNcWq.png)\r\n\r\nReplacing `customValidator: () => true` with a built-in validator like `isExisty: true` does not cause this exception to be thrown. \r\n\r\nRegistering a custom validator like:\r\n```javascript\r\nFormsy.addValidationRule('isAnything', function(values, value, array) {\r\n  return true;\r\n});\r\n```\r\nand then using it\r\n```javascript\r\nisAnything: true\r\n```\r\ndoes not cause this exception to be thrown. \r\n\r\nI haven't been able to figure out how to implement a custom validator as shown in this example: https://github.com/christianalfoni/formsy-react/blob/master/API.md#validations\r\n\r\nSimilar issue: https://github.com/christianalfoni/formsy-react/issues/106"},"comment":{"url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/comments/199208145","html_url":"https://github.com/christianalfoni/formsy-react/issues/298#issuecomment-199208145","issue_url":"https://api.github.com/repos/christianalfoni/formsy-react/issues/298","id":199208145,"user":{"login":"megapctr","id":4096683,"avatar_url":"https://avatars.githubusercontent.com/u/4096683?v=3","gravatar_id":"","url":"https://api.github.com/users/megapctr","html_url":"https://github.com/megapctr","followers_url":"https://api.github.com/users/megapctr/followers","following_url":"https://api.github.com/users/megapctr/following{/other_user}","gists_url":"https://api.github.com/users/megapctr/gists{/gist_id}","starred_url":"https://api.github.com/users/megapctr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megapctr/subscriptions","organizations_url":"https://api.github.com/users/megapctr/orgs","repos_url":"https://api.github.com/users/megapctr/repos","events_url":"https://api.github.com/users/megapctr/events{/privacy}","received_events_url":"https://api.github.com/users/megapctr/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T10:03:46Z","updated_at":"2016-03-21T10:03:46Z","body":"Other way you can get custom validators is this\r\n\r\n```js\r\nFormsy.addValidationRule('notIn', (values, value, array) => !_.includes(array, value))\r\n\r\n// usage\r\nvalidations: {\r\n    matchRegexp: /^[\\w -]+$/,\r\n    notIn: reservedNames,\r\n},\r\n```"}}