From d1d706830279322955cb7697b7d9e3c4220890cb Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Fri, 5 Oct 2018 14:26:49 -0400 Subject: [PATCH] feat(react-native): Add trackColor to SwitchProps (#29477) Closes #29466 --- types/react-native/index.d.ts | 9 +++++++++ types/react-native/test/index.tsx | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index b738bd923d..9642fa3a23 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8080,6 +8080,8 @@ export interface UIManagerStatic { export interface SwitchPropsIOS extends ViewProps { /** * Background color when the switch is turned on. + * + * @deprecated */ onTintColor?: string; @@ -8095,6 +8097,13 @@ export interface SwitchPropsIOS extends ViewProps { } export interface SwitchProps extends SwitchPropsIOS { + /** + * Custom colors for the switch track + * + * Color when false and color when true + */ + trackColor?: { false: string, true: string }; + /** * If true the user won't be able to toggle the switch. * Default value is false. diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index c01a709351..a040404bed 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -53,6 +53,7 @@ import { ScrollView, ScrollViewProps, SectionListRenderItemInfo, + Switch, RefreshControl, TabBarIOS, NativeModules, @@ -807,3 +808,8 @@ const NativeBridgedComponent = requireNativeComponent("NativeBridgedComponent", nativeProp: true, } }); + + +const SwitchColorTest = () => ( + +)