Using lottie-react-native and react-native-svg in a package built with react-native-builder-bob #419
Replies: 3 comments
-
|
If you installed the package on another project, you could check the node_modules to see if everything is bundled correctly. You can look for SVG and JSON files. Other than that, please check your imports and exports. |
Beta Was this translation helpful? Give feedback.
-
|
If you're using If you want to make it work without additional work on consumer's side then you'd need to change how you convert those SVGs into components. Instead of using a metro transformer, use a different CLI that converts the SVGs to components. The converted components should then be in the final package. To do that, the easiest way would be to run that command to convert the SVGs and then commit the components. |
Beta Was this translation helpful? Give feedback.
-
|
There are a few things you can check to troubleshoot the issues you're facing with the Spinner and Icon components.
If you have followed these steps and the issues with the Spinner and Icon components persist, it may be helpful to provide additional information such as code snippets or error messages for further analysis. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently developing an internal package that aims to share components between similar React Native projects.
One of the components is a
Spinnerwhich is built withlottie-react-native, and loads the animation from a JSON file, and I also have aIconcomponent which is an abstraction that usesreact-native-svgto return different icons based on anameprop, with these icons being loaded from SVG files.The issue that I'm facing is that neither of these components work correctly, with the
Spinnersimply not showing and theIconthrowing anInvalid element typeerror. My guess is that it has something to do with the JSON and SVG files, because other components work just fine.I've placed both of these packages in the peer dependencies as the documentation states, and included the
assetsfolder in thesrc, so it's being included in the build, but still doesn't work.Am I missing any step?
Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions