Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

M-i-k-e-l
Copy link
Collaborator

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

centerV?: boolean;
};

// type GradientType = 'rectangle' | 'circle' | 'border';
Copy link
Contributor

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'> & {
Copy link
Contributor

@adids1221 adids1221 Aug 21, 2025

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;
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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 {
Copy link
Contributor

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 ?

Copy link
Contributor

@adids1221 adids1221 left a 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.

@adids1221 adids1221 assigned M-i-k-e-l and unassigned adids1221 Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants