ThakurBallary / react-native-btr

React Native UI Components :fire: :rocket: :star2:
MIT License
105 stars 19 forks source link

Screen is flashing when user close the bottomsheet #25

Open drokbers opened 6 months ago

drokbers commented 6 months ago

When closing the BottomSheet component, the screen exhibits an unexpected flashing behavior. Specifically, the issue manifests as a sequence of color changes on the screen when the BottomSheet is toggled. The sequence is as follows:

  1. Upon initiation of the BottomSheet's closing action, the screen momentarily darkens.
  2. Subsequently, as the BottomSheet continues its closing animation, the screen briefly brightens.
  3. Following this, there is an additional, unexpected darkening of the screen.
  4. Finally, the screen brightens once again, returning to its original state.
const FilterButtomSheet = ({ isVisible, onClose }) => {
  const [isFilterVisible, setIsFilterVisible] = useState(false);
  const [selectedFilter, setSelectedFilter] = useState(filterOptions[0]);

  return (
    <BottomSheet
      visible={isVisible}
      onBackButtonPress={onClose}
      onBackdropPress={onClose}
    >
      <View style={styles.bottomNavigationView}>
        {filterOptions.map((option, index) => (
          <TouchableOpacity
            key={index}
            onPress={() => {
              setIsFilterVisible(true);
              onClose();
            }}
            style={styles.item}
          >
            <Text style={textStyles.LabelSemiboldMedium}>{option}</Text>
            <RadioButton
              isSelected={selectedFilter === option}
              onPress={() => {
                setSelectedFilter(option);
              }}
            />
          </TouchableOpacity>
        ))}
      </View>
    </BottomSheet>
  );
};
export default FilterButtomSheet;

const styles = StyleSheet.create({
  bottomNavigationView: {
    backgroundColor: 'white',
    width: '100%',
    borderRadius: 24,
    padding: 12,
    paddingBottom: 20,
    justifyContent: 'center',
    alignItems: 'center',
  },
  item: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    padding: 12,
    width: '100%',
  },
});
drokbers commented 6 months ago

@ThakurBallary

ThakurBallary commented 6 months ago

@drokbers based on the above provided code snippet I have created an Expo Snack Example and it worked perfectly fine. Can you please update the snack to reproduce the issue you're facing, so we can try to fix it.

drokbers commented 6 months ago

@ThakurBallary hey man, thanks for quick response. I recorded a video with your demo you shared.

You can check it out: https://youtube.com/shorts/TZZ5IdsTa7Y?si=DFOe0AFnzVACcUS0 , the

Also added my all dependencies to snack after video.

drokbers commented 5 months ago

any news ? @ThakurBallary

ThakurBallary commented 5 months ago

As of now no luck. I could see it in happening on real device.