From 05d5eeb8183be58160e176eca7d863823915ede2 Mon Sep 17 00:00:00 2001 From: Evan Bacon Date: Mon, 11 Mar 2019 11:35:09 -0700 Subject: [PATCH] Removed `Platform.web` (#23830) Summary: Initially if a `react-native-web` project were to use a library that required internals `expo/webpack-config` would polyfill those internals. This `Platform.web` was used for cases where `react-native` modules needed other internal `react-native` modules, ex: `Animated/src/AnimatedEvent -> Renderer/shims/ReactNative -> Renderer/oss/ReactNativeRenderer-dev -> Core/InitializeCore -> Devtools/setupDevtools -> WebSocket/WebSocket -> Utilities/Platform` The consensus is that if any `react-native` library references a `react-native` internal (ex: `react-native/*`), it should continue to throw errors. We've removed the use of internals from all of the Unimodules, `react-navigation`, and `react-native-gesture-handler`. This covers a wide enough area for a lot of projects to get web support. * Add emitters for libs referencing internals necolas/react-native-web#1275 * Remove monkey patch that bundles RN, libs that use internals will crash instead expo/expo-cli#409 * Remove all unsupported internals and polyfills from the Expo suite expo/expo#3676 * Remove internals from react-native-gesture-handler kmagiera/react-native-gesture-handler#406 * Related #23387 [GENERAL] [REMOVED] - Platform.web.js Pull Request resolved: https://github.com/facebook/react-native/pull/23830 Differential Revision: D14406145 Pulled By: hramos fbshipit-source-id: bdda99a334d33f5543fdb954eb80e2e7186f985a --- Libraries/Utilities/Platform.web.js | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 Libraries/Utilities/Platform.web.js diff --git a/Libraries/Utilities/Platform.web.js b/Libraries/Utilities/Platform.web.js deleted file mode 100644 index f70ae14b7d1..00000000000 --- a/Libraries/Utilities/Platform.web.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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 = { - default?: D, - web?: I, -}; - -const Platform = { - OS: 'web', - select: (spec: PlatformSelectSpec): D | I => - 'web' in spec ? spec.web : spec.default, -}; - -module.exports = Platform;