docs: add note about transformers like react-native-svg-transformer #362
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
react-native-svg-transformer
is a popular transformer that plenty of people in the RN ecosystem use to import SVGs as React components. This transformer however, breaks SVG usage in this library.This is not the fault of this library, rather more so on the transformer as it's modifying the default behavior of React Native's (more specifically Metro's) asset handling.
However, as this approach is quite popular, it makes sense adding a note in the docs about it. There's two parts to the warning: first, informing the end user that such transformers will break this functionality. I also added an example of how to resolve this with
react-native-svg-transformer
specifically as it's quite a popular lib.react-native-svg-transformer
unfortunately overrides thesvg
extension specifically and does not give you an option to change the extension it's overriding (so nosvg?react
for example 😞), so my proposed solution uses another extension that resolves the SVG to Metro's standard resolution of SVGs and uses that in the code for thetabBarIcon
.Existing GitHub issue showing people struggling with this: #143 (comment)
Cheers, and thanks for this amazing library!
How to test?
N/A
Screenshots
N/A