
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
react-native-autosize-image
Advanced tools
react-native image width auto width or height computation
Inspired by vivaxy/react-native-auto-height-image
This component provides you a simple way to load a remote image and automatically set Image
crossAxisSize to the image dimension which fits the provided mainAxisSize.
ReactNative Image
component needs users to set both mainAxisSize
and crossAxisSize
props.
yarn add react-native-autosize-image
npm install react-native-autosize-image
Use local or remote files:
import React, { Component } from 'react';
import AutoImage from 'react-native-autosize-image';
import image from 'gallifrey-falls.png';
export default class Demo extends Component {
render() {
return (
<View>
<AutoImage
mainAxisSize={100}
mainAxis='horizontal'
source={image}
/>
<AutoImage
mainAxisSize={100}
mainAxis='vertical'
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 AutoImage from 'react-native-autosize-image';
import image from 'gallifrey-falls.png';
export default class Demo extends Component {
render() {
return (
<AutoImage
mainAxisSize={100}
source={{uri: 'https://vivaxy.github.io/404'}}
fallbackSource={image}
/>
);
}
}
name | type | isRequired | default | description |
---|---|---|---|---|
mainAxisSize | number | ✔ | N/A | image mainAxisSize to fit |
mainAxis | 'horizontal' | 'vertical' | ✔ | N/A |
maxCrossAxisSize | number | ✖ | Infinity | image max crossAxisSize |
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: '...'}) |
onCrossAxisSizeChange | func | ✖ | (crossAxisSize) => {} | called when updating image crossAxisSize, the argument crossAxisSize might be 0 |
animated | bool | ✖ | false | Use Animated.Image instead of Image |
Other image props except resizeMode
are accepted.
FAQs
react-native image width auto width or height computation
We found that react-native-autosize-image demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.