-
Notifications
You must be signed in to change notification settings - Fork 734
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
Conversation
this[layoutName] = size; | ||
|
||
if (this.containerSize && this.thumbSize && this.trackSize) { | ||
// console.warn('post return'); |
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.
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} |
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.
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.
const range = this.getRange(); | ||
const relativeValue = maximumValue > 0 ? minimumValue - v : maximumValue - v; // for negatives in min value | ||
const relativeValue = minimumValue - v; |
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.
Is there a way to test this part. In unit tests or e2e?
@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... |
Description
Supporting Slider react and recalculate when orientation is changed
Changelog
Add support to Slider component to react to orientation changes