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

Fix custom icon aspect ratio #39

Closed
fredrikburmester opened this issue Oct 13, 2024 · 6 comments · Fixed by #65
Closed

Fix custom icon aspect ratio #39

fredrikburmester opened this issue Oct 13, 2024 · 6 comments · Fixed by #65
Labels
bug Something isn't working good first issue Good for newcomers iOS

Comments

@fredrikburmester
Copy link

fredrikburmester commented Oct 13, 2024

See difference between sfSymbol and PNG image of same icon. It's very clear when looking at a real device.

Screenshot 2024-10-13 at 13 28 43

PNG Icon is rendered at point size 200 with pixel size 10x.

The icon is also rendered incorrectly (too large)

Screenshot 2024-10-13 at 13 36 04

My code

tabBarIcon: ({ color, focused, size }) =>
            require("@/assets/icons/magnifyingglass.png"),
@okwasniewski okwasniewski added bug Something isn't working iOS labels Oct 13, 2024
@okwasniewski
Copy link
Collaborator

Hey, thanks for opening the issue.

Does it also occur on Android?

@fredrikburmester
Copy link
Author

I'm having a hard time testing Android, see my other issue.

@okwasniewski
Copy link
Collaborator

Hey, the issue with low resolution should be fixed in 0.0.10 let me know if it works for you 😄

@fredrikburmester
Copy link
Author

They are no longer rendered in a low resolution but the aspect ration is not correct.

Screenshot 2024-10-16 at 14 11 47

Comparison to original SF icon:

Screenshot 2024-10-16 at 14 12 05

@okwasniewski okwasniewski changed the title PNG icons are rendered at a low resolution Allow to customize custom icon size Oct 18, 2024
@okwasniewski okwasniewski added enhancement New feature or request and removed bug Something isn't working labels Oct 18, 2024
@okwasniewski
Copy link
Collaborator

Thanks for checking it out @fredrikburmester, changed issue title to add this as a new feature, currently the icon size is a constant. We should either allow for specifying icon size or fix the aspect ratio

@okwasniewski okwasniewski changed the title Allow to customize custom icon size Fix custom icon aspect ratio Oct 18, 2024
@okwasniewski okwasniewski added bug Something isn't working and removed enhancement New feature or request labels Oct 18, 2024
@okwasniewski
Copy link
Collaborator

Edit: I think this can be fixed by adjusting this property: https://github.com/okwasniewski/react-native-bottom-tabs/blob/9f0f34b53270b830b43cde7ee6bdb63f1651bb17/ios/TabViewProvider.swift#L119

It's currently set to RCTResizeMode.contain changing this should fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants