Skip to content

Commit d92b408

Browse files
authored
Fix flicker issue in web implementation of Slider component
- Updated `sliderStyle` to conditionally set width only when it's not zero to prevent initial flicker during re-renders. - This change ensures a smoother user experience by eliminating flicker effects when the component re-renders.
1 parent 703f79a commit d92b408

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

package/src/Slider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ const SliderComponent = (
230230

231231
const defaultStyle =
232232
Platform.OS === 'ios' ? styles.defaultSlideriOS : styles.defaultSlider;
233-
const sliderStyle = {zIndex: 1, width: width};
233+
const sliderStyle = {zIndex: 1, ...(width !== 0 && {width})};
234234
const style = StyleSheet.compose(props.style, defaultStyle);
235235

236236
const onValueChangeEvent = (event: Event) => {

0 commit comments

Comments
 (0)