Zoom in Reason
Alain

Alain @idkjs

Joined:
Mar 26, 2017

Zoom in Reason

Publish Date: Sep 17 '19
7 0

ImageWithZoom Module

Pass in an image size which is passed to the uri variable. Whatever the image size it will be scaled to the width and height defined in the styles##image property.
Each time this component is called, a diffent image from https://picsum.photos/is retrieved.

let styles =
  Style.(
    StyleSheet.create({
      "image": style(~width=400.->dp, ~height=400.->dp, ()),
    })
  );

[@react.component]
let make = (~size=?) => {
  <Image
    style=styles##image
    source={Image.Source.fromUriSource(
      Image.uriSource(~uri={j|https://picsum.photos/$size/$size|j}, ()),
    )}
  />;
};

Alt Text

Resources

picsum.photos

original repo via @browniefed

See it on snack.io https://expo.io/@idkjs/zoomreason.
See the source.

Comments 0 total

    Add comment