react-native-jdenticon

0.0.3 • Public • Published

Jdenticon for React Native

react-native-jdenticon makes it possible to use Jdenticon (an open-source library for generating identity avatars) in React Native projects. It uses react-native-svg as a peer dependency.

Installation

  1. Install react-native-jdenticon with yarn or npm

yarn add react-native-jdenticon --save or npm install react-native-jdenticon --save

  1. Install the peer dependency react-native-svg

yarn add react-native-svg --save or npm install react-native-svg --save

  1. Install the RNSVG dependency for ios.

cd ios/ && pod install

Usage

import React from 'react';
import { View } from 'react-native'
import Jdenticon from 'react-native-jdenticon';

const SampleComponent = () => {

    return (
        <View>
            <Jdenticon
                value={'sample string'}
                size={60} />
        </View>
    )
}

export default SampleComponent;

Configuring and Stylign the icon

You can add a config prop with optionsprovided by Jdenticon's official docs to the <Jdenticon> component.

Sample

import React from 'react';
import { View } from 'react-native'
import Jdenticon from 'react-native-jdenticon';

const SampleComponent = () => {
    const config = {
        saturation: {
            color: 0.7
        }
    };

    const style = {
        padding: 20,
        borderRadius: 50,
        backgroundColor: '#ccc'
    }

    return (
        <View>
            <Jdenticon
                value={'sample string'}
                size={60}
                config={config}
                style={style}
            />
        </View>
    )
}

export default SampleComponent;

Package Sidebar

Install

npm i react-native-jdenticon

Weekly Downloads

14

Version

0.0.3

License

ISC

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • stelaplamenova