Merged
Conversation
…mitter on web * Pending necolas/react-native-web#1275 * Updated babel alias to use RNWeb emitters
ide
approved these changes
Mar 8, 2019
packages/expo-react-native-adapter/src/RCTDeviceEventEmitter.web.ts
Outdated
Show resolved
Hide resolved
* Removed comments from emitter * Updated babel plugin alias
Member
so the purpose of this is that when libraries mistakenly import react-native internals, we alias that so that they don't end up bundling all of react-native in their app by accident? if so, this seems pretty reasonable as a way to avoid people shooting themselves in the foot. we need to also make some changes to react-native upstream to warn people when they import from internals to stop libraries from doing this so we can eventually get rid of this code |
Contributor
Author
|
@brentvatne yes just for the emitters though. We are going to be removing the safe-guards in favor of errors 🙃 |
facebook-github-bot
pushed a commit
to facebook/react-native
that referenced
this pull request
Mar 11, 2019
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 software-mansion/react-native-gesture-handler#406 * Related #23387 [GENERAL] [REMOVED] - Platform.web.js Pull Request resolved: #23830 Differential Revision: D14406145 Pulled By: hramos fbshipit-source-id: bdda99a334d33f5543fdb954eb80e2e7186f985a
ronlaureles
pushed a commit
to ronlaureles/expo
that referenced
this pull request
May 20, 2019
* Removed internal react-native reference * Use latest RNGH with web polyfill * Remove internal web polyfills from `expo` * Updated expo-react-native-adapter to use polyfill for RCTDeviceEventEmitter on web * Pending necolas/react-native-web#1275 * Updated babel alias to use RNWeb emitters * Bump `1.1.0` * Removed flow * Moved files to vendor * Removed comments from emitter * Updated babel plugin alias
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Using React Native internals will bundle
react-nativeon web which can be avoided.How
react-native-webemittersexpo-react-native-adapterto use polyfill forRCTDeviceEventEmitteron webreact-native-webpending Made NativeEventEmitter work as expected. necolas/react-native-web#1275exporeact-native-gesture-handlerwith web polyfillreact-nativereference fromexpo-payments-stripeTest Plan
NCL should run without throwing any error