Comments (11)
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.
should the pusher-mock library for testing work with react-native as well?
from use-pusher.
Yes, pusher-js-mock
is just a collection of ES6 classes so it should work when mocking pusher-js.
from use-pusher.
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.
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.
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
Do you think you can help diagnose?
from use-pusher.
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.
from use-pusher.
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.
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.
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.
@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!
from use-pusher.
Related Issues (20)
- React 18: Property 'children' does not exist on type 'IntrinsicAttributes & PusherProviderProps'. HOT 1
- Encrypted Channels
- Update auth config is not working
- Small mistake in usePresenceChannel documentation HOT 3
- useChannel performance optimization HOT 4
- useEffect: data might not be optional in the callback HOT 2
- Working presence channel HOT 2
- Reconnect after activity timeout HOT 3
- Maintaining connection in react-router HOT 2
- feat: logToConsole HOT 3
- is this hooks automatically disconnect channels? HOT 8
- Warn/Error when an event is un-handled HOT 3
- Introduce <ChannelProvider /> to hoist channel connection HOT 6
- useChannel(false) to prevent eager channel connection HOT 4
- Connection does not disconnect when transitioning to another page.
- Move jest to dev dependencies
- Change the way of requiring pusher-js To enable private-encrypted channels HOT 1
- Does this package ignore presence ? HOT 1
- Package maintenance status HOT 12
- Incompatible with React versions >16 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from use-pusher.