-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcell.js
More file actions
33 lines (31 loc) · 772 Bytes
/
cell.js
File metadata and controls
33 lines (31 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* Created by Orz on 2018/5/5.
*/
import React, { Component } from 'react'
import { View, Text } from 'react-native'
import style from './styles'
export default class Cell extends Component {
constructor(props) {
super(props)
this.state = {
data: this.props.data,
len: this.props.len?this.props.len:100,
bold: this.props.bold,
}
}
render() {
let body
if(typeof this.state.data === 'string' || typeof this.state.data === 'number'){
body = <Text style={[style.font, this.state.bold?style.bold:'']}>
{ this.state.data }
</Text>
} else {
body = this.state.data
}
return(
<View style={[style.cell, style.center, {width: this.state.len}]}>
{ body }
</View>
)
}
}