• Stars
    star
    339
  • Rank 124,632 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🖼️React native auto height image

react-native-auto-height-image

Initialized by vivaxy/gt-npm-package

NPM Version NPM Downloads MIT License Conventional Commits Financial Contributors on Open Collective Maintainers Wanted DOI

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.

Installation

yarn add react-native-auto-height-image

npm install react-native-auto-height-image

Usage

Use local or remote files:

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 (
      <View>

        <AutoHeightImage
          width={100}
          source={image}
        />

        <AutoHeightImage
          width={100}
          source={{uri: 'http://placehold.it/350x150'}}
        />

      </View>
    );
  }
}

You can even specify fallback images for when the source fails to load:

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 (
      <AutoHeightImage
        width={100}
        source={{uri: 'https://vivaxy.github.io/404'}}
        fallbackSource={image}
      />
    );
  }
}

Props

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.

Change Log

Change log

Contributing

Contributing

Licence

MIT

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

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]

Related Projects

More Repositories

1

vscode-conventional-commits

💬Conventional Commits for VSCode.
TypeScript
319
star
2

gacp

💬Git add, commit, push with Conventional Commits and Gitmoji.
TypeScript
184
star
3

impression

👀Element view notifier
JavaScript
78
star
4

png

🖼A full-featured PNG decoder and encoder.
TypeScript
74
star
5

alfred-open-in-vscode

Alfred workflow to open in VSCode
JavaScript
36
star
6

here

📂Local static server
JavaScript
28
star
7

examples

📚Examples
JavaScript
27
star
8

node-reveal

🎁A reveal.js cli
JavaScript
26
star
9

granturismo

🎉Generator tool
JavaScript
19
star
10

react-text-more-less

📃React component to show more text or show less
JavaScript
17
star
11

gt-react-scaffold

🥚A boilerplate for client apps of webpack, react, redux, router...
JavaScript
15
star
12

WXML

See https://github.com/oft/wxml.
TypeScript
12
star
13

appear-event

👀Element appear event.
TypeScript
7
star
14

qrcode-chrome

🔗A chrome extension to make URLs as QR codes
JavaScript
7
star
15

use-appear

👀React useAppear hook.
TypeScript
6
star
16

JavaScript

🔬JavaScript parser, executor and serializer
JavaScript
6
star
17

design

🎨Web design
JavaScript
3
star
18

create-n

🥚Create Npm Package
JavaScript
3
star
19

gt-node-server

🥚Node server gt scaffold
JavaScript
3
star
20

react-pianist

🎹react-pianist provides react components to speed up web development
JavaScript
3
star
21

is-animated-image

🖼️Check if an image is animated.
JavaScript
3
star
22

vivaxy.github.io

📔My website
JavaScript
3
star
23

games

🎮 Games
JavaScript
2
star
24

git

💭Git operations.
TypeScript
2
star
25

babel-folder

📦Babel from source to build
JavaScript
2
star
26

alfred-open-in-webstorm

Alfred workflow to open in WebStorm
JavaScript
1
star
27

change-git-user

💭Change git user infomation
Shell
1
star
28

NiB

🔬Run commonjs modules in browser environment.
JavaScript
1
star
29

gcmt

💬Commit changes to git easier
Shell
1
star
30

browserify-cortex

📦Bundle cortex project by browserify
JavaScript
1
star
31

eslint-config-vivaxy

🚦My eslint config
JavaScript
1
star
32

hook-deploy

🖇️ Git hook to deploy
JavaScript
1
star
33

gt-npm-package

🥚Scaffold for npm packages
JavaScript
1
star
34

data-structure-visualization

🎬Data Structure Visualization with animation.
TypeScript
1
star
35

alfred-ticktick

Alfred workflow for TickTick or Dida365
JavaScript
1
star
36

log-util

📒Node log utility
TypeScript
1
star
37

npm-registry-proxy

📦Proxy npm registry, for enforcing cli as yarn or npm.
JavaScript
1
star
38

execa-process-log

📢Warp execa into promise and output logs in process. Use `stdio: 'inherit'` instead.
JavaScript
1
star
39

dotakey

⌨️ DotA hotkey on windows
AutoHotkey
1
star