-
Notifications
You must be signed in to change notification settings - Fork 738
Incubator.Gradient - new component #3795
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
base: master
Are you sure you want to change the base?
Conversation
centerV?: boolean; | ||
}; | ||
|
||
// type GradientType = 'rectangle' | 'circle' | 'border'; |
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 can be removed
@@ -0,0 +1,35 @@ | |||
import type {LinearGradientProps} from 'react-native-linear-gradient'; | |||
|
|||
type CommonGradientProps = Pick<LinearGradientProps, 'colors' | 'children'> & { |
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.
LinearGradientProps has start & end
props (link), I think the user should be able to control them.
Nice work with the angle
prop but playing with start & end
can give you more results (what I asked about if the gradient can start from another point)
|
||
type CommonGradientProps = Pick<LinearGradientProps, 'colors' | 'children'> & { | ||
angle?: number; | ||
center?: boolean; |
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.
The center alignment props only affect the children content, not the gradient.
These should be moved to a separate prop group like ContentAlignmentProps
with boolean values, WDYT ?
const {type = 'rectangle', ...others} = props; | ||
|
||
useEffect(() => { | ||
if (LinearGradient === undefined) { |
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 useEffect
isn't relevant because the fallback is {default: () => null}
, not undefined
.
Am I missing something ?
} | ||
}, []); | ||
|
||
if (!LinearGradient) { |
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 if (!LinearGradient)
check is irrelevant because LinearGradient
cannot be falsy (it's either a component or a function).
The fallback function () => null
will pass this check consider checking if (LinearGradient === null)
instead.
@@ -16,24 +16,29 @@ import { | |||
View | |||
} from 'react-native-ui-lib'; | |||
|
|||
interface RadioGroupOptions { | |||
interface StateOptions { |
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 file includes changes that belong in a different PR.
Have you verified that these changes don't break other screens ?
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.
Looks great, Iv'e left few comments.
Description
Incubator.Gradient - new component
Ideally this would be using something other than
react-native-linear-gradient
, however I did not manage to get all the features to work consistently.Changelog
Incubator.Gradient - new component
Additional info
None