1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /**
- * Created by zack on 2018/6/23.
- */
- /**
- * Created by zack on 2018/6/23.
- */
- import {
- View,
- Text,
- StyleSheet,
- Image,
- ImageBackground,
- TouchableOpacity,
- FlatList
- } from 'react-native'
- import React, {Component} from 'react'
- import {NavigationBarHeight, ScreenDimensions} from '../../../utils/DimensionsTools'
-
- export default class MineTextItem extends Component {
- constructor(props) {
- super(props)
- this.state = {
- title: props.title,
- desc: props.desc
- }
- }
-
- componentWillReceiveProps(props) {
- this.setState({
- title: props.title,
- desc: props.desc
- })
- }
-
- shouldComponentUpdate(nextProps) {
- if (nextProps.title !== this.state.title || nextProps.desc !== this.state.desc) {
- return true
- }
-
- return false
- }
-
- render() {
- return(
- <TouchableOpacity onPress={() => {
- this.props.didSelectedItem()
- }} style={styles.View}>
- <Text style={styles.LeftText}>{this.state.title}</Text>
-
- <View style={styles.ContainerView}>
- <Text numberOfLines={1} style={styles.DescText}>{this.state.desc}</Text>
- <Image source={require('../../../resources/images/Mine/Right-Arrow.png')}/>
- </View>
-
- <View style={{position: 'absolute', width: ScreenDimensions.width, height: 0.5, backgroundColor: '#efeff4', left: 0, bottom: 0}} />
- </TouchableOpacity>
- )
- }
- }
-
- const styles = StyleSheet.create({
- View: {
- width: ScreenDimensions.width,
- height: 80,
- backgroundColor: 'white',
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
- },
-
- LeftText: {
- fontSize: 14,
- color: '#333333',
- marginLeft: 15,
- },
- ContainerView: {
- marginRight: 15,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'center'
- },
- DescText: {
- fontSize: 14,
- color: '#333333',
- marginRight: 12,
- width: ScreenDimensions.width - 180,
- textAlign: 'right'
- }
-
- })
-
|