Skip to content

Fix/ migrate callback refs to object #1912

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

Merged
merged 2 commits into from
Mar 21, 2022
Merged

Conversation

lidord-wix
Copy link
Contributor

Description

Migrate callback refs to object, to resolve TS errors

Changelog

Migrate callback refs to object, to resolve TS errors

@@ -305,12 +305,12 @@ export default class Slider extends PureComponent<SliderProps, State> {
const nonOverlappingTrackWidth = trackSize.width - this.initialThumbSize.width;
const _x = Constants.isRTL && disableRTL ? nonOverlappingTrackWidth - x : x; // adjust for RTL
this._thumbStyles.left = trackSize.width === 0 ? _x : (_x * nonOverlappingTrackWidth) / trackSize.width; // do not render above prefix\suffix icon\text
this.thumb.setNativeProps(this._thumbStyles);
this.thumb.current?.setNativeProps(this._thumbStyles);
}

if (this.minTrack) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to check that this.minTrack.current is not undefined and not just this.minTrack

@@ -327,7 +327,7 @@ export default class Slider extends PureComponent<SliderProps, State> {

const activeOrInactiveStyle = !this.props.disabled ? (start ? activeStyle : style) : {};
this._thumbStyles.style = _.omit(activeOrInactiveStyle, 'height', 'width');
this.thumb.setNativeProps(this._thumbStyles);
this.thumb.current?.setNativeProps(this._thumbStyles);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, in the check above you probably need to check this.thumb.current
Technically this.thumb is never undefined cause it is {current: undefined} when initialized

@lidord-wix lidord-wix requested a review from ethanshar March 20, 2022 15:00
@ethanshar ethanshar merged commit 7c11144 into master Mar 21, 2022
lidord-wix added a commit that referenced this pull request Mar 21, 2022
* migrate callback refs to object

* fix ref checks
@lidord-wix lidord-wix deleted the fix/callback_ref_ts_error branch April 18, 2022 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants