-
Notifications
You must be signed in to change notification settings - Fork 734
Migrate Slider, GradientSlider and ColorSliderGroup components to TypeScript. #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
and slider context to TS
@@ -20,7 +20,6 @@ import Text from '../text'; | |||
import TouchableOpacity from '../touchableOpacity'; | |||
import Dialog, {DialogProps} from '../dialog'; | |||
import Button from '../button'; | |||
//@ts-expect-error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows as an error in TS compile, however I don't see a reason for it, so I removed it.
/** | ||
* If true the component will have accessibility features enabled | ||
*/ | ||
accessible?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added accessible
prop to toggle accessibility
/** | ||
* If true the component will have accessibility features enabled | ||
*/ | ||
accessible?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added accessible
, containerStyle
, and disabled
prop definitions.
super(props); | ||
|
||
this.state = { | ||
prevColor: props.color, | ||
color: props.color ? Colors.getHSL(props.color) : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this.state.color
undefined causes this component crash. Added color in defaultProps
to prevent this.
/** | ||
* If true the component will have accessibility features enabled | ||
*/ | ||
accessible?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added accessible
prop type definition here
@@ -2,6 +2,16 @@ type Constructor<T, TA = any> = new(...args: TA[]) => T; | |||
type ExtendTypeWith<T extends Constructor<any>, OtherObject extends object> = Constructor<InstanceType<T> & OtherObject, ConstructorParameters<T>>; | |||
type Dictionary<TYPE> = {[key: string]: TYPE}; | |||
|
|||
declare module 'react-native-color' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where non-typed js dependencies are declared, so I've added these dependencies here. Is this the right place?
@mendyEdri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. I think just the docs need to point the .jsx
files
@mendyEdri good catch. I've changed the example to point to tsx files |
I think the CI here is stuck for some reason.. |
@ethanshar seems to be still stuck |
Yes, I wrote in mobile-oss-ci channel |
Description
This PR migrates the aforementioned components to TS with minor improvements.
Changelog
Migrated Slider context files
Deleted Slider.d.ts
Added default color prop for
GradientSlider
(thecolor
prop is optional, however when it's not provided the slider component crashes.)