Skip to content

Commit

Permalink
Fix react native support (#703)
Browse files Browse the repository at this point in the history
* Fix react native support

* Bump to version 8.0.2

---------

Co-authored-by: Pusher CI <[email protected]>
  • Loading branch information
fbenevides and pusher-ci authored Mar 23, 2023
1 parent 4aa4e3b commit bfa444a
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 38 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 8.0.2

- [CHANGED] Fix React Native support.

## 8.0.1

- [FIXED] Fix 'window is not defined' error in the worker context
Expand Down
4 changes: 2 additions & 2 deletions dist/node/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 2 additions & 13 deletions dist/react-native/pusher.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-native/pusher.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher-with-encryption.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/worker/pusher-with-encryption.worker.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/worker/pusher.worker.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusher-js",
"version": "8.0.1",
"version": "8.0.2",
"description": "Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers",
"main": "dist/node/pusher.js",
"browser": "dist/web/pusher.js",
Expand Down
3 changes: 1 addition & 2 deletions src/runtimes/react-native/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Network } from './net_info';
import xhrAuth from 'isomorphic/auth/xhr_auth';
import { AuthTransports } from 'core/auth/auth_transports';
import xhrTimeline from 'isomorphic/timeline/xhr_timeline';
import { randomInt } from 'crypto';

// Very verbose but until unavoidable until
// TypeScript 2.1, when spread attributes will be
Expand Down Expand Up @@ -59,7 +58,7 @@ const ReactNative: Runtime = {
},

randomInt(max: number): number {
return randomInt(max);
return Math.floor(Math.random() * max);
}
};

Expand Down
2 changes: 1 addition & 1 deletion webpack/config.react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = merge({}, configShared, {
RUNTIME: JSON.stringify('react-native')
}),
new webpack.ProvidePlugin({
buffer: 'buffer'
Buffer: ['buffer', 'Buffer']
})
]
});

0 comments on commit bfa444a

Please sign in to comment.