npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-interactive-avatar

v2.0.0

Published

An avatar allowing you to click on it to change the image

Downloads

17

Readme

react-native-interactive-avatar

An avatar allowing you to click on it to change the image

Documentation For React-native 0.26.2+ to 0.40

For React-native 0.40 to 0.47, use ^1.0.0

For React-native 0.48+, use ^2.0.0

For React-native 0.40+

The component might work on older versions

Example

import Avatar from 'react-native-interactive-avatar';

export default class Example extends Component {
    handleImageChange = (response) => {
        // Do something

        // response looks like : {
        //      data: "data:image/jpeg;base64,/9j/4AAQSkZJRg...", // Base64
        //      fileSize: 474486,
        //      height: 531,
        //      isVertical: false,
        //      origURL: "assets-library://asset/asset.JPG?id=106E99A1-4F6A-45A2-B320-B0AD4A8E8473&ext=JPG",
        //      uri: "file:///...",
        //      width: 800,
        // }
    };

    render() {
        <View>
            <Avatar
                uri={'https://media2.giphy.com/media/sbLpwwHlgls8E/giphy.gif'}
                size={'default'}
                placeholderSource={require('example/images/placeholder.png')}
                interactive
                onChange={this.handleImageChange}
            />
            <Avatar
                source={require('example/images/logo.png')}
                size={'medium'}
            />
            <Avatar
                source={require('example/images/logo.png')}
                size={'small'}
            />
            <Avatar
                withBorder
                placeholderSource={require('example/images/placeholder.png')}
                interactive
                style={{
                    borderColor: '#000000',
                    borderWidth: 1,
                    marginLeft: 5,
                }}
                size={'verySmall'}
            />
        </View>
    }
}

Example

See more in the Example Project

:warning: Use npm to install the dependencies of the example project. Yarn is ignoring the .npmignore and therefore installing example/ in the node_modules/react-native-interactive-avatar relative dependency.

Properties

Property name | Type | Remark --- | --- | ---- interactive| React.PropTypes.bool | if true, allows to select a new image on Press (if no onPress function is defined) onChange| React.PropTypes.func | called on change when interactive is true onChangeFailed| React.PropTypes.func | called on change failure when interactive is true onPress| React.PropTypes.func | overlayColor| React.PropTypes.string | On android only, should be the same than the backgroundColor of the surrounding View pickerOptions | ImagePicker.options | See react-native-image-picker placeholderSource | Image.propTypes.source | A source for the Image that is displayed when source and uri are empty placeholderURI | React.PropTypes.string | A distant source for the Image that is displayed when source and uri are empty size| React.PropTypes.oneOf([ 'default', 'mini', 'verySmall', 'small', 'medium' ]) | A set of sizes that you can set for the Avatar source| Image.propTypes.source | The source Image to display style| Image.propTypes.style | The style of the Image uri | React.PropTypes.string | A distant source to display withBorder| React.PropTypes.bool | Should it have a border?

This component uses the awesome react-native-image-picker

Installation

    npm i --save react-native-interactive-avatar
    react-native link react-native-image-picker