From 4b6e9d3dfd213689c5b319a4efee8d4f606d6f9d 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 021e42507e5db0..1b401d236c2830 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 @@ -205,7 +206,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 : '';