Skip to content

Commit

Permalink
docs: Add missing dark themes (#6110)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrycjakalinska authored Jun 13, 2024
1 parent 5e830b2 commit 793a4ec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/docs-reanimated/static/examples/Slider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useColorScheme } from '@mui/material';
import { View, StyleSheet } from 'react-native';
import { TextInput } from 'react-native-gesture-handler';
import {
Expand All @@ -20,6 +21,7 @@ Animated.addWhitelistedNativeProps({ text: true });
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);

const Slider = () => {
const { colorScheme } = useColorScheme();
const offset = useSharedValue(0);
const boxWidth = useSharedValue(INITIAL_BOX_SIZE);
const MAX_VALUE = SLIDER_WIDTH - INITIAL_BOX_SIZE;
Expand Down Expand Up @@ -50,6 +52,10 @@ const Slider = () => {
};
});

const animatedBoxTextColor = {
color: colorScheme === 'light' ? '#001a72' : '#f8f9ff',
};

const animatedProps = useAnimatedProps(() => {
return {
text: `Box width: ${Math.round(boxWidth.value)}`,
Expand All @@ -61,7 +67,7 @@ const Slider = () => {
<GestureHandlerRootView style={styles.container}>
<AnimatedTextInput
animatedProps={animatedProps}
style={styles.boxWidthText}
style={[animatedBoxTextColor, styles.boxWidthText]}
editable={false}
/>
<Animated.View style={[styles.box, boxStyle]} />
Expand Down Expand Up @@ -105,7 +111,6 @@ const styles = StyleSheet.create({
boxWidthText: {
textAlign: 'center',
fontSize: 18,
color: '#001a72',
},
});

Expand Down

0 comments on commit 793a4ec

Please sign in to comment.