From dfa85e94754b0ffd695f04534ccdb62500220a81 Mon Sep 17 00:00:00 2001 From: Mark Vayngrib Date: Wed, 25 Oct 2017 08:41:55 -0400 Subject: [PATCH] fix bindArgs on android (broken by 2.2.0) --- UdpSocket.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/UdpSocket.js b/UdpSocket.js index 2bf86a4..9d609c9 100644 --- a/UdpSocket.js +++ b/UdpSocket.js @@ -16,7 +16,8 @@ var inherits = require('inherits') var EventEmitter = require('events').EventEmitter var { DeviceEventEmitter, - NativeModules + NativeModules, + Platform } = require('react-native'); var Sockets = NativeModules.UdpSockets var base64 = require('base64-js') @@ -90,7 +91,12 @@ UdpSocket.prototype.bind = function(port, address, callback) { this._state = STATE.BINDING this._debug('binding, address:', address, 'port:', port) - Sockets.bind(this._id, port, address, {reusePort: this.reusePort }, function(err, addr) { + const bindArgs = [this._id, port, address] + if (Platform.OS === 'ios') { + bindArgs.push({ reusePort: this.reusePort }) + } + + Sockets.bind(...bindArgs, function(err, addr) { err = normalizeError(err) if (err) { // questionable: may want to self-destruct and