-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
IOUModal.js
75 lines (65 loc) · 1.96 KB
/
IOUModal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Text from 'react-native';
import {withOnyx} from 'react-native-onyx';
import CONST from '../../CONST';
import themeColors from '../../styles/themes/default';
import ONYXKEYS from '../../ONYXKEYS';
import Modal from '../../components/Modal';
import {redirectToLastReport} from '../../libs/actions/App';
import Avatar from '../../components/Avatar';
/**
* IOU modal for requesting money and splitting bills.
*/
const propTypes = {
// Route constant to show modal
route: PropTypes.string,
/* Onyx Props */
// Url currently in view
currentURL: PropTypes.string,
};
const StepType = {
IOUAmount: 'IOUAmount',
IOUParticipants: 'IOUParticipants',
IOUCOnfirm: 'IOUCOnfirm',
};
const defaultProps = {
route: '',
currentURL: '',
};
class IOUModal extends Component {
constructor(props) {
super(props);
this.state = {
step: StepType.IOUAmount,
};
}
render() {
return (
<Modal
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED}
onClose={redirectToLastReport}
isVisible={this.props.currentURL === this.props.route}
backgroundColor={themeColors.componentBG}
>
{
this.state.step === StepType.IOUAmount ? <Avatar source={'https://http.cat/101'} /> : null
}
{
this.state.step === StepType.IOUParticipants ? <Avatar source={'https://http.cat/102'} /> : null
}
{
this.state.step === StepType.IOUCOnfirm ? <Avatar source={'https://http.cat/103'} /> : null
}
</Modal>
);
}
}
IOUModal.propTypes = propTypes;
IOUModal.defaultProps = defaultProps;
IOUModal.displayName = 'IOUModal';
export default withOnyx({
currentURL: {
key: ONYXKEYS.CURRENT_URL,
},
})(IOUModal);