Skip to content

Instantly share code, notes, and snippets.

@fakenickels
Last active May 16, 2022 19:49
Show Gist options
  • Save fakenickels/05c819cd00520a7cabc4b3968659c0eb to your computer and use it in GitHub Desktop.
Save fakenickels/05c819cd00520a7cabc4b3968659c0eb to your computer and use it in GitHub Desktop.
module ReMotionConfig = {
type state = | Open | Closed;
let animateForState = fun | Open => [opacity(1)] | Closed => [opacity(0)];
};
module Motion = ReMotion.Make(ReMotionConfig);
<Motion state=Closed>
...(({ style, setState, state, transitioning }) => {
<Modal visible=(switch(state, transitioning) => { (Closed, false) => false | _ => true }) onRequestClose=(() => setState(Closed))>
<Animated.View style=Style.combine(Styles.wrapper, style)>
<Animated.View>
</Modal>
})
</Motion>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment