New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-fullwidth-image

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-fullwidth-image

A responsive Image element that takes the full width of its parent element while maintaining aspect ratio.

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
319
1.92%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-fullwidth-image

A responsive Image element that takes the full width of its parent element while maintaining aspect ratio

The original idea comes from here.

Installation

npm install --save react-native-fullwidth-image

Usage

Start by importing the module

import FullWidthImage from 'react-native-fullwidth-image'

Now, you can use the FullWidthImage element in multiple ways as follows:

Initial Dimensions

You can provide an initial width and height, react-native-fullwidth-image will infer the aspect ratio from the provided dimensions and keep it as the image is scaled up to 100% of its parent's width

  <FullWidthImage style={{ ... }} source={require(...)} width={480} height={272} />

An aspect ratio of 1 will give you square images

Aspect Ratio

You can also provide a predefined aspect ratio (a value between 0 and 1) as follows

  <FullWidthImage style={{ ... }} source={{uri: ..}} ratio={3/4} />

An aspect ratio of 1 will give you square images

Automatic detection

react-native-fullwidth-image can automatically detect the aspect ratio of remote images, all you need to provide is the uri as you would do with the regular Image component.

  <FullWidthImage style={{ ... }} source={{uri: ..}} />

Demo

We use react-native-fullwidth-image in Apperture iOS / Android

License

MIT License. © Wassim Gharbi

Keywords

react-native

FAQs

Package last updated on 19 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts