Commit 54402b9e authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

circular loading outlet

parent abb8f15b
import React from 'react'; import React from 'react';
import { View, Text, StyleSheet, FlatList, TextInput, Alert, Linking } from 'react-native'; import { View, Text, StyleSheet, FlatList, TextInput, Alert, Linking, ActivityIndicator } from 'react-native';
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'; import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler';
import Spinner from 'react-native-loading-spinner-overlay'; import Spinner from 'react-native-loading-spinner-overlay';
import { CheckBox } from 'react-native-elements'; import { CheckBox } from 'react-native-elements';
...@@ -31,7 +31,8 @@ class Outlets extends React.Component { ...@@ -31,7 +31,8 @@ class Outlets extends React.Component {
spinner: false, spinner: false,
data_outlet: [], data_outlet: [],
outlet_selected: '', outlet_selected: '',
data_name: '' data_name: '',
indicator:true
} }
} }
...@@ -113,17 +114,18 @@ class Outlets extends React.Component { ...@@ -113,17 +114,18 @@ class Outlets extends React.Component {
this.setState({ this.setState({
dataOutlets: dataOutlets, dataOutlets: dataOutlets,
data_before_search: dataOutlets, data_before_search: dataOutlets,
}) })
this.setState({ this.setState({
spinner: false, indicator: false
}) })
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
Alert.alert(response.msg); Alert.alert(response.msg);
this.setState({ this.setState({
spinner: false, indicator: false
}) })
}) })
} }
...@@ -227,7 +229,7 @@ class Outlets extends React.Component { ...@@ -227,7 +229,7 @@ class Outlets extends React.Component {
return ( return (
<View style={{ flexDirection: 'row', flex: 1,marginRight:10,marginLeft:10,marginBottom:10}}> <View style={{ flexDirection: 'row', flex: 1,marginRight:10,marginLeft:10,marginBottom:10}}>
<View style={styles.content_list}> <View style={styles.content_list}>
<View style={styles.list_addrees}> <View style={styles.list_addrees}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#ccb46c', fontSize: 18,margin:1 }}>{item.name}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#ccb46c', fontSize: 18,margin:1 }}>{item.name}</Text>
<Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2' }}>{item.full_address}</Text> <Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2' }}>{item.full_address}</Text>
...@@ -258,6 +260,7 @@ class Outlets extends React.Component { ...@@ -258,6 +260,7 @@ class Outlets extends React.Component {
</View> </View>
</View> </View>
</View> </View>
</View> </View>
); );
} }
...@@ -312,6 +315,9 @@ class Outlets extends React.Component { ...@@ -312,6 +315,9 @@ class Outlets extends React.Component {
</View> </View>
</View> */} </View> */}
<View style={styles.body}> <View style={styles.body}>
{this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" style={{margin:20}} />
) : (
<FlatList <FlatList
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])} data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
renderItem={this.RenderItem} renderItem={this.RenderItem}
...@@ -321,6 +327,7 @@ class Outlets extends React.Component { ...@@ -321,6 +327,7 @@ class Outlets extends React.Component {
maxToRenderPerBatch={2} maxToRenderPerBatch={2}
onEndReachedThreshold={0.5} onEndReachedThreshold={0.5}
/> />
)}
</View> </View>
</View> </View>
) )
......
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