lostpebble / pullstate

Simple state stores using immer and React hooks - re-use parts of your state by pulling it anywhere you like!

Home Page:https://lostpebble.github.io/pullstate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native Debugger integration

wnz99 opened this issue · comments

Hi was, trying to integrate with RND however I cannot get it working. I cant see anything in the Redux tab.

Here's an example of what I'm doing:

export interface VideosState {
  [videoId: string]: {
    fullscreen: boolean;
    isPlaying: boolean;
    currentTime: number;
    duration: number;
    showControls: boolean;
  };
}

export const videosStore = new Store<VideosState>({});

registerInDevtools({ videosStore });

Could anyone please confirm if it work out of the box with RND?

hi,

the issue is at this line:

https://github.com/lostpebble/pullstate/blob/master/src/reduxDevtools.ts#L8

document is not defined on the RND. Maybe you could add a flag to explicitly allow for RN?

Something like:

registerInDevtools({ store }, {isRN: true});

and then a check on that property in the code.

It would be nice to have support for the RND: https://github.com/jhen0409/react-native-debugger

Hi @wnz99 ,

ahh okay cool. Thanks for looking into it! I've not used RN that much so never tried out the dev tools with it. If its run the same and just requires you to hook into a different global then it should be an easy fix.

I'll look into this in a bit, of course happy for a quick PR as well if you know what is needed.

Since I'm using pullstate in a RN project, please have a look at this:

#69

lol, you made your changes at the same time... Anyway, have a look at my PR, the check I'm doing is more general and less specific to React Native

Jeeze almost exactly the same second! 😆 That's quite the coincidence.

Okay cool, looking at your changes now, thanks!

Fix published in 1.20.1