Commit 628dde04 authored by Deni Rinaldi's avatar Deni Rinaldi

backhndlr

parent a314c2c9
...@@ -4,6 +4,7 @@ import { Container } from 'native-base' ...@@ -4,6 +4,7 @@ import { Container } from 'native-base'
import api from '../../../service/api' import api from '../../../service/api'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient' import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import Svg, { Circle, Rect } from 'react-native-svg' import Svg, { Circle, Rect } from 'react-native-svg'
import { NavigationEvents } from 'react-navigation'
import Reactron from 'reactotron-react-native' import Reactron from 'reactotron-react-native'
import Next from 'react-native-vector-icons/MaterialIcons' import Next from 'react-native-vector-icons/MaterialIcons'
...@@ -48,6 +49,9 @@ export default class Appraisal extends Component { ...@@ -48,6 +49,9 @@ export default class Appraisal extends Component {
render() { render() {
return ( return (
<Container style={{ flex: 1 }}> <Container style={{ flex: 1 }}>
<NavigationEvents
onDidFocus={() => this.getListAppraisal()}
/>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} > <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, TextInput, ScrollView, StyleSheet, TouchableOpacity } from 'react-native' import { Text, View, TextInput, ScrollView, StyleSheet, TouchableOpacity, BackHandler } from 'react-native'
import { Collapse, CollapseHeader, CollapseBody } from "accordion-collapse-react-native"; import { Collapse, CollapseHeader, CollapseBody } from "accordion-collapse-react-native";
import { Thumbnail, List, ListItem, Separator, Container } from 'native-base'; import { Thumbnail, List, ListItem, Separator, Container } from 'native-base';
import M from 'moment' import M from 'moment'
...@@ -37,7 +37,20 @@ export default class sampleMenuAppraisal extends Component { ...@@ -37,7 +37,20 @@ export default class sampleMenuAppraisal extends Component {
} }
componentDidMount() { componentDidMount() {
// alert(JSON.stringify(this.state.data)) BackHandler.addEventListener('hardwareBackPress', this._onBackPressed)
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this._onBackPressed)
}
_onBackPressed = () => {
api.create().postDraftAppraisal({
contract_id: this.state.data.contract_id
}).then((response) => {
this.props.navigation.goBack()
return true
})
} }
handlePenerimaanDate(date) { handlePenerimaanDate(date) {
......
...@@ -3,6 +3,7 @@ import { Text, View, ScrollView, TouchableOpacity } from 'react-native' ...@@ -3,6 +3,7 @@ import { Text, View, ScrollView, TouchableOpacity } from 'react-native'
import { Container } from 'native-base' import { Container } from 'native-base'
import api from '../../../service/api' import api from '../../../service/api'
import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient' import SvgAnimatedLinearGradient from 'react-native-svg-animated-linear-gradient'
import { NavigationEvents } from 'react-navigation'
import Svg, { Circle, Rect } from 'react-native-svg' import Svg, { Circle, Rect } from 'react-native-svg'
import Reactron from 'reactotron-react-native' import Reactron from 'reactotron-react-native'
import Next from 'react-native-vector-icons/MaterialIcons' import Next from 'react-native-vector-icons/MaterialIcons'
...@@ -48,6 +49,9 @@ export default class Approval extends Component { ...@@ -48,6 +49,9 @@ export default class Approval extends Component {
render() { render() {
return ( return (
<Container style={{ flex: 1 }}> <Container style={{ flex: 1 }}>
<NavigationEvents
onDidFocus={() => this.getListAppraisal()}
/>
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} > <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
......
...@@ -375,7 +375,31 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -375,7 +375,31 @@ export default class sampleMenuPenerimaan3 extends Component {
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
{this.state.data == "" ?
<View style={{ width: '100%', justifyContent: 'center', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center' }}>
<AwesomeButton
backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'}
backgroundPlaceholder={null}
backgroundDarker={'#FFED75'}
backgroundProgress={null}
width={120}
height={45}
raiseLevel={5}
borderRadius={10}
progressLoadingTime={1000}
progress={!this.state.progress}
onPress={next => {
setTimeout(() => {
this.handlePenerimaan()
next()
}, 300);
}}
>
<Text style={{ color: 'black', fontWeight: '700' }}>Terima</Text>
</AwesomeButton>
</View>
:
<View style={{ width: '100%', justifyContent: 'space-evenly', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center', flexDirection: 'row' }}> <View style={{ width: '100%', justifyContent: 'space-evenly', marginTop: 20, alignSelf: 'center', alignContent: 'flex-end', alignItems: 'center', flexDirection: 'row' }}>
<AwesomeButton <AwesomeButton
backgroundColor={Colors.yellowBasic} backgroundColor={Colors.yellowBasic}
...@@ -398,6 +422,7 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -398,6 +422,7 @@ export default class sampleMenuPenerimaan3 extends Component {
> >
<Text style={{ color: 'black', fontWeight: '700' }}>Batal</Text> <Text style={{ color: 'black', fontWeight: '700' }}>Batal</Text>
</AwesomeButton> </AwesomeButton>
<AwesomeButton <AwesomeButton
backgroundColor={Colors.yellowBasic} backgroundColor={Colors.yellowBasic}
backgroundShadow={'#DBDBDB'} backgroundShadow={'#DBDBDB'}
...@@ -420,6 +445,8 @@ export default class sampleMenuPenerimaan3 extends Component { ...@@ -420,6 +445,8 @@ export default class sampleMenuPenerimaan3 extends Component {
<Text style={{ color: 'black', fontWeight: '700' }}>Terima</Text> <Text style={{ color: 'black', fontWeight: '700' }}>Terima</Text>
</AwesomeButton> </AwesomeButton>
</View> </View>
}
</Container> </Container>
) )
} }
......
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