Open rayhooker opened 1 year ago
Does the example folder work?
I tried building/ running it: cd example npm install npx pod-install npx react-native start / npm run ios (two different terminal sessions)
I also set the output to iPhone SE 3rd generation using xcode and assigned a team to the project.
I am getting the error: /Users/rayhooker/Downloads/react-native-webworker-master/ios/RNWWWebWorker.mm:145:44 No member named 'NativeWebWorkerSpecJSI' in namespace 'facebook::react'
I did not see that error in my other project. Any clues?
Actually never mind the previous message. I made a change to my app. I had commented out {environment: 'light'} and added it back. It worked but not without the parameter environment: 'light'. Two questions:
Ray
The non-light environment definitely used to work. Can’t guarantee it still does 🤣 it’ll be something minor that’s broken. I’m away for a bit but can take a look when I’m back
Did you ever take a look when you got back @jacobp100
No lol. Are you also trying to use the non-light environment?
I am having trouble getting react-native-webworker to work for me. I am trying to include it in my react native cli project. I am just trying the most basic example. I have installed as per the instructions and pod install. I created a worker.js in the root identical to your example that simply defines the self.onmessage to take a parameter data and to use self.postMessage to send it back to the application.
self.onmessage = (data) => { // Message is a string // const message = e.data; self.postMessage(
Message from worker: "${data}"!); };
I used the code in the example folder to launch the webworker.` useEffect(() => { const worker = new WebWorker('./worker.js', // { // enviromnent: 'light', // } ); worker.onmessage = ({ data }) => { console.log("Got a message from worker ", data) setMessages((m) => [...m, data]); }; workerRef.current = worker; // workerRef.current.postMessage("Testing") console.log("Worker loaded", worker, worker.postMessage ) worker.postMessage("Testing") return () => { worker.terminate(); workerRef.current = undefined; }; }, []);
....