Comments (4)
Based on @vinodsantharam feedback and some investigation, it's possible to use @liveblocks/client
and @liveblocks/react
with React native, but it requires some work. I'm reopening this issue to keep track of what could be improved to officially support React native.
Here are the necessary work around as of v0.14.1
:
- use a polyfill for
atob
(used to parse jwt token)
import {decode, encode} from 'base-64';
if (!global.btoa) {
global.btoa = encode;
}
if (!global.atob) {
global.atob = decode;
}
- Patch
window.addEventListener
to not crash onwindow.addEventListener("online")
.
window.addEventListener = () => {};
To officially support it, we need to:
- Not crash on
window.addEventListener
. - Give a clear error message when atob is not defined.
- Optional but it would great to use
@react-native-community/netinfo
to reconnect faster instead of waiting for the heartbeat. - And of course, official documentation
from liveblocks.
We now have an official example: https://github.com/liveblocks/liveblocks/tree/main/examples/react-native-todo-list
from liveblocks.
Hi @dynamichny,
To be completely transparent with you, we didn't try @liveblocks/client
and @livebocks/react
with react native, but my understanding is that it should work since we only depend on fetch
and WebSocket
. If it does not work for some reason, we will make sure to fix the issues to make it work!
from liveblocks.
for the online listener, maybe you could do what react-query does, and let people register their own listener.
from liveblocks.
Related Issues (20)
- useThreads should allow for filter and paging to account for long lists of threads HOT 2
- [Comments] Comments Development Tier for Demo Purposes HOT 1
- Collaborative text editor with Tiptap and Yjs not syncing HOT 3
- Second presence is "blinking" on the multiplayer text editor with Tiptap and Yjs HOT 2
- history.batch() is not working at async callback function. HOT 4
- Unable to select any text when using liveblocks with cursors HOT 1
- In the multiplayer text editor with Tiptap, is it possible to specify the cursor colors from the frontend?
- Anomalous behavior occurs when repeating removing and inserting between LiveLists HOT 10
- Multiplayer text editor duplicating initial content
- The `@liveblocks/node` client crashes when secret key is invalid HOT 4
- Improve pagination API for `client.getRooms()` endpoint in `@liveblocks/node` HOT 5
- Problem to fetch data from Liveblocks API when not setting a schema HOT 3
- Delete thread server API
- useDeleteThread HOT 1
- Deleting a room should delete associated threads and comments for GDPR
- `TypeError: storage.get(...).get(...).set is not a function` with useMutation and nested live object HOT 2
- YJS Integration Does not Appear to Fire Awareness `update` Event HOT 1
- Yjs image upload > 500KB raises websocket error with code 1005 HOT 2
- Minor type error in Awareness.states
- React `useThreads` incorrect usage of `useSyncExternalStoreWithSelector` triggers infinite re-renders HOT 1
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 liveblocks.