Commit 7e120a1c by Giang Tran

merge code

parent bdfbad02
...@@ -5,7 +5,7 @@ import HeaderBack from '../../../components/Header/HeaderBack'; ...@@ -5,7 +5,7 @@ import HeaderBack from '../../../components/Header/HeaderBack';
import Item from './Item'; import Item from './Item';
import {getListMethod} from '../../../apis/Functions/Deposit'; import {getListMethod} from '../../../apis/Functions/Deposit';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import I18n from '../../../helper/i18/i18n';
const MethodPayView = (props) => { const MethodPayView = (props) => {
const [data, setData] = useState([]); const [data, setData] = useState([]);
...@@ -20,7 +20,7 @@ const MethodPayView = (props) => { ...@@ -20,7 +20,7 @@ const MethodPayView = (props) => {
if (res.data.code == 200 && res.data.data) { if (res.data.code == 200 && res.data.data) {
setData(res.data.data); setData(res.data.data);
} else { } else {
alert('Không lấy được danh sách phương thức!'); Alert.alert(I18n.t('Notification'), I18n.t(''));
} }
}; };
......
import React, {useState,useEffect} from 'react'; import React, {useState, useEffect} from 'react';
import { import {
Text, Text,
View, View,
...@@ -8,6 +8,8 @@ import { ...@@ -8,6 +8,8 @@ import {
StyleSheet, StyleSheet,
TextInput, TextInput,
ActivityIndicator, ActivityIndicator,
SafeAreaView,
StatusBar,
} from 'react-native'; } from 'react-native';
import _ from 'lodash'; import _ from 'lodash';
import AntDesign from 'react-native-vector-icons/AntDesign'; import AntDesign from 'react-native-vector-icons/AntDesign';
...@@ -23,14 +25,14 @@ import I18n from '../../helper/i18/i18n'; ...@@ -23,14 +25,14 @@ import I18n from '../../helper/i18/i18n';
import ItemBank from './ItemBank'; import ItemBank from './ItemBank';
const SelectBankModal = (props) => { const SelectBankModal = (props) => {
console.log(props) console.log(props);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [valueSearch, setValueSearch] = useState(''); const [valueSearch, setValueSearch] = useState('');
const [result, setResult] = useState(props.data); const [result, setResult] = useState(props.data);
const [keySearch, setKeySearch] = useState(''); const [keySearch, setKeySearch] = useState('');
useEffect(()=>{ useEffect(() => {
setResult(props.data) setResult(props.data);
},[props.data]) }, [props.data]);
const localFilter = (data, allowFields = [], search_text) => { const localFilter = (data, allowFields = [], search_text) => {
if (!data) return []; if (!data) return [];
if (!search_text || search_text === '') return data; if (!search_text || search_text === '') return data;
...@@ -58,15 +60,12 @@ const SelectBankModal = (props) => { ...@@ -58,15 +60,12 @@ const SelectBankModal = (props) => {
}; };
const _onSearch = async (keySearch) => { const _onSearch = async (keySearch) => {
const data = props.data const data = props.data
? localFilter(props.data, ['code', 'name'], keySearch) ? localFilter(props.data, ['code', 'name'], keySearch).map((x) => ({
.map(
(x) => ({
id: x.id, id: x.id,
code: x.code, code: x.code,
name: x.name, name: x.name,
logo: x.logo, logo: x.logo,
}) }))
)
: []; : [];
// remove duplicate // remove duplicate
...@@ -78,8 +77,8 @@ const SelectBankModal = (props) => { ...@@ -78,8 +77,8 @@ const SelectBankModal = (props) => {
setResult(result); setResult(result);
}; };
const _onPressItem = (item) => { const _onPressItem = (item) => {
console.log('_onPressItem', item) console.log('_onPressItem', item);
props.onPressItem(item) props.onPressItem(item);
setValueSearch(item ? item.name : ''); setValueSearch(item ? item.name : '');
setModalVisible(false); setModalVisible(false);
}; };
...@@ -130,12 +129,11 @@ const SelectBankModal = (props) => { ...@@ -130,12 +129,11 @@ const SelectBankModal = (props) => {
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
<Modal <Modal
animated={true} animated={true}
animationType="fade" animationType="fade"
visible={modalVisible} visible={modalVisible}
transparent={true}> presentationStyle="pageSheet">
<View style={styles.overViewModal}> <View style={styles.overViewModal}>
<View style={[styles.container]}> <View style={[styles.container]}>
<View style={styles.viewTitle}> <View style={styles.viewTitle}>
...@@ -178,16 +176,14 @@ const SelectBankModal = (props) => { ...@@ -178,16 +176,14 @@ const SelectBankModal = (props) => {
renderItem={({item, index}) => ( renderItem={({item, index}) => (
<ItemBank <ItemBank
item={item} item={item}
isEndItem = {index == result.length - 1} isEndItem={index == result.length - 1}
onPress={(item) => _onPressItem(item)} onPress={(item) => _onPressItem(item)}
/> />
)} )}
/> />
</View> </View>
) : ( ) : (
<Text style={styles.txtEmpty}> <Text style={styles.txtEmpty}>{I18n.t('NullDataSearch')}</Text>
{I18n.t('NullDataSearch')}
</Text>
)} )}
</View> </View>
</View> </View>
...@@ -239,7 +235,7 @@ const styles = StyleSheet.create({ ...@@ -239,7 +235,7 @@ const styles = StyleSheet.create({
}, },
flatlist: { flatlist: {
width: getWidth(), width: getWidth(),
marginBottom: HEIGHTXD(300) marginBottom: HEIGHTXD(250),
}, },
input: { input: {
height: WIDTHXD(99), height: WIDTHXD(99),
...@@ -288,10 +284,11 @@ const styles = StyleSheet.create({ ...@@ -288,10 +284,11 @@ const styles = StyleSheet.create({
paddingHorizontal: WIDTHXD(24), paddingHorizontal: WIDTHXD(24),
}, },
overViewModal: { overViewModal: {
flex: 1, height: '100%',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#rgba(0,0,0,0.7)', backgroundColor: '#rgba(0,0,0,0.7)',
margin: 0,
}, },
btClose: { btClose: {
alignSelf: 'center', alignSelf: 'center',
......
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