Skip to content

DD4You/rn-auto-image-height

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

react-native auto image height

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published