Skip to content

Commit

Permalink
autocomplete fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lub2code committed Sep 26, 2019
1 parent 8236ce2 commit 32264b4
Show file tree
Hide file tree
Showing 4 changed files with 632 additions and 30 deletions.
52 changes: 26 additions & 26 deletions src/Component/Page/DataList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, FlatList } from 'react-native';
import { View, Text, StyleSheet, SafeAreaView, FlatList, TouchableOpacity } from 'react-native';
import { Header, Card } from 'react-native-elements';
import { Left, Right, Icon } from 'native-base';
import colors from '../../config/colors';
Expand All @@ -9,29 +9,6 @@ import api from '../../config/api';
import ProgressScreen from '../Refer/ProgressScreen';
import { getDeliveryStatus } from "../../utils/requestStatus";

function Item({ item }) {
return (
<Card>
<View style={styles.item_container}>
<Text style={styles.label}>Created: </Text>
<Text style={styles.value}>{new Date(item.created).toLocaleString()}</Text>
</View>
<View style={styles.item_container}>
<Text style={styles.label}>Address: </Text>
<Text style={styles.value}>{item.senderStreet + item.senderHouseNr + ", " + item.senderCity}</Text>
</View>
<View style={styles.item_container}>
<Text style={styles.label}>E-mail: </Text>
<Text style={styles.value}>{item.senderEmail}</Text>
</View>
<View style={styles.item_container}>
<Text style={styles.label}>Status: </Text>
<Text style={styles.value}>{getDeliveryStatus(item.status)}</Text>
</View>
</Card>
);
}

class DataList extends Component {
static navigationOptions = {
drawerIcon: ({ tintColor }) => (
Expand All @@ -46,7 +23,7 @@ class DataList extends Component {
data: null
}
}

componentDidMount() {
return fetch(api.get_all_transport_requests, {
method: 'POST',
Expand All @@ -67,6 +44,29 @@ class DataList extends Component {
});
}

Item = ({ item }) => {
return (
<Card>
<TouchableOpacity style={styles.item_container} onPress={() => this.props.navigation.state.params.parent.navigation.navigate('RequestDetail', {data: item, person_info: this.props.navigation.state.params.person_info})}>
<Text style={styles.label}>Created: </Text>
<Text style={styles.value}>{new Date(item.created).toLocaleString()}</Text>
</TouchableOpacity>
<View style={styles.item_container}>
<Text style={styles.label}>Address: </Text>
<Text style={styles.value}>{item.senderStreet + item.senderHouseNr + ", " + item.senderCity}</Text>
</View>
<View style={styles.item_container}>
<Text style={styles.label}>E-mail: </Text>
<Text style={styles.value}>{item.senderEmail}</Text>
</View>
<View style={styles.item_container}>
<Text style={styles.label}>Status: </Text>
<Text style={styles.value}>{getDeliveryStatus(item.status)}</Text>
</View>
</Card>
);
}

render() {
if (this.state.isLoading) {
return (
Expand All @@ -92,7 +92,7 @@ class DataList extends Component {
<SafeAreaView style={styles.container}>
<FlatList
data={this.state.data}
renderItem={({ item }) => <Item item={item} />}
renderItem={({ item }) => <this.Item item={item} />}
keyExtractor={item => item.id}
/>
</SafeAreaView>
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Page/RegisterParcel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ class RegisterParcel extends Component {
<Input
label='Phone'
keyboardType="numeric"
value={item.state}
value={item.parcel_phone}
errorStyle={{ color: 'red' }}
errorMessage={item.parcel_phone == null || item.parcel_phone == "" ? 'It is necessary.' : ''}
onChangeText={(parcel_phone) => this.setState(state => {
Expand Down
Loading

0 comments on commit 32264b4

Please sign in to comment.