components#Ripple TypeScript Examples

The following examples show how to use components#Ripple. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Item.tsx    From mobile with Apache License 2.0 6 votes vote down vote up
Item = ({title, subtitle, onPress, connectedRight}: ItemProps) => {
  const theme = useTheme<Theme>();
  const connectedRightElement =
    typeof connectedRight === 'string' ? (
      <Text color="overlayBodyText" {...theme.textVariants.menuItemTitle}>
        {connectedRight}
      </Text>
    ) : (
      connectedRight
    );

  const content = (
    <Box flexDirection="row" height={48} alignItems="center" paddingHorizontal="m">
      <Box flex={1}>
        <Text color="overlayBodyText" {...theme.textVariants.menuItemTitle}>
          {title}
        </Text>
        {subtitle && (
          <Text color="bodyTextSubdued" {...theme.textVariants.menuItemSubtitle}>
            {subtitle}
          </Text>
        )}
      </Box>
      {connectedRightElement}
    </Box>
  );

  if (!onPress) {
    return content;
  }

  return <Ripple onPress={onPress}>{content}</Ripple>;
}
Example #2
Source File: Item.tsx    From mobile with Apache License 2.0 6 votes vote down vote up
Item = ({title, subtitle, onPress, connectedRight}: ItemProps) => {
  const connectedRightElement =
    typeof connectedRight === 'string' ? (
      <Text color="darkText" variant="menuItemText">
        {connectedRight}
      </Text>
    ) : (
      connectedRight
    );

  const content = (
    <Box flexDirection="row" height={48} alignItems="center" paddingHorizontal="m">
      <Box flex={1}>
        <Text variant="menuItemText" color="darkText">
          {title}
        </Text>
        {subtitle && <Text color="bodyTextSubdued">{subtitle}</Text>}
      </Box>
      {connectedRightElement}
    </Box>
  );

  if (!onPress) {
    return content;
  }

  return <Ripple onPress={onPress}>{content}</Ripple>;
}