From 4129853e83eb3381d8f54a2c8e798039fd254aae 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 081c8be05eea68..2a265a976235f5 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -14,6 +14,7 @@ const EventTarget = require('event-target-shim'); const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter'); const BlobManager = require('../Blob/BlobManager'); const NativeModules = require('../BatchedBridge/NativeModules'); +const Platform = require('../Utilities/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 : '';