ptomasroos / react-native-multi-slider

Android and iOS Pure JS react native multi slider
MIT License
775 stars 401 forks source link

Image disappears when the value changes #259

Closed LauraSaraiva10 closed 2 years ago

LauraSaraiva10 commented 2 years ago

Hi. In the slider I have an image and whenever the values are updated, the image disappears when the number changes. I think the problem is in onValuesChange, but I don't know how to resolve it. Someone with the same problem?

My code:

<MultiSlider
            min={1}
            max={10}
            selectedStyle={{
              backgroundColor: 'blue',
              height: 8,
              borderRadius: 10,
            }}
            unselectedStyle={{
              backgroundColor: '#c4c4c4',
              height: 8,
              borderRadius: 10,
            }}
            onValuesChange={number => setItemQuantity(number)}
            isMarkersSeparated={true}
            customMarkerLeft={e => {
              return (
                <View style={{alignItems: 'center', justifyContent: 'center'}}>
                  <Text
                    style={{
                      position: 'absolute',
                      color: '#000000',
                      zIndex: 5,
                      fontWeight: 'bold',
                      fontSize: 26,
                    }}>
                    {ItemQuantity}
                  </Text>
                  <Image
                    style={{width: 40, height: 40, resizeMode: 'contain'}}
                    source={route?.params.item.image}
                  />
                </View>
              );
            }}
          />

https://user-images.githubusercontent.com/63668973/159134808-eafd643a-9e65-432f-abea-ae271dc4619a.mp4