11import React , { useRef , useState , useEffect } from 'react' ;
2- import { View , ViewStyle , StyleSheet , Text , TouchableOpacity , Modal , ModalProps , Animated } from 'react-native' ;
2+ import { View , ViewStyle , StyleSheet , Text } from 'react-native' ;
33import Icon from '../Icon' ;
44import Button from '../Button' ;
55import { size } from './index' ;
@@ -20,18 +20,29 @@ export interface DirTextProps {
2020 disabled : boolean ;
2121 icon : boolean ;
2222 onPageChange : ( type : 'prev' | 'next' ) => void ;
23+ borderColor ?: string ;
24+ color ?: string ;
2325}
2426
2527const DirText = ( props : DirTextProps ) => {
26- const { size, direction, disabled, icon, onPageChange } = props ;
28+ const { size, direction, disabled, icon, onPageChange, borderColor = '#8d8d8d' , color } = props ;
2729 const dirText : '上一页' | '下一页' = useRef < '上一页' | '下一页' > ( direction === 'left' ? '上一页' : '下一页' ) . current ;
28- const [ disabledStyle , setDisabledStyle ] = useState < '#d9d9d9' | '#3d3d3d' > ( '#3d3d3d' ) ;
30+ const [ disabledStyle , setDisabledStyle ] = useState ( 1 ) ;
2931 useEffect ( ( ) => {
30- setDisabledStyle ( disabled ? '#d9d9d9' : '#3d3d3d' ) ;
32+ setDisabledStyle ( disabled ? 0.4 : 1 ) ;
3133 } , [ disabled ] ) ;
32-
3334 return (
34- < View style = { [ styles . containerStyle , { minWidth : containerSize [ size ] , paddingHorizontal : icon ? 0 : 5 } ] } >
35+ < View
36+ style = { [
37+ styles . containerStyle ,
38+ {
39+ minWidth : containerSize [ size ] ,
40+ borderColor : borderColor ,
41+ paddingHorizontal : icon ? 0 : 5 ,
42+ opacity : disabled ? disabledStyle : disabledStyle - 0.2 ,
43+ } ,
44+ ] }
45+ >
3546 < Button
3647 bordered = { false }
3748 disabled = { disabled }
@@ -41,9 +52,9 @@ const DirText = (props: DirTextProps) => {
4152 } }
4253 >
4354 { icon ? (
44- < Icon name = { direction } size = { contentSize [ size ] } color = { disabledStyle } />
55+ < Icon name = { direction } size = { contentSize [ size ] } color = { color || '#3d3d3d' } />
4556 ) : (
46- < Text style = { { color : disabledStyle } } > { dirText } </ Text >
57+ < Text style = { { color : color || '#3d3d3d' } } > { dirText } </ Text >
4758 ) }
4859 </ Button >
4960 </ View >
@@ -53,7 +64,6 @@ const DirText = (props: DirTextProps) => {
5364export const containerStyle : ViewStyle = {
5465 borderStyle : 'solid' ,
5566 borderWidth : 1 ,
56- borderColor : '#d9d9d9' ,
5767 borderRadius : 2 ,
5868 display : 'flex' ,
5969 flexDirection : 'row' ,
0 commit comments