mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-11 22:37:31 +08:00
Merge pull request #28873 from ide/rn-style-types
[react-native] Declare StyleSheet.setStyleAttributePreprocessor
This commit is contained in:
14
types/react-native/index.d.ts
vendored
14
types/react-native/index.d.ts
vendored
@@ -5218,6 +5218,20 @@ export namespace StyleSheet {
|
||||
export function flatten(style?: StyleProp<ImageStyle>): ImageStyle;
|
||||
export function flatten(style?: StyleProp<ViewStyle>): ViewStyle;
|
||||
|
||||
/**
|
||||
* WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
|
||||
* not be reliably announced. The whole thing might be deleted, who knows? Use
|
||||
* at your own risk.
|
||||
*
|
||||
* Sets a function to use to pre-process a style property value. This is used
|
||||
* internally to process color and transform values. You should not use this
|
||||
* unless you really know what you are doing and have exhausted other options.
|
||||
*/
|
||||
export function setStyleAttributePreprocessor(
|
||||
property: string,
|
||||
process: (nextProp: any) => any
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is defined as the width of a thin line on the platform. It can be
|
||||
* used as the thickness of a border or division between two elements.
|
||||
|
||||
@@ -153,6 +153,8 @@ const stylesAlt = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
StyleSheet.setStyleAttributePreprocessor('fontFamily', (family: string) => family);
|
||||
|
||||
const welcomeFontSize = StyleSheet.flatten(styles.welcome).fontSize;
|
||||
|
||||
const viewStyle: StyleProp<ViewStyle> = {
|
||||
|
||||
Reference in New Issue
Block a user