Giter Club home page Giter Club logo

Comments (5)

Traviskn avatar Traviskn commented on May 23, 2024 1

Hi @craigcoles, sorry you ran into this issue!

My understanding is that if your thread.js file lives in a different folder like App/Workers/MyWorker.thread.js, then you will need to re-create that same file structure in the ios folder. The path that you pass to the new Thread('some/path') is actually the native code filepath, relative to the ios folder in the root of your project. So in this case I believe you would need to open your project in xcode, right click on your root folder and select the "New Group" option to add an "App" folder, then select the "App" folder, right click, select the "New Group" option and create a "Workers" folder, then finally right click on the "Workers" folder and select the "add files to " option to add your worker js file to the native project.

For android you would create the matching folder structure in the android/app/src/main/assets/threads folder of your project.

Let me know if that makes sense or if it still doesn't work for you. Keeping thread files at the root level definitely keeps things simpler so that you don't need to add too many extra folders in your native ios and android directories. I'll make some time to add a bit more explanation of this to the README as well

from react-native-threads.

Traviskn avatar Traviskn commented on May 23, 2024 1

Thanks, I've merged your update to the docs! Let me know if you run into any more issues

from react-native-threads.

craigcoles avatar craigcoles commented on May 23, 2024

Problem solved 🎉

I moved the worker files from ./App/Workers/*.thread.js to the root ./*.thread.js and then rebuilt the bundles (after amending the locations in the commands also) and it now works as expected in release mode.

Before I close the issue, should the documentation be updated to say thats where they need to live? Or is it intended for the workers to live anywhere inside the project?

If your file is named differently or in a different location, you can update the documented commands accordingly.

[Ref]

from react-native-threads.

craigcoles avatar craigcoles commented on May 23, 2024

Hi @Traviskn, that makes complete sense! Would it be worthwhile updating the documentation to reflect this, as this wasn't massively clear for me. If so, I don't mind submitting a PR 👍

Update: I've opened a PR 👍

from react-native-threads.

JamesPJ avatar JamesPJ commented on May 23, 2024

Ref

So in this case I believe you would need to open your project in xcode, right click on your root folder and select the "New Group" option to add an "App" folder, then select the "App" folder, right click, select the "New Group" option and create a "Workers" folder, then finally right click on the "Workers" folder and select the "add files to " option to add your worker js file to the native project.

Without these steps, iOS build will not work. I had issue fetching the worker bundles, after adding the group in xcode, it started working.

from react-native-threads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.