1.0.2 • Published 3 months ago

rn-auto-image-height v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

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

nametypeisRequireddefaultdescription
widthnumberN/Aimage width to fit
sourcenumber or objectN/Alocal (i.e. require/import) or remote image ({uri: '...'})
styleobjectxN/A

Change Log

Change log

Licence

MIT

1.0.2

3 months ago

1.0.1

5 months ago

1.0.0

6 months ago