-
Notifications
You must be signed in to change notification settings - Fork 740
feat(Button): add customBackground prop for custom background elements #3799
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small comments, feel free to merge after they are handled
label="Image Background" | ||
customBackground={ | ||
<Image | ||
source={{uri: 'https://picsum.photos/300'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to generate a random picture every time, it can cause issues in tests (if we have or will have them)
src/components/button/index.tsx
Outdated
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use our View
, you can use the absF
modifier to avoid these (except the overflow
).
Up to you.
src/components/button/index.tsx
Outdated
...others | ||
} = this.props; | ||
const shadowStyle = this.getShadowStyle(); | ||
const {margins, paddings} = modifiers; | ||
const backgroundColor = this.getBackgroundColor(); | ||
const backgroundColor = customBackground ? 'transparent' : this.getBackgroundColor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const backgroundColor = customBackground ? 'transparent' : this.getBackgroundColor(); | |
const backgroundColor = customBackground ? undefined : this.getBackgroundColor(); |
#3799) * feat(Button): add customBackground prop for custom background elements * feat(ButtonScreen): add custom gradient and image background buttons examples * fix(Button): update customBackground handling and improve button styles
Description
New
customBackground
prop to the Button component that allows users to render custom React elements as button backgrounds.This prop takes precedence over the
backgroundColor
.Changelog
Button - Added
customBackground
prop to enable custom background elementsAdditional info
N/A