Skip to content

Commit

Permalink
Animation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 committed Nov 24, 2024
1 parent f749aa3 commit e51f99d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/ToggleSwitch/ToggleSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ export default function ToggleSwitch({
if (!trueLabelLayout || !falseLabelLayout) return;

Animated.timing(translateAnimation, {
duration: 200,
duration: 150,
toValue: value
? trueLabelLayout.x + trueLabelLayout.width / 2 - 2
: falseLabelLayout.x + falseLabelLayout.width / 2 + 2,
useNativeDriver: true,
}).start();

Animated.timing(scaleAnimation, {
duration: 280,
duration: 150,
toValue: (value ? trueLabelLayout.width : falseLabelLayout.width) ?? 0,
useNativeDriver: true,
}).start();
Expand Down
3 changes: 2 additions & 1 deletion src/screens/TreeInfo/TreeInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ export default function TreeInfoPage({ route }: TreeInfoPageProps) {
style={styles.imageBg}
></ImageBackground>
<View style={styles.body}>
<View>
<View style={styles.switch}>
<ToggleSwitch
value={isEditing}
onValueChange={setIsEditing}
trueLabel="This tree"
falseLabel="Species"
/>
</View>

<View>
<Text style={styles.header}>{treeData.species?.name ?? ''}</Text>
<View style={styles.idPillFlex}>
Expand Down
6 changes: 2 additions & 4 deletions src/screens/TreeInfo/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import { StyleSheet } from 'react-native';
import colors from '@/styles/colors';

export default StyleSheet.create({
// Container
container: {
// flex: 1,
paddingBottom: 40,
backgroundColor: colors.white1,
},
imageBg: {
flex: 1,
height: 292,
},
switch: { paddingBottom: 32 },

// Header
headerFlex: {
flex: 1,
flexDirection: 'column',
Expand Down Expand Up @@ -66,7 +64,7 @@ export default StyleSheet.create({
// Main body
body: {
paddingHorizontal: 42,
paddingTop: 48,
paddingTop: 20,
marginBottom: 10,
marginTop: -16,
borderRadius: 20,
Expand Down

0 comments on commit e51f99d

Please sign in to comment.