Skip to content

Feat/slider orientation support #1273

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 6 commits into from
May 20, 2021
Merged

Conversation

mendyEdri
Copy link
Contributor

Description

Supporting Slider react and recalculate when orientation is changed

Changelog

Add support to Slider component to react to orientation changes

this[layoutName] = size;

if (this.containerSize && this.thumbSize && this.trackSize) {
// console.warn('post return');
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can delete this console

@@ -41,7 +41,7 @@ export default class SliderScreen extends Component {
<Image assetName={'megaphone'} style={styles.image}/>
<Slider
onValueChange={this.onSliderValueChange}
value={INITIAL_VALUE}
value={this.state.sliderValue}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to keep updating the value by state here? The 'value' prop is for the initial value, once you update it the Slider takes care of the value and uses 'onValueChange' to update the user with the new value. When we update it back to the Slider we'll have an extra render on any value change which can affect performance.

@ethanshar ethanshar added the Important for Next Release PR that must be included in the release version label Apr 27, 2021
@mendyEdri mendyEdri requested a review from Inbal-Tish May 3, 2021 07:54
const range = this.getRange();
const relativeValue = maximumValue > 0 ? minimumValue - v : maximumValue - v; // for negatives in min value
const relativeValue = minimumValue - v;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to test this part. In unit tests or e2e?

@Inbal-Tish
Copy link
Collaborator

@mendyEdri I approved the PR. Merge when you want. I just wondering if it's not better to add tests first to make sure we didn't break any one...

@mendyEdri mendyEdri merged commit fd6a062 into master May 20, 2021
@mendyEdri mendyEdri deleted the feat/slider-orientation-support branch June 10, 2021 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants