react-image-onload
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

react-image-onload

React Image onLoad event.
This is a workaround for onLoad event not being triggered in SSR case.

Travis Codecov Status npm package npm downloads

Dependency Status devDependency Status peerDependency Status

prettier license

Installation

$ yarn add react-image-onload

Demo

Usage

import ImageOnLoad from 'react-image-onload';
 
<ImageOnLoad
  onLoad={({ width, height }: HTMLImageElement) => {}}
  src="image"
  alt="background image"
/>;

API

type Props = {
  src: string,
  onLoad: (image: HTMLImageElement) => Promise<void> | void,
};

Development

Requirements

  • node >= 9.8.0
  • yarn >= 1.5.1
$ yarn install --pure-lockfile
$ yarn start

Test

$ yarn run format
$ yarn run eslint
$ yarn run flow
$ yarn run test:watch
$ yarn run build

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests.

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org

Readme

Keywords

Package Sidebar

Install

npm i react-image-onload

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

14.3 kB

Total Files

7

Last publish

Collaborators

  • evenchange4