All Projects → ihor → React Native Scalable Image

ihor / React Native Scalable Image

Licence: mit
React Native Image component which scales width or height automatically to keep the original aspect ratio

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Scalable Image

React Native Fit Image
Responsive image component to fit perfectly itself.
Stars: ✭ 539 (+123.65%)
Mutual labels:  image, component, responsive
Responsivedevices.css
Responsive CSS Device frames for your landing pages
Stars: ✭ 59 (-75.52%)
Mutual labels:  scalable, responsive
Imgviewer
jQuery plugin to zoom and pan images, even those with a size that is a percentage of their container
Stars: ✭ 50 (-79.25%)
Mutual labels:  image, responsive
React Background Slideshow
Sexy tiled background slideshow for React 🔥
Stars: ✭ 98 (-59.34%)
Mutual labels:  image, component
Vue Picture Input
Mobile-friendly picture file input Vue.js component with image preview, drag and drop, EXIF orientation, and more
Stars: ✭ 862 (+257.68%)
Mutual labels:  image, component
React Image Lightbox
React lightbox component
Stars: ✭ 956 (+296.68%)
Mutual labels:  image, component
React Responsive Picture
A future-proof responsive image component that supports latest Picture specification
Stars: ✭ 91 (-62.24%)
Mutual labels:  image, responsive
React Native Blurhash
🖼️ A library to show colorful blurry placeholders while your content loads.
Stars: ✭ 430 (+78.42%)
Mutual labels:  image, component
React Magnifier
🔍 React image zoom component
Stars: ✭ 116 (-51.87%)
Mutual labels:  image, component
Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (-50.62%)
Mutual labels:  component, responsive
Image Focus
A dependency free utility for cropping images based on a focus point ~2.13kB gzipped
Stars: ✭ 134 (-44.4%)
Mutual labels:  image, responsive
Repng
React component to PNG converter
Stars: ✭ 856 (+255.19%)
Mutual labels:  image, component
Glightbox
Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
Stars: ✭ 702 (+191.29%)
Mutual labels:  image, responsive
React Responsive Image
🖼️ A React responsive image component.
Stars: ✭ 36 (-85.06%)
Mutual labels:  image, responsive
Vue Breakpoints
🍬 🙈 Vue.js utility component to show and hide components based on breakpoints
Stars: ✭ 179 (-25.73%)
Mutual labels:  component, responsive
Jekyll Cloudinary
Jekyll plugin adding a Liquid tag for Cloudinary, for better responsive images
Stars: ✭ 79 (-67.22%)
Mutual labels:  image, responsive
Guillotine
jQuery plugin to crop images within an area (fully responsive), allowing to drag (touch support), zoom and rotate.
Stars: ✭ 318 (+31.95%)
Mutual labels:  image, responsive
Element Queries Spec
A spec for a Container-Style Element Query Syntax
Stars: ✭ 375 (+55.6%)
Mutual labels:  component, responsive
Imgnotes
Extension of the jQuery imgViewer plugin to add markers and notes to the image
Stars: ✭ 98 (-59.34%)
Mutual labels:  image, responsive
Flex Block
一个基于Hexo的主题
Stars: ✭ 133 (-44.81%)
Mutual labels:  image, responsive

React Native Scalable Image

React Native <Image/> component does not keep the image aspect ratio, which results in the image being stretched or cropped. react-native-scalable-image solves this problem by calculating the image size and resizing the image when rendering.

This library provides an <Image/> component which scales width or height automatically to keep the aspect ratio. It is useful when you don't know the aspect ratio in advance (e.g. user-uploaded content) but want to display the entire image and limit it only by width or height to fit the container component.

The following example creates an image which fits the full screen width and keeps the aspect ratio:

import React from 'react';
import { Dimensions } from 'react-native';
import Image from 'react-native-scalable-image';

const image = (
   <Image
       width={Dimensions.get('window').width} // height will be calculated automatically
       source={{uri: '<image uri>'}}
   />
);

Install

npm install react-native-scalable-image --save

Usage

Specify width or height which may be calculated dynamically like in the example above. All other props are the same as in regular React Native <Image/> component.

props

name type default description
height number none Maximum image height
width number none Maximum image width
background boolean false Set to true when used as a background
component React.ReactNode none Custom image component
onPress function none onPress callback
onSize function none Is called with { width, height } as the first arg once image size is calculated

Versions

The latest major version of react-native-scalable-image is implemented with hooks. If you are using a pre-hooks React version please use react-native-scalable-image version 0.5.1

React Version Scalable Image Version
< 16.8 0.5.1
>= 16.8 > 1.0.0
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].