'use strict'; import type { StyleProp } from 'react-native'; import type { UnknownRecord } from '../../common'; import type { DefaultStyle } from '../../hook/commonTypes'; import type { CSSAnimationProperties } from './animation'; import type { StyleWithPseudoValues } from './pseudo'; import type { CSSTransitionCallbacks, CSSTransitionProperties, } from './transition'; /* Style type properties (properties that extends StyleProp) can be defined with other property names than "style". For example `contentContainerStyle` in FlatList. Type definition for all style type properties should act similarly, hence we pick keys with 'Style' substring with the use of this utility type. */ type PickStyleProps

= Pick< P, { [K in keyof P]-?: K extends `${string}Style` | 'style' ? K : never; }[keyof P] >; type CSSConfigProps = Partial< CSSAnimationProperties & CSSTransitionProperties & CSSTransitionCallbacks >; // The CSS config keys (animation/transition settings and callbacks) are // ours, so we `Omit` them from `TStyle` before pseudo-widening and merge // them back via `CSSConfigProps`. Widening them inline would collapse to // `never` if a base style augmentation (e.g. Expo's `expo-env.d.ts`) // redeclares those keys with conflicting types. See // https://github.com/software-mansion/react-native-reanimated/issues/9328 export type CSSStyle = TStyle extends object ? StyleWithPseudoValues> & CSSConfigProps : never; type StylePropsWithCSS

= { [K in keyof PickStyleProps

]: P[K] extends StyleProp ? U extends object ? StyleProp> : never : never; }; type RestProps

= { [K in keyof Omit>]: P[K]; }; export type PropsWithCSS

= StylePropsWithCSS

& RestProps

;