1.0.2 • Published 2 years ago
rn-auto-image-height v1.0.2
rn-auto-image-height
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 |