We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will this work with React native for web? If not, how easy would that be for me to make an PR to add support? Thanks for your help!
The text was updated successfully, but these errors were encountered:
It will not work with RN for web. For web the default store should be used.
However, we do not expose the factory function for that in the public api.
Here is how we determine the factory to use:
export function getKVStoreProvider( lc: LogContext, kvStore: 'mem' | 'idb' | StoreProvider | undefined, ): StoreProvider { switch (kvStore) { case 'idb': case undefined: return { create: (name: string) => newIDBStoreWithMemFallback(lc, name), drop: dropIDBStoreWithMemFallback, }; case 'mem': return { create: createMemStore, drop: (name: string) => dropMemStore(name), }; default: return kvStore; } }
We would have to export two StoreProviders. Something like:
StoreProvider
export const idbStoreProvider: StoreProvider = { create: (name: string) => newIDBStoreWithMemFallback(lc, name), drop: dropIDBStoreWithMemFallback, }; export const memStoreProvider: StoreProvider = { create: createMemStore, drop: (name: string) => dropMemStore(name), };
Once that is in place the RN code could pick the right one based on its environment.
Sorry, something went wrong.
No branches or pull requests
Will this work with React native for web? If not, how easy would that be for me to make an PR to add support? Thanks for your help!
The text was updated successfully, but these errors were encountered: