From 1ebf446de5292befe2c817d6852cf3a7b4fe9352 Mon Sep 17 00:00:00 2001 From: David Pett Date: Wed, 10 Apr 2019 08:05:57 -0500 Subject: [PATCH 1/2] adding fontVariant to TextStyleIOS according to https://facebook.github.io/react-native/docs/text.html#style >fontVariant: array of enum('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') (iOS) I added support by first creating a union type for FontVariant with the enum values, then adding fontVariant as an optional property that accepts an array of type FontVariant --- types/react-native/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 99998e9241..df8c1e7695 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -757,7 +757,9 @@ export interface LayoutChangeEvent { }; } +export type FontVariant = 'small-caps' | 'oldstyle-nums' | 'lining-nums' | 'tabular-nums' | 'proportional-nums'; export interface TextStyleIOS extends ViewStyle { + fontVariant?: FontVariant[]; letterSpacing?: number; textDecorationColor?: string; textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"; From 7b884f7562c343e85d3c0dcb7686410fcc4fb20c Mon Sep 17 00:00:00 2001 From: David Pett Date: Wed, 10 Apr 2019 08:34:11 -0500 Subject: [PATCH 2/2] added tests for fontVariant --- types/react-native/test/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 7de9b96374..d6f55c3f4d 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -178,10 +178,14 @@ const textStyle: StyleProp = { const imageStyle: StyleProp = { resizeMode: "contain", }; +const fontVariantStyle: StyleProp = { + fontVariant: ['tabular-nums'] +} const viewProperty = StyleSheet.flatten(viewStyle).backgroundColor; const textProperty = StyleSheet.flatten(textStyle).fontSize; const imageProperty = StyleSheet.flatten(imageStyle).resizeMode; +const fontVariantProperty = StyleSheet.flatten(fontVariantStyle).fontVariant; const s = StyleSheet.create({ shouldWork: {