-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
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
Support React Native #52
Comments
I'm trying to use erebos from React Native. There is Blob and FormData in React Native so that's not the issue (see for example https://github.com/facebook/react-native/blob/master/Libraries/Network/FormData.js). |
There is another issue that is blocking me to use erebos from React Native. When I am trying to create a new SwarmClient, I get the following error: What is your idea handling the React Native specific modifications to the code? Are you planning to create a different subpackage like you have for the browser and node and put the differences there? |
Hey @agazso thanks for digging into this! If there are significant differences between the RN and browser or node version then I think it makes sense to add an |
Sounds good to me! Let me know if I can help with something. |
My main concern with adding support for React-Native is that we're not using it in any project at Mainframe at the moment, so considering the possible breaking changes between RN releases on one side, and Swarm on the other side, we would need a reliable test framework in order to actually support it. I hope in the next 3 to 6 months we'll have RN projects that need to use Erebos, but as our team is busy with other priorities I don't think we can work on this integration ourselves in the short to medium term. |
I managed to make upload work on a PoC level, but I had some issues setting up erebos as a local development project next to our project, I'm opening a separate issue for that. |
There were some build errors using Regarding testing: react-native uses JavaScriptCore on both targets (different versions though). It would be really cool if there's a way of having a test runner which uses it, but I had no luck finding one. The more heavy-weight option is using detox. |
@vujevits have you been able to use feeds please? I think adding a About the tests detox looks like a good option, I've never used it though so I don't know about the constraints and limitations. |
@PaulLeCam I managed to integrate locally an Update: there seems to be an issue which comes up when uploading images, it is probably related to |
I'd vote against putting effort into trying to support react-native. I've seen many projects trying to support it and needing to do a whole lot of refactoring to try and get things to work only to break a ton of of things in the process. Support for something like react is something you need to design for from the beginning and once you do that, then you are married to react's treadmill. What happens when react ceases to be the framework dujor? It's best to keep things vanilla. If it's vanilla, then framework users can easily port to the dujor framework of their choice and maintain it or not as they so desire. To my mind, even having the project directly emit react observables was too much, because at that point I'm stuck with either importing the nasty mess that is the react dependency chain into my project (intended for resource constrained environments), or forking and rewriting that section of code so it does what it needs to without bringing in react as a dependency. |
@sshelton76 maybe the issue / pr name is a bit misleading, it does not have much to do with React or even react-native, but the js environment which runs react-native (of course the point is that it works with react-native, hence the naming). As you can see in the PR, the differences are even smaller then between the browser and the node version. |
Added in #98 |
At the moment the browser and Node.js versions of the Bzz APIs and therefore clients are not compatible with React Native.
The main issue is that these modules use browser-specific APIs such as
Blob
andFormData
, or Node.js-specific ones such as streams and filesystem APIs. react-native-fs and rn-fetch-blob might provide good alternatives to implement the necessary APIs for React Native.The text was updated successfully, but these errors were encountered: