Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not implemented error with react native #3666

Merged
merged 24 commits into from Sep 2, 2020
Merged

Not implemented error with react native #3666

merged 24 commits into from Sep 2, 2020

Conversation

daoauth
Copy link
Contributor

@daoauth daoauth commented Aug 2, 2020

Description

from

var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
...

if (isNode) {
   ...
}

to

var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
var isRN = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
...
if (isNode || isRN) {
   ...
}

Fixes #3667

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@coveralls
Copy link

coveralls commented Aug 2, 2020

Coverage Status

Coverage decreased (-2.3%) to 78.032% when pulling d61fefa on daoauth:1.x into fb7db14 on ethereum:1.x.

new URL(url) -> require('url').parse(url)
another example bug
@daoauth daoauth closed this Aug 5, 2020
@daoauth
Copy link
Contributor Author

daoauth commented Aug 5, 2020

close and pr again

@daoauth daoauth reopened this Aug 5, 2020
@GregTheGreek
Copy link
Contributor

Can you please update the changelog :)

@GregTheGreek
Copy link
Contributor

@daoauth Do you have an example repo I could check out to verify this? I'd love to eventually add react-native support as a part of the CI run...

@daoauth
Copy link
Contributor Author

daoauth commented Aug 8, 2020

@daoauth Do you have an example repo I could check out to verify this? I'd love to eventually add react-native support as a part of the CI run...

https://github.com/daoauth/web3js-react-native-ws

GregTheGreek
GregTheGreek previously approved these changes Aug 9, 2020
GregTheGreek
GregTheGreek previously approved these changes Aug 31, 2020
Co-authored-by: Wyatt Barnes <me@wyatt.email>
@spacesailor24
Copy link
Contributor

Changes seem to follow documentation

@@ -1,8 +1,9 @@
var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
var isRN = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the correct way to check if running ReactNative

@GregTheGreek GregTheGreek merged commit 67aa557 into web3:1.x Sep 2, 2020
@GregTheGreek GregTheGreek mentioned this pull request Sep 2, 2020
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to fix "ReferenceError: btoa is not defined" while running build with Node.js?
5 participants