[sdk] Support React Native #271
Labels
Feature
Feedback
gRPC Adjacent
An issue where the underlying issue is directly or indirectly related to gRPC
JS
Issue To Be Solved
The latest @onflow/sdk is currently unusable by React Native apps. Its required @onflow/send uses the gRPC NodeHttpTransport which does not work with React Native.
SDK calls like
sdk.getLatestBlock()
fail with the error:Using versions:
flow version
0.6.0Suggest A Solution
Allow optional use of the gRPC ReactNativeTransport.
Example commit here showing how we got @onflow/sdk calls working from a React Native app. That hardcodes the ReactNativeTransport but it should probably be a parameter somewhere.
The primary change, from
packages/send/src/unary.js
:All the SDK calls from the example app (getAccount, getEvents, getLatestBlock, getTransactionStatus, ping, script, transaction) worked fine via RN using the above change, though more thorough testing will be needed to identify other potential issues from using RN.
I'm happy to submit a PR for the above if helpful. Open to suggestions on where to put the RN flag, or other considerations re React Native integration unsolved by the above.
The text was updated successfully, but these errors were encountered: