mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 15:18:10 +00:00
Summary:
Added a Platform file for module for instances where internal modules need Platform.
ex: 78be6efda9/Libraries/Utilities/Dimensions.js (L14)
* Added `Libraries/Utilities/Platform.web.js`
[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/23387
Differential Revision: D14041834
Pulled By: cpojer
fbshipit-source-id: 9be7ad647d6a644956efa622b936fcecee7c1a1f
25 lines
460 B
JavaScript
25 lines
460 B
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
export type PlatformSelectSpec<D, I> = {
|
|
default?: D,
|
|
web?: I,
|
|
};
|
|
|
|
const Platform = {
|
|
OS: 'web',
|
|
select: <D, I>(spec: PlatformSelectSpec<D, I>): D | I =>
|
|
'web' in spec ? spec.web : spec.default,
|
|
};
|
|
|
|
module.exports = Platform;
|