Commit 50c0c1d5 authored by didam's avatar didam

didam

parent 0fb3b39d
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container, Text } from 'native-base'; import { Container, Text } from 'native-base';
import { View, ScrollView } from 'react-native'; import { View, ScrollView, BackHandler } from 'react-native';
import M from 'moment' import M from 'moment'
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'
...@@ -84,8 +84,18 @@ class History extends Component { ...@@ -84,8 +84,18 @@ class History extends Component {
this.setState({ dataLoad: true, loading: false }) this.setState({ dataLoad: true, loading: false })
}, 2000); }, 2000);
this.getHistory() this.getHistory()
BackHandler.addEventListener("hardwareBackPress", this.onBackPressed);
} }
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.onBackPressed);
}
onBackPressed = () => {
this.props.navigation.goBack();
return true;
};
getHistory() { getHistory() {
api.create().getHistory().then((response) => { api.create().getHistory().then((response) => {
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, ScrollView, TouchableOpacity } from 'react-native' import { Text, View, ScrollView, TouchableOpacity, BackHandler } 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'
...@@ -24,8 +24,19 @@ export default class Appraisal extends Component { ...@@ -24,8 +24,19 @@ export default class Appraisal extends Component {
componentDidMount() { componentDidMount() {
this.getListAppraisal() this.getListAppraisal()
} BackHandler.addEventListener("hardwareBackPress", this.onBackPressed);
// AsyncStorage.setItem(Constant.TOKEN, 'keisiiii')
}
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.onBackPressed);
}
onBackPressed = () => {
this.props.navigation.goBack()
return true;
};
getListAppraisal() { getListAppraisal() {
this.setState({ loading: true }) this.setState({ loading: true })
// alert(this.props.navigation.state.params.data.value) // alert(this.props.navigation.state.params.data.value)
...@@ -43,6 +54,8 @@ export default class Appraisal extends Component { ...@@ -43,6 +54,8 @@ export default class Appraisal extends Component {
this.setState({ loading: false }) this.setState({ loading: false })
}, 500); }, 500);
}) })
} else {
this.setState({ loading: false })
} }
}) })
} }
...@@ -53,7 +66,11 @@ export default class Appraisal extends Component { ...@@ -53,7 +66,11 @@ export default class Appraisal extends Component {
<NavigationEvents <NavigationEvents
onDidFocus={() => this.getListAppraisal()} onDidFocus={() => this.getListAppraisal()}
/> />
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} > {this.state.listData.length == 0 &&
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>}
{this.state.listData.length > 0 && <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
...@@ -98,7 +115,7 @@ export default class Appraisal extends Component { ...@@ -98,7 +115,7 @@ export default class Appraisal extends Component {
) )
})} })}
</ScrollView> </ScrollView>}
</Container> </Container>
) )
} }
......
...@@ -64,6 +64,8 @@ export default class Approval extends Component { ...@@ -64,6 +64,8 @@ export default class Approval extends Component {
this.setState({ loading: false }) this.setState({ loading: false })
}, 500); }, 500);
}) })
} else {
this.setState({ loading: false })
} }
}) })
} }
...@@ -122,7 +124,11 @@ export default class Approval extends Component { ...@@ -122,7 +124,11 @@ export default class Approval extends Component {
/> />
<Text style={{marginLeft: -10}}> Select All</Text> <Text style={{marginLeft: -10}}> Select All</Text>
</TouchableOpacity>} </TouchableOpacity>}
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: this.state.longPress? 0 : 10 }} showsVerticalScrollIndicator={false} > {this.state.listData.length == 0 &&
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>}
{this.state.listData.length > 0 && <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: this.state.longPress? 0 : 10 }} showsVerticalScrollIndicator={false} >
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
...@@ -178,7 +184,7 @@ export default class Approval extends Component { ...@@ -178,7 +184,7 @@ export default class Approval extends Component {
</View> </View>
) )
})} })}
</ScrollView> </ScrollView>}
{this.state.longPress && <View style={{width: '100%', paddingHorizontal: 50, paddingBottom: 10, backgroundColor:"#f5f5f5", alignItems:'center', justifyContent: 'center',}}> {this.state.longPress && <View style={{width: '100%', paddingHorizontal: 50, paddingBottom: 10, backgroundColor:"#f5f5f5", alignItems:'center', justifyContent: 'center',}}>
<AwesomeButton <AwesomeButton
width={'100%'} raiseLevel={3} springRelease={true} type="primary" width={'100%'} raiseLevel={3} springRelease={true} type="primary"
......
...@@ -197,6 +197,7 @@ class HomePageScreen extends Component { ...@@ -197,6 +197,7 @@ class HomePageScreen extends Component {
</View> </View>
</View> </View>
</Modal> </Modal>
<ScrollView style={{flex: 1}}> <ScrollView style={{flex: 1}}>
<ImageBackground source={Images.background2} style={{width: '100%', height: 200, justifyContent:'center'}}> <ImageBackground source={Images.background2} style={{width: '100%', height: 200, justifyContent:'center'}}>
<View style={{ alignItems: 'center', justifyContent: 'flex-end', flex: 1}}> <View style={{ alignItems: 'center', justifyContent: 'flex-end', flex: 1}}>
...@@ -247,12 +248,12 @@ class HomePageScreen extends Component { ...@@ -247,12 +248,12 @@ class HomePageScreen extends Component {
<FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/> */} <FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/> */}
</View> </View>
</ImageBackground> </ImageBackground>
<View style={{padding: 10, paddingVertical: 20, flexDirection: 'row', width:'100%'}}> <View style={{padding: 10, paddingVertical: 20, flexDirection: 'row', width:'100%', justifyContent: 'space-evenly',}}>
{this.state.data.map((item,index) => { {this.state.data.map((item,index) => {
var itemVis = item == 'Penerimaan'? this.state.visAccepted : item == 'Appraisal'? this.state.visAppraisal : this.state.visApproved var itemVis = item == 'Penerimaan'? this.state.visAccepted : item == 'Appraisal'? this.state.visAppraisal : this.state.visApproved
return ( return (
itemVis && <TouchableOpacity onPress={() => this.handleNav(item)} key={index} activeOpacity={.5}> itemVis && <TouchableOpacity onPress={() => this.handleNav(item)} key={index} activeOpacity={.5} style={{width: '30%', height: 125}}>
<Image source={item == 'Penerimaan'? Images.IconPenerimaan : item == 'Appraisal'? Images.IconAppraisal : Images.IconApproval} style={{width: 125, height: 125, marginLeft: 0}}/> <Image source={item == 'Penerimaan'? Images.IconPenerimaan : item == 'Appraisal'? Images.IconAppraisal : Images.IconApproval} style={{width: '100%', height: '100%', marginLeft: 0}}/>
</TouchableOpacity> </TouchableOpacity>
) )
})} })}
......
import React, { Component } from 'react' import React, { Component } from 'react'
import { Text, View, ScrollView, TouchableOpacity } from 'react-native' import { Text, View, ScrollView, TouchableOpacity, BackHandler} from 'react-native'
import { Container, Fab, Icon } from 'native-base' import { Container, Fab, Icon } from 'native-base'
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'
...@@ -23,8 +23,18 @@ export default class Penerimaan extends Component { ...@@ -23,8 +23,18 @@ export default class Penerimaan extends Component {
componentDidMount() { componentDidMount() {
this.getListData() this.getListData()
// alert(JSON.stringify(this.props)) // alert(JSON.stringify(this.props))
BackHandler.addEventListener("hardwareBackPress", this.onBackPressed);
} }
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.onBackPressed);
}
onBackPressed = () => {
this.props.navigation.goBack()
return true;
};
getListData() { getListData() {
api.create().getListClar({ api.create().getListClar({
warehouse_id: Number(this.props.navigation.state.params.data.value) warehouse_id: Number(this.props.navigation.state.params.data.value)
...@@ -48,7 +58,11 @@ export default class Penerimaan extends Component { ...@@ -48,7 +58,11 @@ export default class Penerimaan extends Component {
<NavigationEvents <NavigationEvents
onDidFocus={() => this.getListData()} onDidFocus={() => this.getListData()}
/> />
<ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} > {this.state.listClar.length == 0 &&
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text style={{fontStyle: 'italic'}}>No data found ...</Text>
</View>}
{this.state.listClar.length > 0 && <ScrollView style={{ paddingHorizontal: 20, backgroundColor: '#F5F5F5', paddingTop: 10 }} showsVerticalScrollIndicator={false} >
{this.state.listClar.map((item, index) => { {this.state.listClar.map((item, index) => {
return ( return (
<View key={index} style={{ paddingHorizontal: 7 }}> <View key={index} style={{ paddingHorizontal: 7 }}>
...@@ -91,7 +105,7 @@ export default class Penerimaan extends Component { ...@@ -91,7 +105,7 @@ export default class Penerimaan extends Component {
) )
})} })}
</ScrollView> </ScrollView>}
<Fab <Fab
active={true} active={true}
direction="up" direction="up"
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container } from 'native-base'; import { Container } from 'native-base';
import { View, Text, ScrollView, Image } from 'react-native'; import { View, Text, ScrollView, Image, BackHandler } from 'react-native';
import Images from '../../library/images'; import Images from '../../library/images';
class Notif extends Component { class Notif extends Component {
...@@ -27,6 +27,19 @@ class Notif extends Component { ...@@ -27,6 +27,19 @@ class Notif extends Component {
] ]
} }
} }
componentDidMount() {
BackHandler.addEventListener("hardwareBackPress", this.onBackPressed);
}
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.onBackPressed);
}
onBackPressed = () => {
this.props.navigation.goBack();
return true;
};
render() { render() {
return ( return (
<Container> <Container>
......
...@@ -4,7 +4,7 @@ import LinearGradient from 'react-native-linear-gradient'; ...@@ -4,7 +4,7 @@ import LinearGradient from 'react-native-linear-gradient';
import Colors from '../../library/colors'; import Colors from '../../library/colors';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5' import FontAwesome5 from 'react-native-vector-icons/FontAwesome5'
import MaterialIcons from 'react-native-vector-icons/MaterialIcons' import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
import { Image, Keyboard } from 'react-native'; import { Image, Keyboard, BackHandler } from 'react-native';
import Images from '../../library/images'; import Images from '../../library/images';
import AwesomeButton from 'react-native-really-awesome-button'; import AwesomeButton from 'react-native-really-awesome-button';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
...@@ -25,8 +25,18 @@ class Profile extends Component { ...@@ -25,8 +25,18 @@ class Profile extends Component {
componentDidMount() { componentDidMount() {
this.getToken() this.getToken()
BackHandler.addEventListener("hardwareBackPress", this.onBackPressed);
} }
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.onBackPressed);
}
onBackPressed = () => {
this.props.navigation.goBack();
return true;
};
navigateToLogin(next) { navigateToLogin(next) {
next() next()
AsyncStorage.clear(() => { AsyncStorage.clear(() => {
......
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