wallet-adapter icon indicating copy to clipboard operation
wallet-adapter copied to clipboard

Fork localstorage feature for React Native

Open steveluscher opened this issue 3 years ago • 9 comments

  • Build a React Native bundle of this thing.
  • Fork anything that relies on localStorage to use @react-native-async-storage/async-storage instead.

steveluscher avatar Jul 09 '22 02:07 steveluscher

This is harder than it seems because our API is sync and all of the React Native storage solutions are async. We'll need to come up with a strategy to smooth over that impedance mismatch.

steveluscher avatar Jul 13 '22 05:07 steveluscher

I recommend using https://github.com/mrousavy/react-native-mmkv

bdtren avatar Oct 21 '22 03:10 bdtren

I think it's more likely that we just won't do this, since there are better ways of connecting to mobile wallets on React Native than using this adapter.

If you want to send a pull request to use mmkv instead of AsyncStorage in the mobile wallet adapter though, that would be cool! https://github.com/solana-mobile/mobile-wallet-adapter/blob/main/js/packages/wallet-adapter-mobile/src/forks/react-native/createDefaultAuthorizationResultCache.ts

steveluscher avatar Oct 21 '22 03:10 steveluscher

Yes, I'm now using my own code to handle phantom/torus/solflare wallet deeplink in my project. But now I need things to support consistently on both Web and App, which is, this library.

bdtren avatar Oct 21 '22 05:10 bdtren

@bdtren would you be interested in working with us to add your support for Phantom, Torus, and Solflare deep links to Wallet Adapter?

jordaaash avatar Oct 21 '22 05:10 jordaaash

@bdtren, if I understand you correctly, what you’re saying is that you have a web app that already uses @solana/wallet-adapter-react and you wish to use that same JavaScript code in React Native with no modifications, and have it still be able to connect to mobile wallet apps that use the SMS mobile wallet adapter protocol?

steveluscher avatar Oct 21 '22 14:10 steveluscher

Hi @jordansexton, thanks for the invitation, it is happy to help the community. But let me check my code first, I'm not sure if it can work for community.

Hi @steveluscher, yes sort of like that. My team actually have both Web(react) and App(react-native) repos, but now we want to use react-native repo to build for both Web and App. We see your demo that @solana/wallet-adapter-react can now work with fake wallet app. So we think there is a hope to do so with solflare/phantom, etc...

bdtren avatar Oct 21 '22 15:10 bdtren

Got it. So your use case is essentially that you want one WalletProvider that works on both React Native and React Native Web. I haven't tested @solana/wallet-adapter-react with React Native, but I can give it a shot.

steveluscher avatar Oct 21 '22 15:10 steveluscher

Oh wow, wait. MKKV is synchronous? This is great news.

steveluscher avatar Oct 21 '22 15:10 steveluscher