How it works...
In step 4, we defined two properties on state: selected and position. The selected property holds the image data for the pressed image, which can be any of the timeline objects defined in step 3. The position property will hold the current y-coordinate on the screen, which is used later to animate the image from its original position to the center of the screen.
In step 5, we map over the timeline array to render each post. We used the PostContainer element for each post, sending the post information and using the onPress callback to set the pressed image.
In step 10, we need the current position of the image. To achieve this, we use the measure method from the component we want to get the information from. This method receives ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access