{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/11408","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/11408/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/11408/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/11408/events","html_url":"https://github.com/facebook/react-native/issues/11408","id":194850672,"number":11408,"title":"feat(CLI) - React Native Cascading Platforms","user":{"login":"GantMan","id":997157,"avatar_url":"https://avatars.githubusercontent.com/u/997157?v=3","gravatar_id":"","url":"https://api.github.com/users/GantMan","html_url":"https://github.com/GantMan","followers_url":"https://api.github.com/users/GantMan/followers","following_url":"https://api.github.com/users/GantMan/following{/other_user}","gists_url":"https://api.github.com/users/GantMan/gists{/gist_id}","starred_url":"https://api.github.com/users/GantMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GantMan/subscriptions","organizations_url":"https://api.github.com/users/GantMan/orgs","repos_url":"https://api.github.com/users/GantMan/repos","events_url":"https://api.github.com/users/GantMan/events{/privacy}","received_events_url":"https://api.github.com/users/GantMan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-12-11T19:30:07Z","updated_at":"2016-12-29T00:03:17Z","closed_at":null,"body":"### What are you proposing Gant?\r\n#### Simply put: `somefile.ios10.js` would be able to take advantage of iOS10 feature where applicable, but then use `ios.js` files in all other places.  \r\n\r\n[Alas!  Platforms can be identified by each project, and don't need to be part enumerated by the react-native core](https://github.com/facebook/react-native/commit/67828a52bdc15f5bf5300fd3eed8a5a4adbc9727).  What's next for platforms?  Exposing the native cascade is what I would like to add.\r\n\r\nCurrently Packager works like so:  `require('blah')` does some neato cascading where  `blah.somePlatform.js` will be chosen over `blah.native.js`, and ultimately chosen over `blah.js`.  [This feature is not exposed for config in a per-project basis](https://github.com/facebook/react-native/blob/cf3ae6c32a358729c0eb303d20df0293e9b1c1e2/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js#L99-L112).  That's what I'd like to change.\r\n\r\n### Utility \r\nIn some situations there's [been talk](https://www.facebook.com/groups/reactnativeoss/permalink/1586734651623163/) about how platform-transparency will help unify code.  Allowing access to the platform specific magic, is a natural second step to allowing access to custom platforms.\r\n\r\nThis means we wouldn't need to duplicate ALL `*.ios.js` files as `*.ios10.js` files just to take advantage in one spot.  Perhaps even useful in AppleTV platform, keeping the high duplication JS files to a minimum.  100% this is needed in Windows which is hoping to support WPF and UWP for React Native.\r\n\r\n### Proposed Method\r\nMuch like platforms can be sent as a config via the CLI or by settings in the `rn-cli.config.js`, we pass our node-haste cascade.\r\n\r\n```js\r\n...\r\ngetPlatforms() {\r\n  return ['ios10'];\r\n},\r\nhasteCascade() {\r\n  return ['ios'];\r\n}\r\n...\r\n```\r\n\r\n**run project for basic ios** Everything behaves as normal.   \r\n**run project for ios10** It will consume any 'ios10' files (platform first!), but cascade into looking for normal `.ios.js` files before settling for native, and then nondenominational js files, and then result in error for missing files. \r\n\r\n_TADAA!_ no need to duplicate all .ios files!\r\n\r\n\r\n----------------\r\n\r\nI'm ready to knock this code out for RN.  But before I start, I need a few RN heroes to sign off.\r\n* @mkonicek - I've been told you're the idea guy.  External and aging internal platforms can using this to bridge issues (like deprecated controls for each platform).  Do you foresee this as a good solution?\r\n* @cpojer - This is the least invasive method I can think of for node-haste.  Just an array.\r\n* @dlowder-salesforce - If this looks useful for AppleTV let me know\r\n* @rozele - Windows feedback always welcome\r\n* @andrewimm - Does this match your current needs on your platform additions?"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/269561305","html_url":"https://github.com/facebook/react-native/issues/11408#issuecomment-269561305","issue_url":"https://api.github.com/repos/facebook/react-native/issues/11408","id":269561305,"user":{"login":"andrewimm","id":494043,"avatar_url":"https://avatars.githubusercontent.com/u/494043?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewimm","html_url":"https://github.com/andrewimm","followers_url":"https://api.github.com/users/andrewimm/followers","following_url":"https://api.github.com/users/andrewimm/following{/other_user}","gists_url":"https://api.github.com/users/andrewimm/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewimm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewimm/subscriptions","organizations_url":"https://api.github.com/users/andrewimm/orgs","repos_url":"https://api.github.com/users/andrewimm/repos","events_url":"https://api.github.com/users/andrewimm/events{/privacy}","received_events_url":"https://api.github.com/users/andrewimm/received_events","type":"User","site_admin":false},"created_at":"2016-12-29T00:03:17Z","updated_at":"2016-12-29T00:03:17Z","body":"It's definitely awkward. Since it refers to the packages in `node_modules` that should be able to use Haste resolution, `getHastePackages` or `getHasteNodeModules` might be a little more accurate. `getHasteModules` sounds like it references the modules that can be required, but that might just be me."}}
{"actor":{"display_login":"andrewimm"}}