GeekyAnts / GeekyAnts/NativeBase

Customizing components in theme with `0` margin doesn't work (uses defaults instead)

Open
#5,394 1 comment 0 reactions 0 assignees View on GitHub
bug triage v3
Dominant language
TypeScript
Stars
20.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### Description

Passing a `0` value to for instance `marginTop` property should produce no top margin for the component, but default one is applied instead. It can be "fixed" by passing `"0"` (as string).

### CodeSandbox/Snack link

https://snack.expo.dev/-01m8XvAb

### Steps to reproduce

1. Open reproduction link.
2. Observe the space between both labels.
3. Comment lines 10 and 11.
4. See that no changes were applied.
5. Uncomment lines 13 and 14.
6. See that there's no space between labels (margins are actually set to 0).

### NativeBase Version

3.4.16

### Platform

- [X] Android
- [ ] CRA
- [ ] Expo
- [X] iOS
- [ ] Next

### Other Platform

Web

### Additional Information

I suppose `0` here is treaded as falsy value so the default one is used instead. That's why when passing `"0"` which is not falsy, everything works ok. Probably there is somewhere an **OR** (`||`) operator used instead of **Nullish coalescing operator** (`??`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.