gluestack / gluestack-ui

React & React Native Components & Patterns (copy-paste components & patterns crafted with Tailwind CSS (NativeWind))
https://gluestack.io/
MIT License
2.33k stars 110 forks source link

When the slider thumb has a custom style, it no longer syncs with the SliderTrack #1944

Open Kreshnik opened 5 months ago

Kreshnik commented 5 months ago

Description

When the slider thumb has a custom style, it no longer syncs with the SliderTrack.

CodeSandbox/Snack link

No response

Steps to reproduce

I've encountered an issue where custom styling applied to the slider thumb results in a loss of synchronization with the SliderTrack component. This issue becomes evident when the slider thumb is moved along the track; the thumb does not align properly with the corresponding values or positions on the SliderTrack.

Screenshot 2024-03-14 at 23 42 41 Screenshot 2024-03-14 at 23 43 48
          <Slider
            defaultValue={props.value}
            maxValue={30}
            step={1}
            orientation="horizontal"
            isDisabled={false}
            isReversed={false}
            onChange={handleMinutesChange}
            onChangeEnd={handleMinutesChangeEnd}
            >
            <SliderTrack h={24} borderRadius={16} bg={'#1C283E12'}>
              <SliderFilledTrack bg={'#1C283E80'} borderRadius={16} />
            </SliderTrack>
            <SliderThumb
              bg="#333E51"
              borderColor="#BBBFC5"
              borderWidth={4}
              h={'auto'}
              w={'auto'}
              zIndex={1}
              px={16}
              py={4}
            >
              <Text
                  textAlign={'center'}
                  fontSize={'$sm'}
                  lineHeight={'$sm'}
                  color={'white'}
                  fontWeight={'$interRegular'}
                  >
                {minutes} min
              </Text>
            </SliderThumb>
          </Slider>

gluestack-ui Version

"@gluestack-style/react": "^1.0.51",     "@gluestack-ui/themed": "^1.1.11",

Platform

Other Platform

No response

Additional Information

No response

Viraj-10 commented 5 months ago

Hey @Kreshnik, Thanks for reporting this issue. We will have a look.

Viraj-10 commented 5 months ago

Hey @Kreshnik, Can you provide entire code? I tried to work with this. it seems like adding h={'auto'} w={'auto'} to thumb must be causing some issue. for better reproduction of the issue can you please provide github repo or snack link?

Kreshnik commented 5 months ago

@Viraj-10, unfortunately, I cannot share the repository; however, you can quickly reproduce the issue by creating a dynamic-sized thumbnail.