MCPcopy Create free account
hub / github.com/chart-kit/react-native-chart-kit-example / DrawerRow

Function DrawerRow

src/showcase/ShowcaseMenu.tsx:522–588  ·  view source on GitHub ↗
({
  appTheme,
  description,
  iconName,
  isSelected = false,
  label,
  onPress,
}: {
  appTheme: ShowcaseMenuTheme;
  description?: string;
  iconName: IoniconName;
  isSelected?: boolean;
  label: string;
  onPress: () => void;
})

Source from the content-addressed store, hash-verified

520);
521
522const DrawerRow = ({
523 appTheme,
524 description,
525 iconName,
526 isSelected = false,
527 label,
528 onPress,
529}: {
530 appTheme: ShowcaseMenuTheme;
531 description?: string;
532 iconName: IoniconName;
533 isSelected?: boolean;
534 label: string;
535 onPress: () => void;
536}) => {
537 const accentColor = appTheme.series[0] ?? appTheme.text;
538
539 return (
540 <Pressable
541 accessibilityRole="button"
542 accessibilityState={{ selected: isSelected }}
543 onPress={onPress}
544 style={({ pressed }) => [
545 styles.row,
546 {
547 backgroundColor: isSelected ? appTheme.background : "transparent",
548 },
549 pressed && styles.pressed,
550 ]}
551 >
552 <View
553 style={[
554 styles.rowIcon,
555 {
556 backgroundColor: isSelected ? accentColor : appTheme.background,
557 borderColor: appTheme.axis,
558 },
559 ]}
560 >
561 <Ionicons
562 name={iconName}
563 size={15}
564 color={isSelected ? appTheme.background : appTheme.text}
565 />
566 </View>
567 <View style={styles.rowTextBlock}>
568 <Text
569 numberOfLines={1}
570 style={[styles.rowLabel, { color: appTheme.text }]}
571 >
572 {label}
573 </Text>
574 {description ? (
575 <Text
576 numberOfLines={1}
577 style={[styles.rowDescription, { color: appTheme.mutedText }]}
578 >
579 {description}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected