Permalink
Browse files

Fork Platform with a modified API

Reviewed By: sahrens

Differential Revision: D6501208

fbshipit-source-id: c4dbe9d5491f2d42e1a84a61758025e5b2dfa0fe
  • Loading branch information...
brishin authored and facebook-github-bot committed Dec 8, 2017
1 parent e76abfa commit 5ee27ff7552a5707a6e6bdb3f23e7378f978a2f7
Showing with 50 additions and 0 deletions.
  1. +25 −0 Libraries/Utilities/PlatformOS.android.js
  2. +25 −0 Libraries/Utilities/PlatformOS.ios.js
@@ -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;
@@ -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;

3 comments on commit 5ee27ff

@ohtangza

This comment has been minimized.

ohtangza replied Feb 5, 2018

@brishin Do you mind if I ask the motivation for having this?

@jpshelley

This comment has been minimized.

Contributor

jpshelley replied Apr 13, 2018

+1 to @ohtangza comment. To help clarify, why would one use PlatformOS over the current Platform API?

@ohtangza

This comment has been minimized.

ohtangza replied Apr 14, 2018

@jpshelley I agree. Having this kind of unnecessary APIs here and there without described motivation lowers the reputation of React Native.

Please sign in to comment.