-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
ReportView.js
54 lines (46 loc) · 1.56 KB
/
ReportView.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
import React from 'react';
import {Keyboard, View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import ReportActionsView from './ReportActionsView';
import ReportActionCompose from './ReportActionCompose';
import {addAction} from '../../../libs/actions/Report';
import KeyboardSpacer from '../../../components/KeyboardSpacer';
import styles from '../../../styles/styles';
import SwipeableView from '../../../components/SwipeableView';
import ONYXKEYS from '../../../ONYXKEYS';
const propTypes = {
/** The ID of the report the selected report */
reportID: PropTypes.number.isRequired,
/* Onyx Keys */
/** Whether or not to show the Compose Input */
session: PropTypes.shape({
shouldShowComposeInput: PropTypes.bool,
}),
};
const defaultProps = {
session: {
shouldShowComposeInput: true,
},
};
const ReportView = ({reportID, session}) => (
<View key={reportID} style={[styles.flex1, styles.justifyContentEnd]}>
<ReportActionsView reportID={reportID} />
{session.shouldShowComposeInput && (
<SwipeableView onSwipeDown={() => Keyboard.dismiss()}>
<ReportActionCompose
onSubmit={text => addAction(reportID, text)}
reportID={reportID}
/>
</SwipeableView>
)}
<KeyboardSpacer />
</View>
);
ReportView.propTypes = propTypes;
ReportView.defaultProps = defaultProps;
export default withOnyx({
session: {
key: ONYXKEYS.SESSION,
},
})(ReportView);