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 @@ -24,8 +24,39 @@ import processTransform from '../../StyleSheet/processTransform';
import processTransformOrigin from '../../StyleSheet/processTransformOrigin';
import sizesDiffer from '../../Utilities/differ/sizesDiffer';

const nativeCSSParsing = ReactNativeFeatureFlags.enableNativeCSSParsing();

const colorAttributes = {process: processColor};

/**
* Gated style attribute types. When native CSS parsing is enabled, the JS
* processor is bypassed and the raw value is sent directly to native.
* These are exported so that other ViewConfigs can reuse them.
*/
export const filterAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processFilter};

export const boxShadowAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processBoxShadow};

export const backgroundImageAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processBackgroundImage};

export const backgroundSizeAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processBackgroundSize};

export const backgroundPositionAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processBackgroundPosition};

export const backgroundRepeatAttribute: AnyAttributeType = nativeCSSParsing
? true
: {process: processBackgroundRepeat};

const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/**
* Layout
Expand Down Expand Up @@ -125,9 +156,7 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/**
* Filter
*/
filter: ReactNativeFeatureFlags.enableNativeCSSParsing()
? true
: {process: processFilter},
filter: filterAttribute,

/**
* MixBlendMode
Expand All @@ -142,29 +171,27 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/*
* BoxShadow
*/
boxShadow: ReactNativeFeatureFlags.enableNativeCSSParsing()
? true
: {process: processBoxShadow},
boxShadow: boxShadowAttribute,

/**
* BackgroundImage
*/
experimental_backgroundImage: {process: processBackgroundImage},
experimental_backgroundImage: backgroundImageAttribute,

/**
* BackgroundSize
*/
experimental_backgroundSize: {process: processBackgroundSize},
experimental_backgroundSize: backgroundSizeAttribute,

/**
* BackgroundPosition
*/
experimental_backgroundPosition: {process: processBackgroundPosition},
experimental_backgroundPosition: backgroundPositionAttribute,

/**
* BackgroundRepeat
*/
experimental_backgroundRepeat: {process: processBackgroundRepeat},
experimental_backgroundRepeat: backgroundRepeatAttribute,

/**
* View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

import type {PartialViewConfigWithoutName} from './PlatformBaseViewConfig';

import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
import {
backgroundImageAttribute,
backgroundPositionAttribute,
backgroundRepeatAttribute,
backgroundSizeAttribute,
boxShadowAttribute,
filterAttribute,
} from '../Components/View/ReactNativeStyleAttributes';
import {DynamicallyInjectedByGestureHandler} from './ViewConfigIgnore';

const bubblingEventTypes = {
Expand Down Expand Up @@ -191,24 +198,12 @@ const validAttributesForNonEventProps = {
backgroundColor: {process: require('../StyleSheet/processColor').default},
transform: true,
transformOrigin: true,
experimental_backgroundImage: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processBackgroundImage').default},
experimental_backgroundSize: {
process: require('../StyleSheet/processBackgroundSize').default,
},
experimental_backgroundPosition: {
process: require('../StyleSheet/processBackgroundPosition').default,
},
experimental_backgroundRepeat: {
process: require('../StyleSheet/processBackgroundRepeat').default,
},
boxShadow: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processBoxShadow').default},
filter: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processFilter').default},
experimental_backgroundImage: backgroundImageAttribute,
experimental_backgroundSize: backgroundSizeAttribute,
experimental_backgroundPosition: backgroundPositionAttribute,
experimental_backgroundRepeat: backgroundRepeatAttribute,
boxShadow: boxShadowAttribute,
filter: filterAttribute,
mixBlendMode: true,
isolation: true,
opacity: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

import type {PartialViewConfigWithoutName} from './PlatformBaseViewConfig';

import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
import {
boxShadowAttribute,
filterAttribute,
} from '../Components/View/ReactNativeStyleAttributes';
import {
ConditionallyIgnoredEventHandlers,
DynamicallyInjectedByGestureHandler,
Expand Down Expand Up @@ -228,12 +231,8 @@ const validAttributesForNonEventProps = {
hitSlop: {diff: require('../Utilities/differ/insetsDiffer').default},
collapsable: true,
collapsableChildren: true,
filter: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processFilter').default},
boxShadow: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processBoxShadow').default},
filter: filterAttribute,
boxShadow: boxShadowAttribute,
mixBlendMode: true,
isolation: true,

Expand Down
Loading