Skip to content

Commit

Permalink
docs: Fix FlipCard example on Android/iOS (#6823)
Browse files Browse the repository at this point in the history
## Summary

FlipCard example was "flickering" and not showing current card (on iOS
and Android). Change in styles fixed that.

It was discovered in #6722 

Before:


https://github.com/user-attachments/assets/373980e1-c86d-4521-bfe3-fe1e312ba920

After:


https://github.com/user-attachments/assets/32b47476-27c2-4eb8-9300-362c45ffb238
  • Loading branch information
patrycjakalinska authored Dec 20, 2024
1 parent e60e35b commit b2c5914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/docs-reanimated/blog/flip-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import FlipCardSrc from '!!raw-loader!@site/static/examples/FlipCard';

For storing information about whether the card is flipped or not we use [shared value](/docs/fundamentals/glossary#shared-value) with the `useSharedValue` hook. Using shared values helps to prevent unnecessary re-renders.

<CollapsibleCode src={FlipCardSrc} showLines={[117,117]} />
<CollapsibleCode src={FlipCardSrc} showLines={[116,116]} />

This allows us to [interpolate](/docs/utilities/interpolate) values between 0-180 and 180-360 degrees, depending on whether the card is flipped or not. In addition, we use [withTiming](/docs/animations/withTiming) util which makes our animation smooth.

<CollapsibleCode src={FlipCardSrc} showLines={[62,64]} />
<CollapsibleCode src={FlipCardSrc} showLines={[61,63]} />

<ExampleVideo
sources={{
Expand All @@ -29,4 +29,4 @@ The **FlipCard** component accepts several props: `duration` allows you to chang

<samp id="FlipCard">Flip Card</samp>

<CollapsibleCode src={FlipCardSrc} showLines={[51,103]} />
<CollapsibleCode src={FlipCardSrc} showLines={[50,102]} />
2 changes: 1 addition & 1 deletion packages/docs-reanimated/static/examples/FlipCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ const flipCardStyles = StyleSheet.create({
zIndex: 1,
},
flippedCard: {
backfaceVisibility: 'hidden',
zIndex: 2,
},
});
Expand Down Expand Up @@ -162,5 +161,6 @@ const styles = StyleSheet.create({
flipCard: {
width: 170,
height: 200,
backfaceVisibility: 'hidden',
},
});

0 comments on commit b2c5914

Please sign in to comment.