Commit 082d4d54 authored by Trisno's avatar Trisno

update inbox

parent e2b50a72
...@@ -120,7 +120,7 @@ class InboxDetail extends React.Component { ...@@ -120,7 +120,7 @@ class InboxDetail extends React.Component {
<AntDesign name="arrowleft" size={22} color="white" /> <AntDesign name="arrowleft" size={22} color="white" />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ flex: 0.8, alignItems: 'flex-end' }}> <View style={{ flex: 0.8, alignItems: 'center' }}>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: 'white' }}>{i18n.t('headerInboxDetail')}</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: 'white' }}>{i18n.t('headerInboxDetail')}</Text>
</View> </View>
<View style={{ margin: 15, flex: 0.1, alignItems: 'flex-end' }}> <View style={{ margin: 15, flex: 0.1, alignItems: 'flex-end' }}>
......
import React from 'react'; import React from 'react';
import { View, Text, BackHandler, StyleSheet, ScrollView, Alert, TouchableOpacity, ActivityIndicator } from 'react-native'; import { View, Text, BackHandler, StyleSheet, ScrollView, Alert, TouchableOpacity, ActivityIndicator, RefreshControl } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
...@@ -13,7 +13,8 @@ class InboxList extends React.Component { ...@@ -13,7 +13,8 @@ class InboxList extends React.Component {
this.handleBackButtonClick = this.handleBackButtonClick.bind(this) this.handleBackButtonClick = this.handleBackButtonClick.bind(this)
this.state = { this.state = {
inbox_list: [], inbox_list: [],
indicator: true indicator: true,
refreshing: false
} }
} }
...@@ -39,6 +40,16 @@ class InboxList extends React.Component { ...@@ -39,6 +40,16 @@ class InboxList extends React.Component {
return true; return true;
} }
onRefresh() {
this.setState({
refreshing: true
})
this.getInbox()
this.setState({
refreshing: false
})
}
getInbox() { getInbox() {
let params = { let params = {
session_id: this.props.session_id session_id: this.props.session_id
...@@ -64,7 +75,8 @@ class InboxList extends React.Component { ...@@ -64,7 +75,8 @@ class InboxList extends React.Component {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView style={styles.body}> <ScrollView style={styles.body} refreshControl={<RefreshControl refreshing={this.state.refreshing}
onRefresh={() => this.onRefresh()} />}>
{ {
this.state.indicator ? (<ActivityIndicator style={{ justifyContent: "center", marginTop: 100 }} size="large" color="#c9af6d" />) : this.state.indicator ? (<ActivityIndicator style={{ justifyContent: "center", marginTop: 100 }} size="large" color="#c9af6d" />) :
this.state.inbox_list.length ? ( this.state.inbox_list.length ? (
......
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