teleport-code-generators icon indicating copy to clipboard operation
teleport-code-generators copied to clipboard

Resource paths for resource-loader react-native plugin

Open alexnm opened this issue 4 years ago • 0 comments

The resource loader plugin uses two ways of loading resources in react native components

if (sourcePath.includes(Constants.ASSETS_IDENTIFIER)) {
  // Assuming the components are generated next to the assets folder
  setResourceRequireCall(sourceAttrAST, `..${sourcePath}`)
} else {
  setResourceURIObject(sourceAttrAST)
}

For the local assets, we need a way of computing the path dynamically. Currently a .. is appended, assuming that components and assets are two adjacent folders. But from the project strategy, you could set any kind of structure in theory

alexnm avatar Oct 23 '19 08:10 alexnm