Skip to content

Commit 0420afa

Browse files
committed
Add LinearGradient background to CircularDraggableSlider for enhanced visual appeal
1 parent 05d8984 commit 0420afa

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export default function App() {
5353
selectedDuration.value = durationHours;
5454
}}
5555
/>
56+
</View>
57+
<View>
58+
5659
</View>
5760
<BottomTab />
5861
</View>

src/components/circle-time/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Dimensions, StyleSheet, View } from 'react-native';
22

33
import { forwardRef, useImperativeHandle } from 'react';
44

5+
import { LinearGradient } from 'expo-linear-gradient';
56
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
67
import Animated, {
78
cancelAnimation,
@@ -161,7 +162,9 @@ export const CircularDraggableSlider = forwardRef<
161162
],
162163
},
163164
]}>
165+
164166
<Animated.View pointerEvents="none">
167+
165168
{new Array(linesAmount).fill(0).map((_, index) => {
166169
// Determine line type based on position
167170
const isBigLine = index % bigLineIndexOffset === 0;
@@ -203,6 +206,24 @@ export const CircularDraggableSlider = forwardRef<
203206
);
204207
})}
205208
</Animated.View>
209+
<LinearGradient
210+
// Background Linear Gradient
211+
colors={['rgba(0,0,0,1)', 'rgba(0,0,0,0.9)', 'transparent']}
212+
start={{
213+
x: 0,
214+
y: 0
215+
}}
216+
end={{
217+
x: 1,
218+
y: 0
219+
}}
220+
style={{
221+
position: 'absolute',
222+
height: radius * 2 + 30,
223+
width: radius,
224+
top: -(WindowHeight / 2 - radius - 16)
225+
}}
226+
/>
206227
</View>
207228
<GestureDetector gesture={panGesture}>
208229
<Animated.View

0 commit comments

Comments
 (0)