Giter VIP home page Giter VIP logo

Comments (13)

petebacondarwin avatar petebacondarwin commented on May 20, 2024 2

@JiaLiPassion - it looks like Googlebot does not like Zone.js 0.9.0 either: angular/angular#30203

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024 1

Thanks, I will look into it.

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

Could you provide a reproduce repo? Thanks

from zone.js.

sdc395 avatar sdc395 commented on May 20, 2024

Is that the most useful thing I can do? To reproduce it from code, you're going to need a JDK installation and an Android device or emulator to hand. If you have those things, it's enough to react-native init TestApp, npm i zone.js, import 'zone.js' in index.js and make a call to fetch.

In other news, FileReader is also broken. Am I doing something dumb? How should I import Zone.js in a React Native application?

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

I never tried using zone.js in react native, and I don't think you did any thing wrong, the most possible reason is in react native, the webview has different implementation vs normal browser. So if you can provide a very basic repo to reproduce fetch and FileReader issue, so I don't need to begin to learn how to setup react native 101. Thanks!

from zone.js.

sdc395 avatar sdc395 commented on May 20, 2024

OK, I've created a repo at https://github.com/sdc395/react-native-zones.git.

I had no problems using Zone.js with React Native 0.56. The sooner Zones becomes a standard part of JavaScript the better. :-)

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

@sdc395, it seems react native implement it's own EventTarget and XMLHttpRequest, and it is inside Worker, so the patch become a little weird, so in your use case, you want to use zone to control XMLHttpRequest and FileReader?

from zone.js.

sdc395 avatar sdc395 commented on May 20, 2024

At the moment, I'm only knowingly using Zone.js to make database transaction objects available to asynchronous functions that need database access.

Perhaps I can disable the Zone.js patches I don't need. I had set __Zone_disable_XHR = true. Do I need to set __Zone_disable_EventTarget = true also? Could you clarify the steps?

Thanks for your help with this issue.

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

@sdc395, yes, you are right, the walk around is,

  1. create a env.js in the root.
if (typeof global !== 'undefined') {
  global['__Zone_disable_XHR'] = true;
  global['__Zone_disable_EventTarget'] = true;
}
  1. in index.js, before import zone.js,
/**
 * @format
 */
import './env';
import 'zone.js';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

And everything should work fine.

from zone.js.

sdc395 avatar sdc395 commented on May 20, 2024

That has done the trick, although I've only needed to disable EventTarget patching (so far). Thanks so much.

Will full, on-going support for React Native be available in the future? I'm building my mobile app's database access around Zone.js and I'd hate to have to rip that out post-launch.

from zone.js.

cobaltsis avatar cobaltsis commented on May 20, 2024

I have issue with version 0.9.0 too. I've recently updated all packages in project and Angular to version 7.2.13. Core-js is on version 3.0.1. After every request, zone.js throw this error: TypeError: Cannot read property 'call' of undefined at ZoneTask.scheduleTask [as scheduleFn].

Call of undefined is on this line: oriAddListener.call(target, READY_STATE_CHANGE, newListener);

We work with LG smart TV with webOS version 3.8.0 (latest LG update).

Here is stacktrace:
"TypeError: Cannot read property 'call' of undefined at ZoneTask.scheduleTask [as scheduleFn] (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:12611:27) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:9688:26) at Object.push../node_modules/zone.js/dist/zone.js.DELEGATE_ZS.onScheduleTask (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:9579:29) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:9682:51) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:9516:43) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:9539:25) at scheduleMacroTaskWithCurrentZone (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:10472:25) at file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:12649:28 at proto.(anonymous function) [as send] (file:///media/developer/apps/usr/palm/applications/app/dist/polyfills.js:10796:24) at Observable._subscribe (file:///media/developer/apps/usr/palm/applications/app/dist/main.js:8049:17)"

After downgrading to zone.js version 0.8.29, application works

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

@petebacondarwin, got it, I will check it, thanks!

from zone.js.

JiaLiPassion avatar JiaLiPassion commented on May 20, 2024

I will close this one because angular/angular#30203 has been fixed.

from zone.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.