Commit 7e120a1c by Giang Tran

merge code

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