@@ -22,10 +22,6 @@ import { createComponent } from "../../utils/createComponent";
2222
2323export type SwitchSize = "sm" | "md" | "lg" | "xl" ;
2424export type SwitchTheme = "base" | "primary" ;
25- < < << << < HEAD
26-
27- = === ===
28- >>> >>> > 2c29ca8 (refactor(switch): :recycle: assign inline types to type variables,)
2925export interface SwitchProps extends BoxProps {
3026 /**
3127 * Default Value of the switch
@@ -84,19 +80,11 @@ export interface SwitchProps extends BoxProps {
8480 /**
8581 * The Label of the switch component.
8682 */
87- < < << << < HEAD
8883 label : string | null ;
8984 /**
9085 * The Description of the switch component.
9186 */
9287 description : string | null ;
93- = === ===
94- label: string ;
95- /**
96- * The Description of the switch component.
97- */
98- description: string ;
99- > >>> >>> 2 c29ca8 ( refactor ( switch ) : :recycle : assign inline types to type variables , )
10088}
10189
10290const SPRING_CONFIG = {
@@ -114,7 +102,6 @@ const RNSwitch: React.FC<Partial<SwitchProps>> = forwardRef<
114102> ( ( props , _ref ) => {
115103 const tailwind = useTheme ( ) ;
116104 const switchTheme = useTheme ( "switchTheme" ) ;
117- < < << << < HEAD
118105
119106 const {
120107 onStateChange,
@@ -210,84 +197,6 @@ const RNSwitch: React.FC<Partial<SwitchProps>> = forwardRef<
210197 } ,
211198 ) ;
212199
213- === = ===
214-
215- const {
216- onStateChange,
217- state,
218- defaultState = false ,
219- size = "xl" ,
220- onStateColor : onStateColorFromProps ,
221- offStateColor : offStateColorFromProps ,
222- disabled = false ,
223- offStatePressedColor : offStatePressedColorFromProps ,
224- onStatePressedColor : onStatePressedColorFromProps ,
225- thumbTintColor : thumbTintColorFromProps ,
226- themeColor = "base" ,
227- label,
228- description,
229- style,
230- ...otherProps
231- } = props ;
232-
233- const [ switchState , setSwitchState ] = useControllableState ( {
234- defaultValue : defaultState ,
235- value : state ,
236- onChange : onStateChange ,
237- } ) ;
238-
239- const thumbAnimated = useSharedValue ( switchState ? 1 : 0 ) ;
240- /**
241- * Setting Active/Inactive and Default Colors
242- */
243- const onStateColor = disabled
244- ? ( tailwind . getColor (
245- cx ( switchTheme . themeColor [ themeColor ] ?. activeWrapper ?. disabled ) ,
246- ) as string )
247- : onStateColorFromProps ||
248- ( tailwind . getColor (
249- cx ( switchTheme . themeColor [ themeColor ] ?. activeWrapper ?. default ) ,
250- ) as string ) ;
251-
252- const offStateColor = disabled
253- ? ( tailwind . getColor (
254- cx ( switchTheme . themeColor [ themeColor ] ?. inActiveWrapper ?. disabled ) ,
255- ) as string )
256- : offStateColorFromProps ||
257- ( tailwind . getColor (
258- cx ( switchTheme . themeColor [ themeColor ] ?. inActiveWrapper ?. default ) ,
259- ) as string ) ;
260-
261- const offStatePressedColor =
262- offStatePressedColorFromProps ||
263- ( tailwind . getColor (
264- cx ( switchTheme . themeColor [ themeColor ] ?. inActiveWrapper ?. active ) ,
265- ) as string ) ;
266- const onStatePressedColor =
267- onStatePressedColorFromProps ||
268- ( tailwind . getColor (
269- cx ( switchTheme . themeColor [ themeColor ] ?. activeWrapper ?. active ) ,
270- ) as string ) ;
271- const thumbTintColor =
272- thumbTintColorFromProps || tailwind . getColor ( cx ( switchTheme . thumbColor ) ) ;
273- /**
274- * Setting Active/Inactive and Default Colors
275- */
276-
277- /**
278- * The Switch Animation Helpers
279- */
280- const interpolatedWidths = switchTheme . size [ size ] ?. switchInterpolateWidths ;
281-
282- const translatedThumbDistance = switchTheme . size [ size ] ?. thumbTranslateValue ;
283- const initTranslatedThumbDistance =
284- switchTheme . size [ size ] ?. thumbInitTranslateValue ;
285- const intermediateThumbTranslateValue =
286- switchTheme . size [ size ] ?. thumbIntermediateTranslateValue ;
287-
288- const thumbAnimated = useSharedValue ( switchState ? 1 : 0 ) ;
289-
290- >>> > >>> 2 c29ca8 ( refactor ( switch ) : :recycle : assign inline types to type variables , )
291200 const animatedSwitchBackground = useAnimatedStyle ( ( ) => {
292201 return {
293202 backgroundColor : interpolateColor (
0 commit comments