rn-auto-image-height
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

rn-auto-image-height

NPM Version NPM Downloads MIT License Conventional Commits

This component provides you a simple way to load a remote and local image and automatically set Image height to the image dimension which fits the provided width.

ReactNative Image component needs users to set both width and height props.

Installation

yarn add rn-auto-image-height

npm install rn-auto-image-height

Usage

Use local or remote files:

import React, { Component } from "react";
import AutoHeightImage from "rn-auto-image-height";

export default class Demo extends Component {
  render() {
    return (
      <View>
        <AutoHeightImage width={100} source={require("/path-of-image-file")} />

        <AutoHeightImage
          width={100}
          source={{ uri: "http://placehold.it/350x150" }}
        />
      </View>
    );
  }
}

Props

name type isRequired default description
width number N/A image width to fit
source number or object N/A local (i.e. require/import) or remote image ({uri: '...'})
style object x N/A

Change Log

Change log

Licence

MIT

Package Sidebar

Install

npm i rn-auto-image-height

Weekly Downloads

8

Version

1.0.2

License

MIT

Unpacked Size

5.33 kB

Total Files

6

Last publish

Collaborators

  • dd4you