chudnyi / react-native-user-avatar

Avatar Component For React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native User Avatar

npm version npm downloads

A bare-bones user avatar display with support for falling back to using the user's initials on a colored background as the avatar. Based on the great library for React: https://github.com/wbinnssmith/react-user-avatar, and ported to React Native.

Installation

npm install --save react-native-user-avatar or yarn add react-native-user-avatar

Usage

  <UserAvatar size="100" name="Avishay Bar" />
  <UserAvatar size="100" name="Avishay Bar" src="https://dummyimage.com/100x100/000/fff" />
  <UserAvatar size="50" name="John Doe" colors={['#ccc', '#fafafa', '#ccaabb']}/>
  <UserAvatar size="50" name="John Doe" />
  <UserAvatar size="50" name="Jane Doe" color="#000" />

The fallback avatar's color may be set by passing in the color prop, or you can customize the range of colors used by passing in an array of colors. The component uses a simple calculation to consistently use the same color for the same user's name every time.

Credits

@wbinnssmith

##License

MIT

About

Avatar Component For React Native

License:MIT License


Languages

Language:Objective-C 38.4%Language:JavaScript 35.4%Language:Python 14.2%Language:Java 12.1%