Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow displaying an SVG logo using svg source #1

Merged

Conversation

Kicu
Copy link
Member

@Kicu Kicu commented Apr 19, 2024

Problem

in the current version of this library only image assets (like .png etc) can be used as a logo within QR code, svg assets would not work.

What this does

This PR tries to make it possible to use svgs.

I have not found any reasonable way to do this via the single logo prop, as there is no React component that could accept either ImageSourcePropType or an SVG and handle every case correctly. Some conditional logic is required to handle the svg prop, thats why I decided to add it as a new prop, while the old logo prop will work unchanged.

  • add (optional) logoSVG prop that accepts an svg and will render it
  • add (optional) logoColor prop to set the fill property of the logo
  • this solution handles:
  • on web we either render the svg logo if its a component OR in case of string we use standard Image from react-native-svg
  • on native ios/android we use special dedicated components from react-native-svg which handle all the cases

I consider this WIP and api might still change

examples

ios

Screenshot 2024-03-27 at 14 40 35

web

Screenshot 2024-04-03 at 10 25 06 Screenshot 2024-04-03 at 10 36 52

android

Screenshot 2024-04-03 at 10 37 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants