Skip to content

Commit

Permalink
Revert "Remove Platform check from WebSocket module"
Browse files Browse the repository at this point in the history
Summary:
This reverts commit b9be289.

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.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fix facebook#18696

<!--
  Required: Write your test plan here. If you changed any code, please provide us with
  clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->

Run Jest tests.
Run WebSocket example from RNTester on Android.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[CATEGORY] [TYPE] [LOCATION] - Message

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[ANDROID][BUGFIX][WebSocketModule] - revert change that regresses WebSocketModule
Closes facebook#18733

Differential Revision: D7548850

Pulled By: hramos

fbshipit-source-id: b8c79810c1cd6e5a30ec4118bd5ff8ad719f04b9
  • Loading branch information
rozele authored and macdoum1 committed Jun 28, 2018
1 parent f1b1c90 commit 93cdaea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libraries/WebSocket/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 : '';
Expand Down

0 comments on commit 93cdaea

Please sign in to comment.