Skip to content
Closed
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 @@ -11,6 +11,7 @@
import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';

import processAspectRatio from '../../StyleSheet/processAspectRatio';
import processBoxShadow from '../../StyleSheet/processBoxShadow';
import processColor from '../../StyleSheet/processColor';
import processFilter from '../../StyleSheet/processFilter';
import processFontVariant from '../../StyleSheet/processFontVariant';
Expand Down Expand Up @@ -125,6 +126,11 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
*/
experimental_mixBlendMode: true,

/*
* BoxShadow
*/
experimental_boxShadow: {process: processBoxShadow},

/**
* View
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ const validAttributesForNonEventProps = {
process: require('../StyleSheet/processFilter').default,
},
experimental_mixBlendMode: true,
experimental_boxShadow: {
process: require('../StyleSheet/processBoxShadow').default,
},
opacity: true,
elevation: true,
shadowColor: {process: require('../StyleSheet/processColor').default},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ const validAttributesForNonEventProps = {
experimental_filter: {
process: require('../StyleSheet/processFilter').default,
},
experimental_boxShadow: {
process: require('../StyleSheet/processBoxShadow').default,
},

borderTopWidth: true,
borderTopColor: {process: require('../StyleSheet/processColor').default},
Expand Down
65 changes: 46 additions & 19 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ import {Animated} from '../Animated/Animated';
import {ImageResizeMode} from '../Image/ImageResizeMode';
import {ColorValue} from './StyleSheet';

export type FilterPrimitive =
| {brightness: number | string}
| {blur: number | string}
| {contrast: number | string}
| {grayscale: number | string}
| {'hue-rotate': number | string}
| {invert: number | string}
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {'drop-shadow': DropShadowPrimitive | string};

export type DropShadowPrimitive = {
offsetX: number | string;
offsetY: number | string;
standardDeviation?: number | string | undefined;
color?: ColorValue | number | undefined;
};

type FlexAlignType =
| 'flex-start'
| 'flex-end'
Expand Down Expand Up @@ -246,6 +227,52 @@ export interface TransformsStyle {
translateY?: AnimatableNumericValue | undefined;
}

export type FilterPrimitive =
| {brightness: number | string}
| {blur: number | string}
| {contrast: number | string}
| {grayscale: number | string}
| {'hue-rotate': number | string}
| {invert: number | string}
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {'drop-shadow': DropShadowPrimitive | string};

export type DropShadowPrimitive = {
offsetX: number | string;
offsetY: number | string;
standardDeviation?: number | string | undefined;
color?: ColorValue | number | undefined;
};

export type BoxShadowPrimitive = {
offsetX: number | string;
offsetY: number | string;
color?: string | undefined;
blurRadius?: ColorValue | number | undefined;
spreadDistance?: number | string | undefined;
inset?: boolean | undefined;
};

export type BlendMode =
| 'normal'
| 'multiply'
| 'screen'
| 'overlay'
| 'darken'
| 'lighten'
| 'color-dodge'
| 'color-burn'
| 'hard-light'
| 'soft-light'
| 'difference'
| 'exclusion'
| 'hue'
| 'saturation'
| 'color'
| 'luminosity';

/**
* @see https://reactnative.dev/docs/view#style
*/
Expand Down
56 changes: 31 additions & 25 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,6 @@ export type EdgeInsetsValue = {
bottom: number,
};

export type FilterPrimitive =
| {brightness: number | string}
| {blur: number | string}
| {contrast: number | string}
| {grayscale: number | string}
| {'hue-rotate': number | string}
| {invert: number | string}
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {'drop-shadow': DropShadowPrimitive | string};

export type DropShadowPrimitive = {
offsetX: number | string,
offsetY: number | string,
standardDeviation?: number | string,
color?: ____ColorValue_Internal | number,
};

export type DimensionValue = number | string | 'auto' | AnimatedNode | null;
export type AnimatableNumericValue = number | AnimatedNode;

Expand Down Expand Up @@ -709,11 +690,35 @@ export type ____ShadowStyle_Internal = $ReadOnly<{
...____ShadowStyle_InternalOverrides,
}>;

type ____FilterStyle_Internal = $ReadOnly<{
experimental_filter?: $ReadOnlyArray<FilterPrimitive>,
}>;
export type FilterPrimitive =
| {brightness: number | string}
| {blur: number | string}
| {contrast: number | string}
| {grayscale: number | string}
| {'hue-rotate': number | string}
| {invert: number | string}
| {opacity: number | string}
| {saturate: number | string}
| {sepia: number | string}
| {'drop-shadow': DropShadowPrimitive | string};

export type DropShadowPrimitive = {
offsetX: number | string,
offsetY: number | string,
standardDeviation?: number | string,
color?: ____ColorValue_Internal,
};

export type ____MixBlendMode_Internal =
export type BoxShadowPrimitive = {
offsetX: number | string,
offsetY: number | string,
color?: ____ColorValue_Internal,
blurRadius?: number | string,
spreadDistance?: number | string,
inset?: boolean,
};

type ____BlendMode_Internal =
| 'normal'
| 'multiply'
| 'screen'
Expand All @@ -735,8 +740,6 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
...$Exact<____LayoutStyle_Internal>,
...$Exact<____ShadowStyle_Internal>,
...$Exact<____TransformStyle_Internal>,
...____FilterStyle_Internal,
experimental_mixBlendMode?: ____MixBlendMode_Internal,
backfaceVisibility?: 'visible' | 'hidden',
backgroundColor?: ____ColorValue_Internal,
borderColor?: ____ColorValue_Internal,
Expand Down Expand Up @@ -775,6 +778,9 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
elevation?: number,
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
cursor?: CursorValue,
experimental_boxShadow?: $ReadOnlyArray<BoxShadowPrimitive>,
experimental_filter?: $ReadOnlyArray<FilterPrimitive>,
experimental_mixBlendMode?: ____BlendMode_Internal,
}>;

export type ____ViewStyle_Internal = $ReadOnly<{
Expand Down
Loading