segmented-control icon indicating copy to clipboard operation
segmented-control copied to clipboard

Press events doesn't work in android when using padding

Open elirangoshen opened this issue 5 years ago • 3 comments

I using this library and in ios it works great but in android it doesn't trigger any press events, only when i cancel the padding in styles its working..

React Native version: 0.63.2 Android os version: 28 Lib version: 2.2.1

that the part of code I use :

 <SegmentedControl
          values={[Time.MORNING, Time.AFTERNOON, Time.EVENING]}
          selectedIndex={timeIndex}
          style={styles.timeContainer}
          fontStyle={styles.labelTime}
          activeFontStyle={styles.labelTimeActive}
          onChange={(event) => {
            setTimeIndex(event.nativeEvent.selectedSegmentIndex);
          }}
        />

const styles = StyleSheet.create({
  timeContainer: {
    backgroundColor: Colors.tonedDark,
    borderRadius: 100,
    marginTop: 12,
    paddingHorizontal: 16, // if i remove this and the other padding its working
    paddingVertical: 21, // if i remove this and the other padding its working
  } as ViewStyle,
  labelTime: {
    color: 'white',
    fontSize: 16,
    fontFamily: 'Tablet Gothic W02 Regular',
  },
  labelTimeActive: {
    color: '#000000',
    fontSize: 16,
    fontFamily: 'Tablet Gothic W02 Regular',
  },
});

elirangoshen avatar Nov 17 '20 12:11 elirangoshen

Did you find solution for this? I have the same issue.

nikolal avatar Apr 15 '21 09:04 nikolal

Hi @nikolal and @elirangoshen,

Please try to increase the height by passing height: x to props.style. This issue occurs because parent has a fixed height and you are trying to add a padding bigger than the component itself.

I am not sure why paddingHorizontal would not work but I assume it is the same problem.

In any case please add a repro case so it is more clear for others to take a look and contribute

Mehmet

mmehmetAliIzci avatar Jun 09 '21 12:06 mmehmetAliIzci

i have same problem, can not touch to change segment index with Android

fukemy avatar Aug 24 '22 15:08 fukemy