Default Image

Avatar

Avatars can be used to represent people or objects. It supports images, icons, or letters.

import { Avatar } from '@redshank/native';

Examples

Text Avatar

The basic using text prop

Color And Size

The custom color or size avatar

Avatar Type

Change type into circle or square

With Image

Avatar render image

With Icons

Show an icon instead of text or image

Count Text

Show quantity letter in Avatar

Pressable

Pressable avatar

Icon Props

Api props

AttributeTypeAccepted valuesDescriptionDefault
ComponentFunctionComponent ComponentClassReact ElementWrapper to avatar elementView or Ripple
ImageComponentFunctionComponent ComponentClassReact ElementWrapper to image elementImageRN
colorThemeColorThemeColorstring color format validgetRandomColor
iconIconObjectIconObjectSize icon-
imagePropsobjectImagePropsImage props when passing the src prop-
showCountTextnumber allNumber or allshow all text or number letter2
sizenumberNumberSize icon40
srcImageSrcTypeAbsolute path or urlRender image for avatar-
styleStyleProp<ViewStyle>ObjectStyle for wrapper element-
textstringStringText for show if your pass src prop, text will be placeholder-
textColorThemeColorThemeColorColor of textwhite or black
typeAvatarTypecircle squareAvatar type variantcircle
Other PropsanyOther propsInteractive props for element-

Base Properties

type BaseProperties = {
  onBlur?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onFocus?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
  onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
  onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
};

Community:

We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

DiscordGithub

Contributing:

PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.

Copyright © 2023 @redshank.