react-native auto height image
npm install @koffeekat/react-native-auto-height-imageThis is a fork of vivaxy/gt-npm-package used for personal purposes as the original package has not been updated for a long time.
Initialized by vivaxy/gt-npm-package







This component provides you a simple way to load a remote image and automatically set Image height to the image dimension which fits the provided width.
React Native Image component needs users to set both width and height props.
React Native version requirements: >=0.46.
yarn add react-native-auto-height-image
npm install react-native-auto-height-image
Use local or remote files:
``js
import React, { Component } from 'react';
import AutoHeightImage from 'react-native-auto-height-image';
import image from 'gallifrey-falls.png';
export default class Demo extends Component {
render() {
return (
source={image}
/>
source={{uri: 'http://placehold.it/350x150'}}
/>
);
}
}
`
You can even specify fallback images for when the source fails to load:
`js
import React, { Component } from 'react';
import AutoHeightImage from 'react-native-auto-height-image';
import image from 'gallifrey-falls.png';
export default class Demo extends Component {
render() {
return (
source={{uri: 'https://vivaxy.github.io/404'}}
fallbackSource={image}
/>
);
}
}
`
| name | type | isRequired | default | description |
| --- | --- | --- | --- | --- |
| width | number | ✔ | N/A | image width to fit |maxHeight
| | number | ✖ | Infinity | image max height |source
| | number or object | ✔ | N/A | local (i.e. require/import) or remote image ({uri: '...'}) |fallbackSource
| | number or object | ✖ | N/A | local (i.e. require/import) or remote image ({uri: '...'}) |onHeightChange
| | func | ✖ | (height) => {} | called when updating image height, the argument height might be 0 |animated
| | bool | ✖ | false | Use Animated.Image instead of Image |
Other image props except resizeMode` are accepted.
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
#### Individuals
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
- react-native-scalable-image
- react-native-fit-image
- react-native-responsive-image-view
- react-native-auto-image