{"action":"created","issue":{"url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/132","repository_url":"https://api.github.com/repos/gcanti/tcomb-form-native","labels_url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/132/comments","events_url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/132/events","html_url":"https://github.com/gcanti/tcomb-form-native/issues/132","id":142061146,"number":132,"title":"React Native Hot Reload breaks tcomb-form-native","user":{"login":"justim","id":757292,"avatar_url":"https://avatars.githubusercontent.com/u/757292?v=3","gravatar_id":"","url":"https://api.github.com/users/justim","html_url":"https://github.com/justim","followers_url":"https://api.github.com/users/justim/followers","following_url":"https://api.github.com/users/justim/following{/other_user}","gists_url":"https://api.github.com/users/justim/gists{/gist_id}","starred_url":"https://api.github.com/users/justim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justim/subscriptions","organizations_url":"https://api.github.com/users/justim/orgs","repos_url":"https://api.github.com/users/justim/repos","events_url":"https://api.github.com/users/justim/events{/privacy}","received_events_url":"https://api.github.com/users/justim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-19T13:21:48Z","updated_at":"2016-03-22T21:50:10Z","closed_at":null,"body":"### Version\r\n\r\n- `tcomb-form-native`: `0.4.0`\r\n- `react-native`:  `0.22.0-rc4`\r\n\r\n### Expected behaviour\r\n\r\nReact Native 0.22 introduces Hot Reload and after a code change the hot reload behaviour should not break the plugin.\r\n\r\n### Actual behaviour\r\n\r\nAfter a code change the plugin throws an error.\r\n\r\n### Steps to reproduce\r\n\r\n1. New react native project\r\n2. Add a `tcomb-form-native` form\r\n3. Enabled Hot Reload in the app\r\n4. Make a change while the app is running\r\n\r\n### Stack trace and console log\r\n\r\nThe error that is thrown:\r\n`[tcomb][tcomb-form-native] missing stylesheet config`\r\n\r\n### Additional information\r\n\r\n- The error is thrown in the `Form.render` method by the assert\r\n- The `stylesheet` variable is indeed `undefined` after a code change\r\n- The other asserts fail as well (`templates` and `i18n`)\r\n- Hot Reload works by wrapping components with a shell that can reloads its component, so somehow the assignments in the `index.js` file are ignored"},"comment":{"url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/comments/200046088","html_url":"https://github.com/gcanti/tcomb-form-native/issues/132#issuecomment-200046088","issue_url":"https://api.github.com/repos/gcanti/tcomb-form-native/issues/132","id":200046088,"user":{"login":"dvisco","id":1737579,"avatar_url":"https://avatars.githubusercontent.com/u/1737579?v=3","gravatar_id":"","url":"https://api.github.com/users/dvisco","html_url":"https://github.com/dvisco","followers_url":"https://api.github.com/users/dvisco/followers","following_url":"https://api.github.com/users/dvisco/following{/other_user}","gists_url":"https://api.github.com/users/dvisco/gists{/gist_id}","starred_url":"https://api.github.com/users/dvisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvisco/subscriptions","organizations_url":"https://api.github.com/users/dvisco/orgs","repos_url":"https://api.github.com/users/dvisco/repos","events_url":"https://api.github.com/users/dvisco/events{/privacy}","received_events_url":"https://api.github.com/users/dvisco/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T21:50:10Z","updated_at":"2016-03-22T21:50:10Z","body":"It's not a fix but if you are looking for a workaround you can edit the `render` method of `Form` within `lib/component.js` to look like\r\n```js\r\n    var type = this.props.type;\r\n    var options = this.props.options || nooptions;\r\n    var stylesheet = this.props.options.fields.name.stylesheet || Form.stylesheet;\r\n    var templates = this.props.options.fields.name.templates || Form.templates;\r\n    var i18n = this.props.options.fields.name.i18n || Form.i18n;\r\n```\r\n\r\nThen with your usage follow the example given in the stylesheet docs such as:\r\n```js\r\nconst t = require('tcomb-form-native');\r\nvar _ = require('lodash');\r\n\r\n// clone the default stylesheet\r\nconst stylesheet = _.cloneDeep(t.form.Form.stylesheet);\r\nconst templates = _.cloneDeep(t.form.Form.templates);\r\nconst i18n = _.cloneDeep(t.form.Form.i18n);\r\n\r\nlet options = {\r\n    fields: {\r\n      name: {\r\n        stylesheet: stylesheet, // overriding the style of the textbox\r\n        templates: templates, // overriding the style of the textbox\r\n        i18n: i18n // overriding the style of the textbox\r\n      }\r\n    }  \r\n};\r\n\r\n<Form ref=\"form\"\r\n    options={options}\r\n     ...\r\n/>\r\n```"}}