mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
feat(react-native): Add trackColor to SwitchProps (#29477)
Closes #29466
This commit is contained in:
committed by
Wesley Wigham
parent
d5f7360491
commit
d1d7068302
Vendored
+9
@@ -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.
|
||||
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
SectionListRenderItemInfo,
|
||||
Switch,
|
||||
RefreshControl,
|
||||
TabBarIOS,
|
||||
NativeModules,
|
||||
@@ -807,3 +808,8 @@ const NativeBridgedComponent = requireNativeComponent("NativeBridgedComponent",
|
||||
nativeProp: true,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const SwitchColorTest = () => (
|
||||
<Switch trackColor={{ true: 'pink', false: 'red'}} />
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user