callstack / react-native-paper

Material Design for React Native (Android & iOS)
https://reactnativepaper.com
MIT License
12.37k stars 2.04k forks source link

List.Accordion border radius #4365

Open ardaOnal opened 1 month ago

ardaOnal commented 1 month ago

Ask your Question

Is it possible to have borderRadius on List.Accordion? Currently it has rigid corners and I want them to be rounded.

Screenshot 2024-04-06 at 16 21 20

<View
  style={{
    position: "relative",
    zIndex: 100,
    borderRadius: 100,
    backgroundColor: "red",
  }}
>
  <List.Section style={{ borderRadius: 200 }}>
    <List.Accordion
      title={selectedPostCategory}
      left={(props) =>
        selectPostCategoryIcon(props, selectedPostCategory)
      }
      onPress={(e: GestureResponderEvent) =>
        handlePostDropdownPress(selectedPostCategory)
      }
      expanded={postDropdownExpanded}
      titleStyle={{ fontSize: 22 }}
      style={{ borderRadius: 100 }}
    >
      <View style={dashboardStyles.postCategoryDropdown}>
        {postCategories.map((item, index) =>
          item !== selectedPostCategory ? (
            <List.Item
              key={index}
              title={item}
              onPress={(e: GestureResponderEvent) =>
                handlePostDropdownPress(item)
              }
              titleStyle={{ fontSize: 16 }}
              left={(props) => selectPostCategoryIcon(props, item)}
              style={{ backgroundColor: "white" }}
            />
          ) : undefined
        )}
      </View>
    </List.Accordion>
  </List.Section>
</View>
gedu commented 1 month ago

Hey, at least for now I think you can't change it, because the View holding the content doesn't use any other style

ListAccordion.tsx

<View style={{ backgroundColor: theme?.colors?.background }}>

But what you can do is remove the white background color from it, doing:

<List.Accordion
              title={"woohoo"}
              theme={{colors: {background: 'transparent'}}}>