From 31a1b72d73f90d9f5c78e1a194f7ee80a53e9bb0 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Sun, 8 Apr 2018 18:06:21 -0700 Subject: [PATCH] Revert "Remove Platform check from WebSocket module" Summary: This reverts commit b9be28915cf323eb36f1d7c77821cdf994954074. Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. Fix #18696 Run Jest tests. Run WebSocket example from RNTester on Android. [CATEGORY] [TYPE] [LOCATION] - Message [ANDROID][BUGFIX][WebSocketModule] - revert change that regresses WebSocketModule Closes https://github.com/facebook/react-native/pull/18733 Differential Revision: D7548850 Pulled By: hramos fbshipit-source-id: b8c79810c1cd6e5a30ec4118bd5ff8ad719f04b9 --- Libraries/WebSocket/WebSocket.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index daa1ed77c..13e614557 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -14,6 +14,7 @@ const EventTarget = require('event-target-shim'); const NativeEventEmitter = require('NativeEventEmitter'); const BlobManager = require('BlobManager'); const NativeModules = require('NativeModules'); +const Platform = require('Platform'); const WebSocketEvent = require('WebSocketEvent'); /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error @@ -202,7 +203,7 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { } _close(code?: number, reason?: string): void { - if (WebSocketModule.close.length === 3) { + if (Platform.OS === 'android') { // See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent const statusCode = typeof code === 'number' ? code : CLOSE_NORMAL; const closeReason = typeof reason === 'string' ? reason : '';