Skip to content
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

[React Native] Can currently only create a blob from other Blobs #40

Closed
hasancanozkan opened this issue Sep 5, 2017 · 13 comments
Closed

Comments

@hasancanozkan
Copy link

Hi, I have a RN application and just want to try parallel programming using hamsters.js. First, I created a demo app to try it with a worker, namely https://github.com/fabriciovergal/react-native-workers. however I am getting a strange error,
What version of the library --> 4.2.0
What operating system are you seeing the issue on? --> Windows
Which platform (and or) browser are you seeing the issue on? React Native on andorid
What is the version of the platform (and or) browser you are seeing the issue on? --> RN 48.0
The code that I wrote simply (i saw this in how the library manages your data) :
initHamsters(){
const startOptions = {
maxThreads: 4,
cache: false,
debug: false,
persistence: false,
Worker: Worker
};
hamsters.init(startOptions);
const params = {
array: [1,2,3,4,5,6,7,8,9,10],
animal: 'Hamster',
};
hamsters.run(params, function() {
if(params.animal === 'Hamster') {
rtn.data.push('Hamsters are awesome');
}
}, function(result) {
console.log(result);
});
}
I have to say that there is not so many worker libraries availalbler for react native, and the one that I found was working, i tried it. However, it has some requirements like using two ports and having index.worker.js and I didnt provide them to run this code. the error is like this :
img_1313
and as I understand this is a react native error, which doesnt allow to use this library and Worker library.
Any ideas?

@austinksmith
Copy link
Owner

austinksmith commented Sep 6, 2017 via email

@austinksmith
Copy link
Owner

Cross referencing this bug report facebook/react-native#16034

@austinksmith austinksmith changed the title can currently only create a blob from other Blobs [React Native] Can currently only create a blob from other Blobs Oct 2, 2017
@amos80m
Copy link

amos80m commented Jan 3, 2018

same problem

@austinksmith
Copy link
Owner

We are still waiting for this to land, looks like it wont be official until 0.53 at the earliest. facebook/react-native#11573

Fortunately the new version of Hamsters.js will include a workaround for this, though it's not ideal it should get us past this issue once and for all.

@satya164
Copy link

This is an interesting issue and it seems to revolve around ReactNative not supporting data blobs all of a sudden

FYI React Native never supported Blobs.

@amos80m
Copy link

amos80m commented Jan 23, 2018

I moved my code to Heroku => post the image file and send it to Firestore.
working 100%

@austinksmith
Copy link
Owner

@satya164 I can definitively say the library worked flawlessly (Android 4.0+) when I first started developing using ReactNative about a year and a half ago. Blob support was never an issue, whether it really worked or just failed silently the library never had an issue running until recent version of RN were released. Perhaps it has something to do with their push for the new fiber stuff.

There is a solution to this problem but it requires using the external common/wheel.min.js file instead of blobs similarly to how IE10 support works (microsoft security problems)

@austinksmith
Copy link
Owner

@amos80m You solved the problem within Hamsters.js or the problem within ReactNative? I'm not sure i follow.

@satya164
Copy link

It's not related to Fiber. There was no Blob object available earlier. Blob support was added recently, but it's not full-featured yet. If your code had a fallback without blobs, it was probably working, and if not, it was failing silently.

@austinksmith
Copy link
Owner

Can you give dev branch a try alongside react-native-threads? Just make sure you import the library as laid out below. Apologies for the long delay, next version is a complete ground up rewrite of the library and its taken a long time to get it where I want.

import { Thread } from 'react-native-threads';

and then do this on your library startup

hamsters.init({
  Worker: Thread
});

Please report back your results, I'm nearing completion on the next library version and react native support is important, thanks!

@austinksmith
Copy link
Owner

I do not have access to any systems that will allow me to test react native support especially for IOS or AppleTV etc. I will need the community to validate this works.

@amos80m
Copy link

amos80m commented Feb 18, 2018

@austinksmith I created a Node.j.s App that receive images files as post from react native app.
the Node.js App is connected as an Admin to firebase and saving my uploaded images to firestore.
and i can upload as many images and sizes as I need without any issues

@austinksmith
Copy link
Owner

I've released version 5.0.0 of Hamsters.js, this should resolve any outstanding react native issues but please open a ticket if it does not 👍 thanks!

https://github.com/austinksmith/Hamsters.js/releases/tag/v5.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants