
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
react-loading-image
Advanced tools
A react image loader component
$ npm install --save react-loading-image
class Demo extends React.Component {
constructor(props) {
super(props);
this.state = {
value: null
};
}
onChange = (e) => {
this.setState({
value: e.target.value
});
}
render() {
const {value} = this.state;
return (
<div>
<h1>Copy a image URL here</h1>
<input onChange={this.onChange}/>
<p>
value: {value}
</p>
<div>
{value && (
<ImageLoader
src={value}
loading={() => <div>Loading...</div>}
error={() => <div>Error</div>}
/>
)}
</div>
</div>
);
}
}
You might want to customized such as <div/>
as your final view, instead of <img/>
tags, you can use image
prop to replace any React element as you wish!
For example, using styled-components
:
import styled from 'styled-components';
const PreviewImg = styled.div`
background-image: url(${props => props.src});
width: 100%;
height: 300px;
background-size: contain;
background-repeat: no-repeat;
`;
class Demo extends React.Component {
...
render() {
const {value} = this.props;
return (
<div>
<ImageLoader
src={value}
image={props => <PreviewImg {...props}/>} // change to your customized component
loading={() => <div>Loading...</div>}
error={() => <div>Error</div>}
/>
</div>
);
}
}
Name | Type | Default | Description |
---|---|---|---|
src | string | null | Image URL |
style | style Object | null | Pass style object to set image's style |
className | string | null | Set image's className |
onLoad | (img: Image) => void | null | This function will be called when image is loaded |
onError | (err: Event) => void | null | This function will be called when image is failed |
loading | () => React.Element<*> | null | Return a React element that will show when image is loading |
error | () => React.Element<*> | null | Return a React element that will show when image is crashed |
image | ({src: string, width: number, height: number}) => React.Element<*> | null | Final result will render to this customized React element, if you don't assign this props default image will render into <img src={src} width={width} height={height}/> |
npm start
npm run gh-pages
MIT © chilijung
FAQs
A react image loader component
The npm package react-loading-image receives a total of 297 weekly downloads. As such, react-loading-image popularity was classified as not popular.
We found that react-loading-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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.