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

Can not change size of Badge element #159

Closed
yaronlevi opened this issue Sep 4, 2016 · 15 comments
Closed

Can not change size of Badge element #159

yaronlevi opened this issue Sep 4, 2016 · 15 comments

Comments

@yaronlevi
Copy link

According to this cheat sheet I should be able to change the badge's size. I've tried:
<Badge success style={{fontSize:5, width:10}}>99</Badge>
But I get those errors in runtime:
screen shot 2016-09-04 at 8 17 27 am

So how can I change the badge's size?

"native-base": "^0.5.7"
"react": "^15.3.0"
"react-native": "^0.32.0"
Run on iOS simulator.

@SupriyaKalghatgi
Copy link
Contributor

@yaronlevi Docs has been updated
Please check and try accordingly

@yaronlevi
Copy link
Author

Can you give me a link? I can not seem to find the change

@SupriyaKalghatgi
Copy link
Contributor

@yaronlevi The same link which you shared

@SupriyaKalghatgi
Copy link
Contributor

@yaronlevi Try clearing your cache

@yaronlevi
Copy link
Author

Is this what the updated docs looks like?
screen shot 2016-09-06 at 11 04 52 am

@SupriyaKalghatgi
Copy link
Contributor

SupriyaKalghatgi commented Sep 6, 2016

@yaronlevi Check the replacing component for Badge
screen shot 2016-09-06 at 1 36 27 pm
Also check the code for Badge.
NB wraps Text within View, so you cannot apply style={{fontSize:5, width:10}} to View

@SupriyaKalghatgi
Copy link
Contributor

@yaronlevi
screen shot 2016-09-06 at 1 39 36 pm
This says the same

@yaronlevi
Copy link
Author

Ok, so I changed the code to:
<Badge success width={10} fontSize={5}>3</Badge>
And this is what I get:
screen shot 2016-09-06 at 11 25 37 am

Can you please tell me how can I take the default Badge, and just make it smaller (both font size and the size of the circle).

@SupriyaKalghatgi
Copy link
Contributor

@yaronlevi Sorry for misguidance.
This issue has been fixed, please pull from master.
Also docs has been updated accordingly - Badge Component and CheatSheet

@yaronlevi
Copy link
Author

Still not working, my code is:

<Badge  style={{ width: 30, backgroundColor: 'black' }}
                                textStyle={{ color: 'white', fontSize: 10, lineHeight: 10 }}>
                                2
                            </Badge>

The fontSize and lineHeight seems to have no effect. The font size stays the same:
screen shot 2016-09-06 at 1 58 02 pm

@sankhadeeproy007
Copy link
Contributor

Hi @yaronlevi, can you check the contents of Widgets/Badge.js and post a screenshot of the same?

@yaronlevi
Copy link
Author

yaronlevi commented Sep 6, 2016

Ah ok my mistake. I've updated the npm to look at the repositoty.
"native-base": "github:geekyants/NativeBase",
Now it works... I have the updated file.

@sankhadeeproy007
Copy link
Contributor

Good to know!

@remoteportal
Copy link

Unless the badge can be made smaller, it's useless.

@khalibloo
Copy link

Here's my workaround. Simply scale the whole thing instead of using font size and line height.
<Badge style={{scaleX: 0.7, scaleY: 0.7}} primary><Text>1</Text></Badge>
I don't know if it has any drawbacks or how well it works for extreme scales, but it should cover simple minor adjustments at the very least.

@GeekyAnts GeekyAnts locked as resolved and limited conversation to collaborators Apr 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants