callstackincubator / rebolt-navigation

Fast and declarative router for Rebolt
https://rebolt-navigation.callstack.com/
MIT License
208 stars 11 forks source link

Suggestion to use the in-source bs build config to make working with relative asset imports easier #83

Closed fakenickels closed 6 years ago

fakenickels commented 6 years ago

The current assets importing in RRN were making our project crash in the simulator then we realized that it is because of the way the lib is handling the outputs.

Here we decided to move to always use the in-source build config in bsconfig.json to make easier to do relative asset imports.

When using the default lib/js as output it is needed to really think hard to require the asset because you need to get outside ./lib/js until reaching again the folder in ./src.

So instead of doing this in here

          <Image
            source=(
              Required(
                Packager.require("../../../src/assets/back-icon-mask.png"),
              )
            )
            style=Styles.iconMask
          />

would be just

          <Image
            source=(
              Required(
                Packager.require("./assets/back-icon-mask.png"),
              )
            )
            style=Styles.iconMask
          />

Much easier to do! Would like to point also that this requires the package user to also use in-build builds.

What do you guys think? We can make a PR changing it

fakenickels commented 6 years ago

Proposal branch https://github.com/knowbody/reroute-native/tree/hotfix/header-asssets-imports

knowbody commented 6 years ago

this is awesome, we didn't know how to make it work. Thank you!

knowbody commented 6 years ago

can you send the PR with this?

grabbou commented 6 years ago

Oh, thank you for this contribution! Didn't know this ever existed.

CC: @wokalski might be worth PR example to React Native bindings too.

knowbody commented 6 years ago

closed by #87

once again thank you @grsabreu