Skip to content

Commit

Permalink
fix(Tabs):调整Tabs主题色配置
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenlingasMx committed Apr 6, 2023
1 parent 6a74b76 commit 7758296
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/Tabs/TabsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface TabsItemProps {
}

function TabsItem(props: TabsItemProps) {
const { activeColor, icon, index, value, onChange, defaultColor, children } = props;
const { activeColor, icon, index, value, onChange, defaultColor } = props;
const opacity = useRef(new Animated.Value(0)).current;

useEffect(() => {
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useRef, useEffect, useState } from 'react';
import { StyleSheet, SafeAreaView, StatusBar, ScrollView, ViewProps, View, ViewStyle, Dimensions } from 'react-native';

import { StyleSheet, SafeAreaView, ScrollView, ViewProps, View, ViewStyle, Dimensions } from 'react-native';
import { useTheme } from '@shopify/restyle';
import { Theme } from '../theme';
import Item from './TabsItem';

export interface TabsProps extends ViewProps {
Expand All @@ -15,7 +16,15 @@ export interface TabsProps extends ViewProps {
}

function Tabs(props: TabsProps) {
const { style, children, onChange, activeColor, value, defaultColor = '#035bb6' } = props;
const theme = useTheme<Theme>();
const {
style,
children,
onChange,
activeColor,
value,
defaultColor = theme.colors.primary_background || '#3578e5',
} = props;
const scrollViewRef = useRef<ScrollView>(null);
const [scrollViewWidth, setScrollViewWidth] = useState<number>(Dimensions.get('window').width);

Expand Down

0 comments on commit 7758296

Please sign in to comment.