207 lines
6.5 KiB
JavaScript
207 lines
6.5 KiB
JavaScript
|
import React, { Component } from 'react';
|
||
|
import { StyleSheet, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native';
|
||
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||
|
const route = require('../../route.json');
|
||
|
let slugify = require('slugify');
|
||
|
import I18n from 'react-native-i18n'
|
||
|
import * as Utils from '../../utils/DeviceUtils';
|
||
|
import { Images } from '../../config/Images';
|
||
|
import { Color } from '../../config/Color';
|
||
|
import { baseUrl } from '../../webservice/IlinkConstants';
|
||
|
import { IlinkEmitter } from "../../utils/events";
|
||
|
import { Provider, Appbar } from 'react-native-paper';
|
||
|
import { readUser } from '../../webservice/AuthApi';
|
||
|
import { FontWeight, Typography } from '../../config/typography';
|
||
|
import LottieView from 'lottie-react-native';
|
||
|
import { isIlinkWorldWallet, optionDepotScreen } from '../../utils/UtilsFunction';
|
||
|
import chunk from 'lodash/chunk';
|
||
|
import { ScrollView } from 'react-native-gesture-handler';
|
||
|
|
||
|
export default class PaiementOptionSelect extends Component {
|
||
|
|
||
|
constructor(props) {
|
||
|
super(props);
|
||
|
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
|
||
|
/* this.state = {
|
||
|
options: this.props.navigation.state.params.optionSelect
|
||
|
} */
|
||
|
|
||
|
}
|
||
|
|
||
|
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}
|
||
|
/>)
|
||
|
});
|
||
|
|
||
|
renderItem = (item) => {
|
||
|
|
||
|
return (
|
||
|
<TouchableOpacity
|
||
|
key={item.id}
|
||
|
style={[styles.paymentItem, { borderBottomColor: Color.borderColor }]}
|
||
|
onPress={() => {
|
||
|
|
||
|
}}>
|
||
|
|
||
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||
|
<View style={styles.iconContent}>
|
||
|
<Image style={{ width: 48, height: 48 }} source={{ uri: item.icon }} />
|
||
|
</View>
|
||
|
<View>
|
||
|
<Text style={Typography.body1}>{item.title}</Text>
|
||
|
<Text style={Typography.footnote}>{item.title}</Text>
|
||
|
</View>
|
||
|
</View>
|
||
|
|
||
|
</TouchableOpacity>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
renderList = () => {
|
||
|
|
||
|
const { optionSelect } = this.props;
|
||
|
|
||
|
return (
|
||
|
<ScrollView style={{ flex: 1, padding: 20 }}>
|
||
|
{
|
||
|
options.map((item) => (
|
||
|
this.renderItem(item)
|
||
|
))
|
||
|
}
|
||
|
</ScrollView>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
|
||
|
console.log("PAIEMENT FACTURE PROPS", this.props);
|
||
|
console.log("PAIEMENT FACTURE GET PARAMS", this.props.navigation.getParam('optionSelect'));
|
||
|
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="Paiement facture"
|
||
|
subtitle="Veuillez sélectionner une option"
|
||
|
/>
|
||
|
</Appbar.Header>
|
||
|
|
||
|
<View style={styles.container}>
|
||
|
|
||
|
{/* {
|
||
|
this.renderList()
|
||
|
} */}
|
||
|
|
||
|
</View>
|
||
|
|
||
|
</View>
|
||
|
</Provider>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
const styles = StyleSheet.create({
|
||
|
container: {
|
||
|
flex: 1,
|
||
|
backgroundColor: Color.containerBackgroundColor,
|
||
|
paddingHorizontal: 20,
|
||
|
},
|
||
|
paymentItem: {
|
||
|
flexDirection: "row",
|
||
|
alignItems: "center",
|
||
|
justifyContent: "space-between",
|
||
|
borderBottomWidth: 1,
|
||
|
paddingVertical: 5,
|
||
|
width: "100%",
|
||
|
marginBottom: 15
|
||
|
},
|
||
|
iconContent: {
|
||
|
width: 60,
|
||
|
marginRight: 10,
|
||
|
alignItems: "center"
|
||
|
},
|
||
|
item: {
|
||
|
paddingVertical: 15,
|
||
|
borderBottomWidth: 1,
|
||
|
flexDirection: "row",
|
||
|
justifyContent: "space-between",
|
||
|
alignItems: "center"
|
||
|
},
|
||
|
lottie: {
|
||
|
width: 540,
|
||
|
height: 240
|
||
|
},
|
||
|
checkDefault: {
|
||
|
flexDirection: "row",
|
||
|
justifyContent: "space-between",
|
||
|
alignItems: "center",
|
||
|
borderBottomWidth: 1,
|
||
|
paddingVertical: 10,
|
||
|
marginTop: 5
|
||
|
},
|
||
|
transactionContainer: {
|
||
|
flexDirection: 'row',
|
||
|
paddingTop: 10,
|
||
|
},
|
||
|
containerTouch: {
|
||
|
flex: 1,
|
||
|
flexDirection: 'row',
|
||
|
alignItems: 'center',
|
||
|
shadowColor: Color.borderColor,
|
||
|
borderColor: Color.borderColor,
|
||
|
borderWidth: 0.5,
|
||
|
shadowOffset: { width: 1.5, height: 1.5 },
|
||
|
shadowOpacity: 1.0,
|
||
|
elevation: 5,
|
||
|
borderRadius: 10,
|
||
|
backgroundColor: Color.cardBackgroundColor
|
||
|
},
|
||
|
|
||
|
contain: {
|
||
|
flexDirection: 'row',
|
||
|
justifyContent: 'space-between',
|
||
|
},
|
||
|
imageBanner: {
|
||
|
marginTop: 15,
|
||
|
marginLeft: 5,
|
||
|
width: Utils.scaleWithPixel(30),
|
||
|
height: Utils.scaleWithPixel(30)
|
||
|
},
|
||
|
content: {
|
||
|
height: Utils.scaleWithPixel(60),
|
||
|
paddingHorizontal: 10,
|
||
|
justifyContent: 'space-between',
|
||
|
alignItems: 'flex-start',
|
||
|
flex: 1,
|
||
|
},
|
||
|
contentTitle: {
|
||
|
paddingTop: 12,
|
||
|
}
|
||
|
|
||
|
});
|