1- import React , { Component } from 'react' ;
2- import { StyleSheet , View } from 'react-native' ;
3- import Layout , { Container } from '../../Layout' ;
4- import { Tabs , Icon , IconsName } from '@uiw/react-native' ;
5- import { ComProps } from '../../routes' ;
6- import { Text } from 'react-native-svg' ;
1+ import React , { Component } from 'react' ;
2+ import { StyleSheet , View } from 'react-native' ;
3+ import Layout , { Container } from '../../Layout' ;
4+ import { Tabs , Icon , IconsName } from '@uiw/react-native' ;
5+ import { ComProps } from '../../routes' ;
6+ import { Text } from 'react-native-svg' ;
77
8- const { Header, Body, Card, Footer } = Layout ;
8+ const { Header, Body, Card, Footer} = Layout ;
99
1010export interface listItem {
11- title : string | React . ReactElement | React . ReactNode ,
12- icon : IconsName | React . ReactElement | React . ReactNode ,
11+ title : string | React . ReactElement | React . ReactNode ;
12+ icon : IconsName | React . ReactElement | React . ReactNode ;
1313}
14- export interface IndexProps extends ComProps { }
14+ export interface IndexProps extends ComProps { }
1515export interface IndexState {
16- flag1 : string ,
17- flag : string ,
18- color1 : string ,
16+ flag1 : string ;
17+ flag : string ;
18+ color1 : string ;
1919}
2020
2121export default class Index extends Component < IndexProps , IndexState > {
2222 constructor ( props : IndexProps ) {
23- super ( props )
23+ super ( props ) ;
2424 this . state = {
2525 flag : '喜欢' ,
2626 flag1 : '喜欢' ,
27- color1 : '#f18700'
28- }
27+ color1 : '#f18700' ,
28+ } ;
2929 }
3030 onPress1 = ( val : string ) => {
31- this . setState ( { flag : val } )
32- }
31+ this . setState ( { flag : val } ) ;
32+ } ;
3333 onPress = ( val : string ) => {
34- this . setState ( { flag1 : val } )
35- }
34+ this . setState ( { flag1 : val } ) ;
35+ } ;
3636 render ( ) {
37- const { route } = this . props ;
37+ const { route} = this . props ;
3838 const description = route . params . description ;
3939 const title = route . params . title ;
40- const { Item } = Tabs
40+ const { Item} = Tabs ; ;
4141 return (
4242 < Container >
4343 < Layout >
4444 < Header title = { title } description = { description } />
4545 < Body >
4646 < Tabs >
47- < Item
47+ < Item
4848 title = { '喜欢' }
49- icon = ' heart-on'
49+ icon = " heart-on"
5050 style = { {
51- iconColor : this . state . flag === '喜欢' ?this . state . color1 :undefined ,
52- titleColor : this . state . flag === '喜欢' ?this . state . color1 :undefined
51+ iconColor :
52+ this . state . flag === '喜欢' ? this . state . color1 : undefined ,
53+ titleColor :
54+ this . state . flag === '喜欢' ? this . state . color1 : undefined , ,
5355 } }
5456 border = { this . state . flag === '喜欢' }
5557 onPress = { this . onPress1 }
5658 />
57- < Tabs . Item
58- title = { "关注" }
59+ < Tabs . Item
60+ title = { '关注' }
5961 style = { {
60- titleColor : this . state . flag === '关注' ?this . state . color1 :undefined
62+ titleColor :
63+ this . state . flag === '关注' ? this . state . color1 : undefined , ,
6164 } }
62- icon = { < Icon name = 'star-on' color = { this . state . flag === '关注' ?this . state . color1 :"#fff" } size = { 24 } /> }
65+ icon = {
66+ < Icon
67+ name = "star-on"
68+ color = {
69+ this . state . flag === '关注' ? this . state . color1 : '#fff'
70+ }
71+ size = { 24 }
72+ />
73+ }
6374 border = { this . state . flag === '关注' }
6475 onPress = { this . onPress1 }
6576 />
66- < Tabs . Item
67- title = { "信息" }
68- icon = ' mail'
77+ < Tabs . Item
78+ title = { '信息' }
79+ icon = " mail"
6980 style = { {
70- iconColor : this . state . flag === '信息' ?this . state . color1 :undefined ,
71- titleColor : this . state . flag === '信息' ?this . state . color1 :undefined
81+ iconColor :
82+ this . state . flag === '信息' ? this . state . color1 : undefined ,
83+ titleColor :
84+ this . state . flag === '信息' ? this . state . color1 : undefined , ,
7285 } }
7386 border = { this . state . flag === '信息' }
7487 onPress = { this . onPress1 }
7588 />
7689 </ Tabs >
77-
90+
7891 < View style = { styles . divider } />
7992
8093 < Tabs >
81- < Tabs . Item
94+ < Tabs . Item
8295 title = { '喜欢' }
8396 border = { this . state . flag1 === '喜欢' }
8497 onPress = { this . onPress }
8598 style = { {
86- titleColor : this . state . flag1 === '喜欢' ?this . state . color1 :undefined ,
87- borderColor : this . state . flag1 === '喜欢' ?this . state . color1 :undefined
99+ titleColor :
100+ this . state . flag1 === '喜欢' ? this . state . color1 : undefined ,
101+ borderColor :
102+ this . state . flag1 === '喜欢' ? this . state . color1 : undefined , ,
88103 } }
89104 />
90- < Tabs . Item
91- title = { "关注" }
105+ < Tabs . Item
106+ title = { '关注' }
92107 border = { this . state . flag1 === '关注' }
93108 onPress = { this . onPress }
94109 style = { {
95- titleColor : this . state . flag1 === '关注' ?this . state . color1 :undefined ,
96- borderColor : this . state . flag1 === '关注' ?this . state . color1 :undefined
110+ titleColor :
111+ this . state . flag1 === '关注' ? this . state . color1 : undefined ,
112+ borderColor :
113+ this . state . flag1 === '关注' ? this . state . color1 : undefined , ,
97114 } }
98115 />
99- < Tabs . Item
100- title = { "信息" }
116+ < Tabs . Item
117+ title = { '信息' }
101118 border = { this . state . flag1 === '信息' }
102119 onPress = { this . onPress }
103120 style = { {
104- titleColor : this . state . flag1 === '信息' ?this . state . color1 :undefined ,
105- borderColor : this . state . flag1 === '信息' ?this . state . color1 :undefined
121+ titleColor :
122+ this . state . flag1 === '信息' ? this . state . color1 : undefined ,
123+ borderColor :
124+ this . state . flag1 === '信息' ? this . state . color1 : undefined , ,
106125 } }
107126 />
108- < Tabs . Item
109- title = { "我的" }
127+ < Tabs . Item
128+ title = { '我的' }
110129 border = { this . state . flag1 === '我的' }
111130 onPress = { this . onPress }
112131 style = { {
113- titleColor : this . state . flag1 === '我的' ?this . state . color1 :undefined ,
114- borderColor : this . state . flag1 === '我的' ?this . state . color1 :undefined
132+ titleColor :
133+ this . state . flag1 === '我的' ? this . state . color1 : undefined ,
134+ borderColor :
135+ this . state . flag1 === '我的' ? this . state . color1 : undefined , ,
115136 } }
116137 />
117- < Tabs . Item
118- title = { "偏好" }
138+ < Tabs . Item
139+ title = { '偏好' }
119140 border = { this . state . flag1 === '偏好' }
120141 onPress = { this . onPress }
121142 style = { {
122- titleColor : this . state . flag1 === '偏好' ?this . state . color1 :undefined ,
123- borderColor : this . state . flag1 === '偏好' ?this . state . color1 :undefined
143+ titleColor :
144+ this . state . flag1 === '偏好' ? this . state . color1 : undefined ,
145+ borderColor :
146+ this . state . flag1 === '偏好' ? this . state . color1 : undefined , ,
124147 } }
125148 />
126149 </ Tabs >
@@ -139,6 +162,6 @@ const styles = StyleSheet.create({
139162 paddingRight : 20 ,
140163 } ,
141164 divider : {
142- marginVertical : 10
143- }
144- } ) ;
165+ marginVertical : 10 ,
166+ } ,
167+ } ) ;
0 commit comments