Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import processBackgroundPosition from '../../StyleSheet/processBackgroundPositio
import processBackgroundRepeat from '../../StyleSheet/processBackgroundRepeat';
import processBackgroundSize from '../../StyleSheet/processBackgroundSize';
import processBoxShadow from '../../StyleSheet/processBoxShadow';
import processClipPath from '../../StyleSheet/processClipPath';
import processColor from '../../StyleSheet/processColor';
import processFilter from '../../StyleSheet/processFilter';
import processFontVariant from '../../StyleSheet/processFontVariant';
Expand Down Expand Up @@ -203,7 +204,9 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
outlineStyle: true,
outlineWidth: true,
pointerEvents: true,

clipPath: ReactNativeFeatureFlags.enableNativeCSSParsing()
? true
: {process: processClipPath},
/**
* Text
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ const validAttributesForNonEventProps = {
borderStyle: true,
hitSlop: true,
pointerEvents: true,
clipPath: true,
nativeBackgroundAndroid: true,
nativeForegroundAndroid: true,
needsOffscreenAlphaCompositing: true,
Expand Down
80 changes: 80 additions & 0 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,85 @@ export type BoxShadowValue = {
inset?: boolean,
};

export type ClipPathGeometryBox =
| 'border-box'
| 'padding-box'
| 'content-box'
| 'margin-box'
| 'fill-box'
| 'stroke-box'
| 'view-box';

export type ClipPathFillRule = 'nonzero' | 'evenodd';

export type ClipPathInsetShape = {
type: 'inset',
top?: number | string | null,
bottom?: number | string | null,
left?: number | string | null,
right?: number | string | null,
borderRadius?: number | string | null,
...
};

export type ClipPathCircleShape = {
type: 'circle',
r?: number | string | null,
cx?: number | string | null,
cy?: number | string | null,
...
};

export type ClipPathEllipseShape = {
type: 'ellipse',
rx?: number | string | null,
ry?: number | string | null,
cx?: number | string | null,
cy?: number | string | null,
...
};

export type ClipPathPolygonShape = {
type: 'polygon',
points: $ReadOnlyArray<{x: number | string, y: number | string, ...}>,
fillRule?: ClipPathFillRule | null,
...
};

export type ClipPathRectShape = {
type: 'rect',
top: number | string | 'auto',
right: number | string | 'auto',
bottom: number | string | 'auto',
left: number | string | 'auto',
borderRadius?: number | string | null,
...
};

export type ClipPathXywhShape = {
type: 'xywh',
x: number | string,
y: number | string,
width: number | string,
height: number | string,
borderRadius?: number | string | null,
...
};

export type ClipPathBasicShape =
| ClipPathInsetShape
| ClipPathCircleShape
| ClipPathEllipseShape
| ClipPathPolygonShape
| ClipPathRectShape
| ClipPathXywhShape;

export type ClipPathValue = {
shape?: ClipPathBasicShape | null,
geometryBox?: ClipPathGeometryBox | null,
...
};

type ____BlendMode_Internal =
| 'normal'
| 'multiply'
Expand Down Expand Up @@ -898,6 +977,7 @@ export type ____ViewStyle_InternalBase = $ReadOnly<{
| $ReadOnlyArray<BackgroundRepeatValue>
| string,
isolation?: 'auto' | 'isolate',
clipPath?: ClipPathValue | string,
}>;

export type ____ViewStyle_InternalCore = $ReadOnly<{
Expand Down
Loading