Skip to content

Commit 3636b68

Browse files
authored
Prevent slider from overflowing out of the container in Web #176 (#177)
* Prevent slider from overflowing out of the container Signed-off-by: François BILLIOUD <[email protected]> * Fix component width Signed-off-by: François BILLIOUD <[email protected]> Co-authored-by: François BILLIOUD <[email protected]>
1 parent 19ea5f7 commit 3636b68

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/js/RNCSliderNativeComponent.web.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ const RCTSliderWebComponent = React.forwardRef(
175175

176176
const containerStyle = StyleSheet.compose(
177177
{
178-
width: '100%',
178+
flexGrow: 1,
179+
flexShrink: 1,
180+
flexBasis: 'auto',
179181
flexDirection: 'row',
180182
userSelect: 'none',
181183
alignItems: 'center',
@@ -188,19 +190,18 @@ const RCTSliderWebComponent = React.forwardRef(
188190
height: trackHeight,
189191
borderRadius: trackHeight / 2,
190192
userSelect: 'none',
191-
flexGrow: 1,
192193
};
193194

194195
const minimumTrackStyle = {
195196
...trackStyle,
196197
backgroundColor: minimumTrackTintColor,
197-
flexBasis: minPercent * 100 + '%',
198+
flexGrow: minPercent * 100,
198199
};
199200

200201
const maximumTrackStyle = {
201202
...trackStyle,
202203
backgroundColor: maximumTrackTintColor,
203-
flexBasis: maxPercent * 100 + '%',
204+
flexGrow: maxPercent * 100,
204205
};
205206

206207
// const width = (containerSize.current ? containerSize.current.width : 0)

0 commit comments

Comments
 (0)