teleport-code-generators
teleport-code-generators copied to clipboard
Resource paths for resource-loader react-native plugin
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