Giter VIP home page Giter VIP logo

Comments (11)

mayteio avatar mayteio commented on May 25, 2024 1

Thanks mate. Obviously document doesn’t exist in rn so I wonder if the web version of pusher is being pulled in somewhere. I will clone and investigate when I jump online in about 1-2 hours for you.

from use-pusher.

hsavit1 avatar hsavit1 commented on May 25, 2024

should the pusher-mock library for testing work with react-native as well?

from use-pusher.

mayteio avatar mayteio commented on May 25, 2024

Yes, pusher-js-mock is just a collection of ES6 classes so it should work when mocking pusher-js.

from use-pusher.

hsavit1 avatar hsavit1 commented on May 25, 2024

I've been having a bit of difficulty getting this working. I'll work on creating an example app, hopefully will have one by the end of the week

from use-pusher.

mayteio avatar mayteio commented on May 25, 2024

As I mentioned, I only wrote Jest tests for this and didn't try it in a project. Please share when you can and I'll look into it. If you wanted to contribute too I would accept a pull request 🙃

from use-pusher.

hsavit1 avatar hsavit1 commented on May 25, 2024

Hey @mayteio , I made a small example project here - I'd be happy to expand on the example and open up a Pull Request on the use-pusher repo when it is working, but it's currently failing with the same error that I've seen in my personal project. See the below picture

Screen Shot 2020-07-09 at 5 56 46 PM

Do you think you can help diagnose?

from use-pusher.

mayteio avatar mayteio commented on May 25, 2024

Hey @hsavit1 I can't get the react errors to show up nicely like that. I just get a blank white screen in the simulator and the error shows up as a one-liner with no line numbers in terminal.

Am I missing something to get the errors showing up like that?

Screen Shot 2020-07-10 at 10 38 07 am

I have opened #14 to track this.

from use-pusher.

hsavit1 avatar hsavit1 commented on May 25, 2024

Hey @hsavit1 I can't get the react errors to show up nicely like that. I just get a blank white screen in the simulator and the error shows up as a one-liner with no line numbers in terminal.

Am I missing something to get the errors showing up like that?

I have opened #14 to track this.

You're definitely experiencing the error, as you can see it in your console logs. To get the error to show, perhaps comment out the PusherProvider and hot reload. Then uncomment and hot reload again. I think the app needs to render properly first to get the redbox to show

from use-pusher.

andrew-schenk avatar andrew-schenk commented on May 25, 2024

src/PusherProvider.tsx

- import Pusher, { Options } from "pusher-js";
+ import Pusher, { Options } from "pusher-js/react-native";

When I use Pusher in a Class vs functional component, I import it from the second line.

from use-pusher.

skulegirl avatar skulegirl commented on May 25, 2024

I'm also encountering the same issue with "Can't find variable: document" error when running in React Native. I've correctly imported from "@harelpls/use-pusher/react-native"... I'm using expo, could that be responsible for the issue?

from use-pusher.

mayteio avatar mayteio commented on May 25, 2024

@skulegirl no, not expo. document doesn't exist in the react-native environment. Frankly I'm not totally sure what's going on here.

I've done a huge restructure in 7.0.0 to make sure there's no web packages in the native build and vice versa. I've also added a (working) example in examples/native-use-pusher-example. Check it out and let me know!

P.S. 7.0.0 uses pusher 7.0.0, which has some breaking changes.

Cheers!

Screen Shot 2020-08-19 at 11 10 06 am

from use-pusher.

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.