Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add missing dark themes #6110

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading