AbsaOSS / rn-indy-sdk

This code was starting point of https://github.com/hyperledger/indy-sdk-react-native where the work continues.
Apache License 2.0
11 stars 6 forks source link

fix: fixed hot reload on React Native #47

Closed icc-romeu closed 3 years ago

icc-romeu commented 3 years ago

This is a fix for RN Hot reload. I picked @TimoGlastra work and fixed it for iOS -it was not working- and Android.

The problem was that React Native reloads the native modules each time you reload the app and usually Metro will do that each time you save a file. Hence, the Wallet and Pool handles are lost on the native module, but they are still opened in libindy, and you got an error.

What I did is defining the wallet and the pool handles as static dictionaries, and store them in memory. They cannot be class members as IndySDK class is re-created each time RN reloads.

I fixed some deprecation warnings on iOS too.

icc-romeu commented 3 years ago

@JamesKEbert maybe this is interesting for you if you are using it on Aries Bifold

icc-romeu commented 3 years ago

This fixes https://github.com/AbsaOSS/rn-indy-sdk/issues/41

icc-romeu commented 3 years ago

Fixed your comment @TimoGlastra. Ready to be merged if you want to 😄

TimoGlastra commented 3 years ago

Looks good to me! I don't have permission to merge however.

We need @jakubkoci for that

JamesKEbert commented 3 years ago

Thanks for your additions here @icc-romeu and @TimoGlastra !