Skip to content

Commit 5d0c823

Browse files
committed
Fix Switch color based props to use ColorValue typing
1 parent 2f02931 commit 5d0c823

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

generatedTypes/components/switch/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { StyleProp, ViewStyle } from 'react-native';
2+
import { StyleProp, ViewStyle, ColorValue } from 'react-native';
33
export declare type SwitchProps = {
44
/**
55
* The value of the switch. If true the switch will be turned on. Default value is false
@@ -24,19 +24,19 @@ export declare type SwitchProps = {
2424
/**
2525
* The Switch background color when it's turned on
2626
*/
27-
onColor?: string;
27+
onColor?: ColorValue;
2828
/**
2929
* The Switch background color when it's turned off
3030
*/
31-
offColor?: string;
31+
offColor?: ColorValue;
3232
/**
3333
* The Switch background color when it's disabled
3434
*/
35-
disabledColor?: string;
35+
disabledColor?: ColorValue;
3636
/**
3737
* The Switch's thumb color
3838
*/
39-
thumbColor?: string;
39+
thumbColor?: ColorValue;
4040
/**
4141
* The Switch's thumb size (width & height)
4242
*/

src/components/switch/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
3-
import {StyleSheet, Animated, Easing, StyleProp, ViewStyle} from 'react-native';
3+
import {StyleSheet, Animated, Easing, StyleProp, ViewStyle, ColorValue} from 'react-native';
44
import {Constants} from '../../helpers';
55
import {Colors, BorderRadiuses} from '../../style';
66
import {asBaseComponent} from '../../commons/new';
@@ -35,19 +35,19 @@ export type SwitchProps = {
3535
/**
3636
* The Switch background color when it's turned on
3737
*/
38-
onColor?: string;
38+
onColor?: ColorValue;
3939
/**
4040
* The Switch background color when it's turned off
4141
*/
42-
offColor?: string;
42+
offColor?: ColorValue;
4343
/**
4444
* The Switch background color when it's disabled
4545
*/
46-
disabledColor?: string;
46+
disabledColor?: ColorValue;
4747
/**
4848
* The Switch's thumb color
4949
*/
50-
thumbColor?: string;
50+
thumbColor?: ColorValue;
5151
/**
5252
* The Switch's thumb size (width & height)
5353
*/
@@ -176,7 +176,7 @@ function createStyles({
176176
disabledColor = Colors.dark70,
177177
thumbColor = Colors.white,
178178
thumbSize = DEFAULT_THUMB_SIZE
179-
}) {
179+
}: SwitchProps) {
180180
return StyleSheet.create({
181181
switch: {
182182
width,

0 commit comments

Comments
 (0)