1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-10-31 21:18:54 +00:00
trezor-wallet/src/support/ImagesPreloader.js
2019-03-04 13:33:02 +01:00

28 lines
595 B
JavaScript

import React, { Component } from 'react';
import styled from 'styled-components';
const Wrapper = styled.div`
display: none;
`;
const Img = styled.img``;
class ImagesPreloader extends Component {
importAll(r) {
return r.keys().map(r);
}
render() {
const images = this.importAll(require.context('../images', false, /\.(png|jpe?g)$/));
return (
<Wrapper>
{images.map(image => (
<Img key={image} src={image} />
))}
</Wrapper>
);
}
}
export default ImagesPreloader;