Handle refs properly for token and map images
This commit is contained in:
parent
d55514ef7c
commit
cd498167aa
@ -4,7 +4,7 @@ import { Image } from "theme-ui";
|
||||
import { useDataURL } from "../../contexts/AssetsContext";
|
||||
import { mapSources as defaultMapSources } from "../../maps";
|
||||
|
||||
const MapTileImage = React.forwardRef(({ map, ...props }) => {
|
||||
const MapTileImage = React.forwardRef(({ map, ...props }, ref) => {
|
||||
const mapURL = useDataURL(
|
||||
map,
|
||||
defaultMapSources,
|
||||
@ -12,7 +12,7 @@ const MapTileImage = React.forwardRef(({ map, ...props }) => {
|
||||
map.type === "file"
|
||||
);
|
||||
|
||||
return <Image src={mapURL} {...props} />;
|
||||
return <Image src={mapURL} ref={ref} {...props} />;
|
||||
});
|
||||
|
||||
export default MapTileImage;
|
||||
|
@ -5,7 +5,7 @@ import { useDataURL } from "../../contexts/AssetsContext";
|
||||
|
||||
import { tokenSources as defaultTokenSources } from "../../tokens";
|
||||
|
||||
const TokenImage = React.forwardRef(({ token, ...props }) => {
|
||||
const TokenImage = React.forwardRef(({ token, ...props }, ref) => {
|
||||
const tokenURL = useDataURL(
|
||||
token,
|
||||
defaultTokenSources,
|
||||
@ -13,7 +13,7 @@ const TokenImage = React.forwardRef(({ token, ...props }) => {
|
||||
token.type === "file"
|
||||
);
|
||||
|
||||
return <Image src={tokenURL} {...props} />;
|
||||
return <Image src={tokenURL} ref={ref} {...props} />;
|
||||
});
|
||||
|
||||
export default TokenImage;
|
||||
|
Loading…
Reference in New Issue
Block a user