ilink-world/screens/wallet/PaiementFacture.js

139 lines
4.6 KiB
JavaScript
Raw Normal View History

2020-11-18 11:22:53 +00:00
import React, {Component} from 'react';
import {StatusBar, StyleSheet, View} from 'react-native';
2020-06-18 05:38:10 +00:00
import I18n from 'react-native-i18n';
2020-11-18 11:22:53 +00:00
import {Appbar, Provider} from 'react-native-paper';
2020-06-18 05:38:10 +00:00
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
2020-11-18 11:22:53 +00:00
import {Color} from '../../config/Color';
import {IlinkEmitter} from "../../utils/events";
2020-06-18 05:38:10 +00:00
import OutlineTextInput from '../../components/OutlineTextInput';
import CustomButton from '../../components/CustomButton';
2020-11-18 11:22:53 +00:00
import {ScrollView} from 'react-native-gesture-handler';
2020-06-18 05:38:10 +00:00
const route = require('../../route.json');
let slugify = require('slugify');
export default class PaiementFacture extends Component {
2020-11-18 11:22:53 +00:00
constructor(props) {
super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = {
title: this.props.navigation.state.params.title,
type: this.props.navigation.state.params.type,
}
console.log("Paiement facture props", this.props);
}
updateLangue() {
this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate();
}
static navigationOptions = ({navigation}) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({tintColor}) => (
<Icon
name={'credit-card'}
size={24}
/>)
});
renderLabel = () => {
const {type} = this.state;
switch (type) {
case 'PAIEMENT_ECOLE':
return I18n.t('IDENTIFIANT_ETUDIANT')
case 'PAIEMENT_EAU':
return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_ELECTRICITE':
return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_CREDIT_TELEPHONE':
return I18n.t('PHONE_NUMBER')
case 'PAIEMENT_ABONNEMENT_TV':
return I18n.t('NUMERO_ABONNE')
default:
break;
}
}
render() {
return (
<Provider>
<View style={{flex: 1}}>
<StatusBar
backgroundColor={Color.primaryDarkColor}
barStyle="light-content"
translucent={false}
/>
<Appbar.Header dark={true} style={{backgroundColor: Color.primaryColor}}>
<Appbar.BackAction
onPress={() => {
this.props.navigation.pop()
}}
/>
<Appbar.Content
title={this.state.title}
/>
</Appbar.Header>
<View style={styles.container}>
<ScrollView style={{padding: 20}}>
<View style={{marginTop: 10, marginRight: 20, marginLeft: 20}}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={this.renderLabel()}
style={{marginTop: 10}}
placeholder={this.renderLabel()}
/>
</View>
<View style={{marginTop: 10, marginRight: 20, marginLeft: 20, marginBottom: 10}}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={I18n.t('AMOUNT')}
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')}
/>
</View>
<View style={{margin: 10}}>
<CustomButton outline onPress={() => {
}}>
{I18n.t('VALIDATE')}
</CustomButton>
</View>
</ScrollView>
2020-06-18 05:38:10 +00:00
</View>
2020-11-18 11:22:53 +00:00
</View>
</Provider>
);
}
2020-06-18 05:38:10 +00:00
}
const styles = StyleSheet.create({
2020-11-18 11:22:53 +00:00
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor
},
2020-06-18 05:38:10 +00:00
});