GeekyAnts / GeekyAnts/NativeBase
Cannot set the `spinner` default props of Button
- Dominant language
- TypeScript
- Stars
- 20.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I'm not sure if this is a bug, or if it's intentional.
### CodeSandbox/Snack link
https://codesandbox.io/s/beautiful-wilson-volfmw?file=/src/theme/index.tsx
### Steps to reproduce
1. set default props of Button
```javascript
const theme = extendTheme({
config: {
// Changing initialColorMode to 'dark'
initialColorMode: "dark"
},
components: {
Button: {
defaultProps: {
spinner: loading...
}
}
}
});
```
2. use the Button
```jsx
```
the default `spinner` is not working.
### NativeBase Version
3.4.28
### Platform
- [X] Android
- [ ] CRA
- [ ] Expo
- [X] iOS
- [ ] Next
### Other Platform
_No response_
### Additional Information
Update this line of source code: https://github.com/GeekyAnts/NativeBase/blob/master/src/components/primitives/Button/Button.tsx#L100
It works fine.
```javascript
const spinnerElement = spinner || resolvedProps.spinner ? (
spinner || resolvedProps.spinner
) : (
);
```
Contributor guide
Research direction
Open src/components/primitives/Button/Button.tsx around line 100 and compare the Button's isLoading behavior with the defaultProps example in the issue. Reproduce it using the linked CodeSandbox or the provided theme and Button snippets. Done means a Button using isLoading renders the configured default spinner on Android and iOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100