mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
edf8888fb9
Summary: Kudos to frantic for this amazing idea! Works really well (yet so simple!) Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way. There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful. Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value. It works with styles: `Platform.select({ ios: {}, android: {} })` with messages: `<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>` and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff. Closes https://github.com/facebook/react-native/pull/7220 Differential Revision: D3221709 Pulled By: vjeux fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9 fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9