-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed By: sahrens Differential Revision: D6501208 fbshipit-source-id: c4dbe9d5491f2d42e1a84a61758025e5b2dfa0fe
- Loading branch information
1 parent
e76abfa
commit 5ee27ff
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule PlatformOS | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
export type PlatformSelectSpec<A, I> = {| | ||
android: A, | ||
ios: I, | ||
|}; | ||
|
||
const PlatformOS = { | ||
OS: 'android', | ||
select: <A, I> (spec: PlatformSelectSpec<A, I>): A | I => spec.android, | ||
}; | ||
|
||
module.exports = PlatformOS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule PlatformOS | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
export type PlatformSelectSpec<A, I> = {| | ||
android: A, | ||
ios: I, | ||
|}; | ||
|
||
const PlatformOS = { | ||
OS: 'ios', | ||
select: <A, I> (spec: PlatformSelectSpec<A, I>): A | I => spec.ios, | ||
}; | ||
|
||
module.exports = PlatformOS; |
5ee27ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brishin Do you mind if I ask the motivation for having this?
5ee27ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @ohtangza comment. To help clarify, why would one use PlatformOS over the current Platform API?
5ee27ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpshelley I agree. Having this kind of unnecessary APIs here and there without described motivation lowers the reputation of React Native.
5ee27ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens Just why?
5ee27ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code wasn't meant for React Native use directly. It was meant for an FB internal use case that couldn't take in all of the RN dependencies. I believe that it can be deleted now — I will take a look this week into what would be required to do so.