Spaces:
Runtime error
Runtime error
File size: 663 Bytes
8fd7a1d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
// This is a wrapper around <img> that forces re-render when theme state updates.
const TWRenderRecoloredImage = ({
src,
...props
}) => (
<img
src={typeof src === 'function' ? src() : src}
{...props}
/>
);
TWRenderRecoloredImage.propTypes = {
src: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
};
const mapStateToProps = state => ({
theme: state.scratchGui.theme.theme
});
const mapDispatchToProps = () => ({});
export default connect(
mapStateToProps,
mapDispatchToProps
)(TWRenderRecoloredImage);
|