Socket
Book a DemoInstallSign in
Socket

react-native-element-image

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-element-image

Automatically calculate width or height based on input Image component for React Native.

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
7
-63.16%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-element-image

Automatically calculate width or height based on input Image component for React Native.

Source code demo

  • react-native-template-components A beautiful template for React Native.

Getting started

    npm install react-native-element-image --save

or

    yarn add npm install react-native-element-image

Demo

Image Props

PropsParamsisRequireDescription
sourceImageSourcePropTypeYes
widthNumberFixed width, automatic height
heightNumberFixed height, automatic width
backgroundBooleanNoif true is Image Background
onSize(size) => voidNoget Image size

Avatar Props

PropsParamsisRequireDescription
containerStyleViewStyleNo
sizeNumberNoDefault is 100px
sourceImageSourcePropTypeYes
borderColorStringNoDefault is white
nameStringNo
nameStyleTextStyleNo
iconEnableBooleanNoDefault is true
renderIconElementNoCustomize icon camera
onPressIcon()=> voidNoEvent click icon camera

Usage

import React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { Image, Avatar } from 'react-native-element-image';
const img = require('./assets/default.png');

const ImageScreen = (_props) => {
  return (
    <View style={styles.container}>
      <Avatar
        size={80}
        containerStyle={styles.avatar}
        source={img}
        iconEnable={false}
        onPressIcon={() => alert('Click')}
        nameStyle={{ fontSize: 20 }}
      />
      <Avatar
        size={80}
        containerStyle={styles.avatar}
        source={img}
        iconEnable
        onPressIcon={() => alert('Click')}
        nameStyle={{ fontSize: 20 }}
      />

      <Avatar
        size={100}
        containerStyle={styles.avatar}
        source={img}
        iconEnable
        onPressIcon={() => alert('Click')}
        name="User name"
        nameStyle={{ fontSize: 20, marginBottom: 20 }}
      />
      <Text>Width: 200, Height: Automatic</Text>
      <Image style={styles.image} source={img} width={200} />
      <Text style={styles.text}>Width: Automatic, Height: 200</Text>
      <Image style={styles.image} source={img} height={200} />
    </View>
  );
};

export default ImageScreen;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  image: {
    margin: 20,
  },
  text: { marginTop: 50 },
  avatar: { marginTop: 10 },
});

Keywords

react-native

FAQs

Package last updated on 08 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.