LocationTextView.js
1.1 KB
import React, {Component} from 'react';
import {
View,
Text,
TouchableOpacity
} from 'react-native';
export default class LocationTextView extends Component {
constructor(props) {
super(props);
this.state = {
address: ''
}
}
getLocationText() {
this.setState({
address: "苏州市虎丘区竹园路209号思考京东方谁看得见佛看谁看得见佛"
})
}
render() {
return (
<View style={{width: '100%', backgroundColor: 'white', paddingHorizontal: 5, paddingVertical: 10, flexDirection: 'row', alignItems: 'center'}}>
<Text style={{fontSize: 16, color: 'rgba(0, 0, 0, 1)'}}>当前地点</Text>
<Text style={{fontSize: 16, color: 'rgba(0, 0, 0, 1)', flex: 1, marginLeft: 30, marginRight: 10}}>{this.state.address}</Text>
<Text style={{fontSize: 16, color: global.homeColor}} onPress={()=>this.getLocationText()}>
{(this.state.address && this.state.address.length > 0)? '刷新':'获取'}</Text>
</View>
);
}
}