React Challenge Webinar 3.2: Framer X Code Overrides

Webinar video

  • Note: I used window.innerWidth in the webinar demo. It was a bad idea. It is NOT always the same as the available screen width. In the assignment files, I switched to use a hardcoded value (375) instead. Sorry for the confusion!

Links

  • iOS Card Expand
  • Starter file
  • End file after the webinar

Assignments

1. Slider with code override

Requirements
  • Recreate the slider we built in the second webinar in Framer X with code overrides
  • Starter file

Hints
  • Can you use useAnimation to control the animation of the cheek? Why or why not?
  • Use Data for the communication between overrides
  • Graphic doesn’t have the “Override” option on the properties panel, how would you animate it?

Solution


2. Improve card expand code override

At the webinar, I defined const data = Data({ mode: "list" }), and in onTap, I changed its value so that we’ll see the animation: data.mode = "detail". This works for a single card, but as soon as we attach the code override to a second card, both cards will be animated when we tap any card. The problem is shown in the following video:
This is issue happens because the animate attribute of all cards are always bound to the same value.

Requirements
  • Fix this issue. That is, only expand the card that’s tapped by the user.
  • Use only code overrides
  • Starter file

Hints
There’s actually a way to fix the issue with just code overrides. 
  • Instead of putting mode in Data, we can put the id of the currently expanded card.
  • Just as left, right and width, we can get id from props. Try print it out with console.log
  • Use data.expandedCardId to determine the value of animate prop.
  • How would you represent the case when there’s no card expanded? Hint: use null!

Solution