Skip to content

Commit

Permalink
fix(Pagination):删除边框调整文字颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
panbibi committed Apr 10, 2023
1 parent f62c8b0 commit 21d61dd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/core/src/Pagination/DirText.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useRef, useState, useEffect } from 'react';
import { View, ViewStyle, StyleSheet, Text } from 'react-native';
import { View, ViewStyle, StyleSheet, useColorScheme } from 'react-native';
import Icon from '../Icon';
import Button from '../Button';
import { size } from './index';
import { Theme } from '../theme';
import { useTheme } from '@shopify/restyle';
import Text from '../Typography/Text';

export enum containerSize {
small = 30,
Expand All @@ -28,28 +29,29 @@ export interface DirTextProps {

const DirText = (props: DirTextProps) => {
const theme = useTheme<Theme>();

const colorScheme = useColorScheme();
const {
size,
direction,
disabled,
icon,
onPageChange,
borderColor = theme.colors.gray300 || '#8d8d8d',
// borderColor = theme.colors.gray300 || '#8d8d8d',
color,
} = props;
const dirText: '上一页' | '下一页' = useRef<'上一页' | '下一页'>(direction === 'left' ? '上一页' : '下一页').current;
const [disabledStyle, setDisabledStyle] = useState(1);
useEffect(() => {
setDisabledStyle(disabled ? 0.4 : 1);
}, [disabled]);
const textColor = colorScheme === 'dark' ? '#ccc' : '#3d3d3d';
return (
<View
style={[
styles.containerStyle,
{
minWidth: containerSize[size],
borderColor: borderColor,
// borderColor: borderColor,
backgroundColor: theme.colors.white || '#fff',
// paddingHorizontal: icon ? 0 : 5,
opacity: disabled ? disabledStyle : disabledStyle - 0.2,
Expand All @@ -65,18 +67,18 @@ const DirText = (props: DirTextProps) => {
}}
>
{icon ? (
<Icon name={direction} size={contentSize[size]} color={color || '#3d3d3d'} />
<Icon name={direction} size={contentSize[size]} color={color || textColor} />
) : (
<Text style={{ color: color || '#3d3d3d' }}>{dirText}</Text>
<Text style={{ color: color || textColor }}>{dirText}</Text>
)}
</Button>
</View>
);
};

export const containerStyle: ViewStyle = {
borderStyle: 'solid',
borderWidth: 1,
borderStyle: 'dashed',
// borderWidth: 1,
borderRadius: 6,
display: 'flex',
flexDirection: 'row',
Expand Down

0 comments on commit 21d61dd

Please sign in to comment.