Commit Graph

5 Commits

Author SHA1 Message Date
Mike Grabowski edf8888fb9 Platform.select method
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
2016-04-25 16:32:20 -07:00
Daniel Friesen 3603479471 Fix Platform.Version documentation
Summary:Version exposes the sdk level (which TBH is more useful anyways), not a version string.
Closes https://github.com/facebook/react-native/pull/6068

Differential Revision: D2971198

fb-gh-sync-id: 0ba1e10e48b2ca51c7b0cebcc1ec13d0b69df783
shipit-source-id: 0ba1e10e48b2ca51c7b0cebcc1ec13d0b69df783
2016-02-24 06:21:34 -08:00
Mateusz Zatorski 3ae99d0fea replace require with es6 import in docs
Reviewed By: svcscm

Differential Revision: D2936839

fb-gh-sync-id: 7a921709a37de5e9aadf324d5438d51851326348
shipit-source-id: 7a921709a37de5e9aadf324d5438d51851326348
2016-02-14 15:03:34 -08:00
Emilio Rodriguez 87302ac74b style and typos 2015-11-24 08:44:34 +01:00
Emilio Rodriguez 3686facdda [Docs] Document Platform in the modules section of the docs #3701 2015-11-18 12:04:19 +01:00