-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
.../examples/animations/screens/animatedProperties/layoutAndPositioning/others/BoxSizing.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { StyleSheet, View } from 'react-native'; | ||
import Animated from 'react-native-reanimated'; | ||
|
||
import { ExamplesScreen, VerticalExampleCard } from '@/apps/css/components'; | ||
import { colors, radius, sizes, spacing } from '@/theme'; | ||
|
||
export default function BoxSizing() { | ||
return ( | ||
<ExamplesScreen | ||
CardComponent={VerticalExampleCard} | ||
buildAnimation={() => ({ | ||
animationDuration: '1s', | ||
animationIterationCount: 'infinite', | ||
animationName: { | ||
from: { | ||
boxSizing: 'border-box', | ||
}, | ||
to: { | ||
boxSizing: 'content-box', | ||
}, | ||
}, | ||
animationTimingFunction: 'linear', | ||
})} | ||
renderExample={({ animation }) => ( | ||
<View style={[styles.common, styles.parent]}> | ||
<Animated.View style={[styles.common, styles.child, animation]} /> | ||
</View> | ||
)} | ||
sections={[ | ||
{ | ||
description: | ||
"`boxSizing` is a **discrete** property. That means, it **can't be smoothly animated** between values. However, we can still change this property in the animation keyframes but the change will be **abrupt**.", | ||
examples: [ | ||
{ | ||
// 'In this example, the component in the **foreground** is rendered inside of the component in the **background** with some offset applied. The part that is **outside** of the **background** component is **clipped**.', | ||
title: 'Changing Box Sizing', | ||
}, | ||
], | ||
labelTypes: ['web'], | ||
title: 'Box Sizing', | ||
}, | ||
]} | ||
/> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
child: { | ||
borderColor: colors.primary, | ||
height: sizes.lg, | ||
width: '100%', | ||
}, | ||
common: { | ||
borderRadius: radius.md, | ||
borderWidth: spacing.sm, | ||
}, | ||
parent: { | ||
backgroundColor: colors.primaryLight, | ||
borderColor: colors.primaryDark, | ||
height: sizes.xxl, | ||
width: sizes.xxl, | ||
}, | ||
}); |
2 changes: 2 additions & 0 deletions
2
...s/css/examples/animations/screens/animatedProperties/layoutAndPositioning/others/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters