Commit 17e45f8e authored by Trisno's avatar Trisno

fix issue maps build 149

parent 68929dff
{ {
"expo": { "expo": {
"extra" : { "extra" : {
"buildNumber" : "148", "buildNumber" : "149",
"remarks": "" "remarks": ""
}, },
......
...@@ -151,13 +151,11 @@ class AddreesDetail extends React.Component { ...@@ -151,13 +151,11 @@ class AddreesDetail extends React.Component {
//searchlocation (mencari lokasi) //searchlocation (mencari lokasi)
_searchLocation = async () => { _searchLocation = async () => {
let search_location = await Location.geocodeAsync(this.state.address, Location.Accuracy.Balanced)
let search_location = await Location.geocodeAsync(this.state.address, Location.Accuracy.Balanced)
if (search_location.length === 0) { if (search_location.length === 0) {
Alert.alert(i18n.t('alertAddressNotFound')); Alert.alert(i18n.t('alertAddressNotFound'));
} else { } else {
let detail = await Location.reverseGeocodeAsync(search_location[0]) let detail = await Location.reverseGeocodeAsync(search_location[0])
this.setState({ this.setState({
latitude: search_location[0].latitude, latitude: search_location[0].latitude,
longitude: search_location[0].longitude, longitude: search_location[0].longitude,
...@@ -172,18 +170,30 @@ class AddreesDetail extends React.Component { ...@@ -172,18 +170,30 @@ class AddreesDetail extends React.Component {
// console.log('LATITUDE' + '' + this.state.latitude + '' + 'LONGITUDE' + this.state.longitude) // console.log('LATITUDE' + '' + this.state.latitude + '' + 'LONGITUDE' + this.state.longitude)
} }
validation(){ validation() {
if (this.state.name == '') { if (this.state.name == '') {
Alert.alert(i18n.t('alertLabelAddress')) Alert.alert(i18n.t('alertLabelAddress'))
} else if (this.state.description == ''){ } else if (this.state.description == '') {
Alert.alert(i18n.t('alertDetailAddress')) Alert.alert(i18n.t('alertDetailAddress'))
} else { } else {
this.saveAddress() this.saveAddress()
} }
} }
_onKeyPress() { onChangeLocation = async (e) => {
Alert.alert('tes key press') // console.log(e.nativeEvent.coordinate.latitude)
this.setState({
latitude: e.nativeEvent.coordinate.latitude,
longitude: e.nativeEvent.coordinate.longitude,
})
let detail = await Location.reverseGeocodeAsync(e.nativeEvent.coordinate)
this.setState({
street: detail[0].street,
city: detail[0].city,
// name: detail[0].name,
region: detail[0].region,
postalCode: detail[0].postalCode,
})
} }
saveAddress() { saveAddress() {
...@@ -265,18 +275,22 @@ class AddreesDetail extends React.Component { ...@@ -265,18 +275,22 @@ class AddreesDetail extends React.Component {
latitude: this.state.latitude, latitude: this.state.latitude,
longitude: this.state.longitude, longitude: this.state.longitude,
latitudeDelta: 0.1, latitudeDelta: 0.001,
longitudeDelta: 0.1, longitudeDelta: 0.001,
}} }}
onPress={(e) => this.onChangeLocation(e)}
zoomEnabled={true} zoomEnabled={true}
showsMyLocationButton={true} showsMyLocationButton={true}
loadingEnabled={true} loadingEnabled={true}
showsUserLocation={true} showsUserLocation={true}
showsScale={true} showsScale={true}
provider={PROVIDER_GOOGLE} provider={PROVIDER_GOOGLE}
zoomControlEnabled={true}
style={styles.cont_google_map}> style={styles.cont_google_map}>
<MapView.Marker <MapView.Marker
draggable
onDragEnd={(e) => this.onChangeLocation(e)}
coordinate={{ coordinate={{
latitude: this.state.latitude, latitude: this.state.latitude,
longitude: this.state.longitude longitude: this.state.longitude
...@@ -287,9 +301,9 @@ class AddreesDetail extends React.Component { ...@@ -287,9 +301,9 @@ class AddreesDetail extends React.Component {
</MapView> </MapView>
<View style={{ position: 'absolute', top: '50%', alignSelf: 'flex-end' }}> <View style={{ position: 'absolute', top: '50%', alignSelf: 'flex-end' }}>
<View style={{ margin: 15 }}> <View style={{ margin: 15 }}>
<TouchableOpacity style={{ height: 30, width: 30, backgroundColor: '#e6e6e6' }} onPress={() => this._getLocationAsync()}> {/* <TouchableOpacity style={{ height: 30, width: 30, backgroundColor: 'red' }} onPress={() => this._getLocationAsync()}> */}
{/* <Image source={require('../assets/icon/gps.png')} style={{ height: 30, width: 30 }} /> */} {/* <Image source={require('../assets/icon/gps.png')} style={{ height: 30, width: 30 }} /> */}
</TouchableOpacity> {/* </TouchableOpacity> */}
</View> </View>
</View> </View>
</View> </View>
...@@ -329,7 +343,7 @@ class AddreesDetail extends React.Component { ...@@ -329,7 +343,7 @@ class AddreesDetail extends React.Component {
caretHidden={this.state.caretHidden} caretHidden={this.state.caretHidden}
onFocus={() => this.setState({ caretHidden: false })} /> onFocus={() => this.setState({ caretHidden: false })} />
<Text style={{ color: '#666666', textAlign: 'center', fontSize: 14, paddingBottom:15 }}>{i18n.t('address_fulladdress_helptext')}</Text> <Text style={{ color: '#666666', textAlign: 'center', fontSize: 14, paddingBottom: 15 }}>{i18n.t('address_fulladdress_helptext')}</Text>
</View> </View>
<View style={{ margin: 50, justifyContent: 'center' }}> <View style={{ margin: 50, justifyContent: 'center' }}>
{ {
...@@ -384,7 +398,7 @@ const styles = StyleSheet.create({ ...@@ -384,7 +398,7 @@ const styles = StyleSheet.create({
top: 5, top: 5,
marginRight: 10, marginRight: 10,
marginLeft: 10, marginLeft: 10,
height: 250, height: 350,
}, },
name_addrees_input: { name_addrees_input: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment