datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

Using "compact" Picker on iOS in headerTitle component of Stack.Screen pushes it to the left rather than centre

Open andokai opened this issue 2 years ago • 0 comments

Question

Hi, I'm using the latest Expo supported version 6.7.3 so hopefully this is fixed in a later version but currently when I attempt to use the picker as the header component of Screen the header get's pushed to the left. With any other combination of controls this isn't the case. Is there a workaround for this or some other approach I can use?

Thanks!

<Stack.Screen
  options={{
    title: 'Logbook',
    headerTitle: () =>
      Platform.OS === 'android' ? (
        <Button
          title={format(date, 'dd/MM/yyyy')}
          type="clear"
          onPress={handlePress}
          buttonStyle={{
            backgroundColor: Color(theme.colors.primary)
              .alpha(0.2)
              .string(),
          }}
          size="sm"
        />
      ) : (
        <DateTimePicker
          value={date}
          is24Hour
          onChange={handleDateChange}
          display="compact"
        />
      ),
    headerRight: () =>
      selectedIds.length > 0 && (
        <Icon
          name="label"
          type="material-icons"
          color={theme.colors.primary}
          onPress={handleClassificationPress}
        />
      ),
  }}
/>

andokai avatar Jun 27 '23 20:06 andokai