Commit a7c661dd by Giang Tran

upload image on android

parent d29b6433
...@@ -30,20 +30,5 @@ const mapStateToProps = (state) => { ...@@ -30,20 +30,5 @@ const mapStateToProps = (state) => {
loadingModal: state.ModalLoadingReducer, loadingModal: state.ModalLoadingReducer,
}; };
}; };
const styles = StyleSheet.create({
container: {
height: HEIGHT(65),
paddingHorizontal: 10,
flexDirection: 'row',
paddingTop: 15,
backgroundColor: R.colors.red,
},
img: {
height: HEIGHTXD(788),
width: '100%',
justifyContent: 'center',
},
});
export default connect(mapStateToProps, {})(RootView); export default connect(mapStateToProps, {})(RootView);
...@@ -19,6 +19,9 @@ import R from '../../../assets/R'; ...@@ -19,6 +19,9 @@ import R from '../../../assets/R';
import Button from '../../../components/Button'; import Button from '../../../components/Button';
import PickerItem from '../../../components/Picker/PickerItem'; import PickerItem from '../../../components/Picker/PickerItem';
import {verifyAccountApi} from '../../../apis/Functions/users'; import {verifyAccountApi} from '../../../apis/Functions/users';
import {connect} from 'react-redux';
import {showLoading, hideLoading} from '../../../actions/loadingAction';
const {width} = Dimensions.get('window'); const {width} = Dimensions.get('window');
const dataType = [ const dataType = [
{ {
...@@ -32,13 +35,12 @@ const dataType = [ ...@@ -32,13 +35,12 @@ const dataType = [
]; ];
const BankInfor = (props) => { const BankInfor = (props) => {
const [type, setType] = useState(); const [acc_type, setAccType] = useState();
const [acc_type, setAccType] = useState(''); const [bank_no, setBackNo] = useState('');
const [account_no, setAccountNo] = useState(''); const [account_no, setAccountNo] = useState('');
const createFormData = (identity_after, identity_before, sign_img, body) => { const createFormData = (identity_after, identity_before, sign_img, body) => {
const data = new FormData(); const data = new FormData();
console.log(identity_after);
data.append('identity_after', { data.append('identity_after', {
name: 'identity_after.jpg', name: 'identity_after.jpg',
...@@ -73,7 +75,7 @@ const BankInfor = (props) => { ...@@ -73,7 +75,7 @@ const BankInfor = (props) => {
const onPress = async () => { const onPress = async () => {
const titles = ['loại thẻ', 'mã ngân hàng', 'số thẻ/tài khoản']; const titles = ['loại thẻ', 'mã ngân hàng', 'số thẻ/tài khoản'];
const index = checkFormatArray([type, acc_type, account_no]); const index = checkFormatArray([acc_type, bank_no, account_no]);
console.log(props.route.params.body); console.log(props.route.params.body);
if (index === true) { if (index === true) {
const data = createFormData( const data = createFormData(
...@@ -81,10 +83,10 @@ const BankInfor = (props) => { ...@@ -81,10 +83,10 @@ const BankInfor = (props) => {
props.route.params.img.urlFont, props.route.params.img.urlFont,
props.route.params.img.urlSign, props.route.params.img.urlSign,
{ {
uid: 17, uid: props.user.uid,
acc_type: 0, acc_type: 0,
account_no: '123465789', bank_no,
bank_no: '970423', account_no,
...props.route.params.body, ...props.route.params.body,
}, },
); );
...@@ -119,13 +121,13 @@ const BankInfor = (props) => { ...@@ -119,13 +121,13 @@ const BankInfor = (props) => {
width={width - 20} width={width - 20}
data={dataType} data={dataType}
onValueChange={(value, items) => { onValueChange={(value, items) => {
setType(items); setAccType(items);
}} }}
/> />
<TextField <TextField
isNumber={true} isNumber={true}
title={'Mã ngân hàng'} title={'Mã ngân hàng'}
onChangeText={(val) => setAccType(val)} onChangeText={(val) => setBackNo(val)}
/> />
<TextField <TextField
title={'Số thẻ/tài khoản'} title={'Số thẻ/tài khoản'}
...@@ -149,4 +151,9 @@ const styles = StyleSheet.create({ ...@@ -149,4 +151,9 @@ const styles = StyleSheet.create({
}, },
}); });
export default BankInfor; const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {showLoading, hideLoading})(BankInfor);
...@@ -4,7 +4,6 @@ import {connect} from 'react-redux'; ...@@ -4,7 +4,6 @@ import {connect} from 'react-redux';
import HomeView from './HomeView'; import HomeView from './HomeView';
const Home = (props) => { const Home = (props) => {
console.log('Information in home', props.user);
return <HomeView />; return <HomeView />;
}; };
......
...@@ -103,7 +103,7 @@ export async function PostFormData(url, data) { ...@@ -103,7 +103,7 @@ export async function PostFormData(url, data) {
.then((response) => response) .then((response) => response)
.then((response) => response) .then((response) => response)
.catch((error) => { .catch((error) => {
console.log(error.request); console.log(error);
const err = { const err = {
message: 'error', message: 'error',
status: error.request.status, status: error.request.status,
......
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