-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathEditRequestDescriptionPage.js
59 lines (53 loc) · 2.2 KB
/
EditRequestDescriptionPage.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
import React, {useRef} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import TextInput from '../components/TextInput';
import withLocalize, {withLocalizePropTypes} from '../components/withLocalize';
import ScreenWrapper from '../components/ScreenWrapper';
import HeaderWithBackButton from '../components/HeaderWithBackButton';
import Form from '../components/Form';
import ONYXKEYS from '../ONYXKEYS';
import styles from '../styles/styles';
import Navigation from '../libs/Navigation/Navigation';
const propTypes = {
...withLocalizePropTypes,
/** Transaction description default value */
defaultDescription: PropTypes.string.isRequired,
/** Callback to fire when the Save button is pressed */
onSubmit: PropTypes.func.isRequired,
};
function EditRequestDescriptionPage(props) {
const descriptionInputRef = useRef(null);
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
onEntryTransitionEnd={() => descriptionInputRef.current && descriptionInputRef.current.focus()}
>
<HeaderWithBackButton
title={props.translate('common.description')}
onBackButtonPress={() => Navigation.goBack()}
/>
<Form
style={[styles.flexGrow1, styles.ph5]}
formID={ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM}
onSubmit={props.onSubmit}
submitButtonText={props.translate('common.save')}
enabledWhenOffline
>
<View style={styles.mb4}>
<TextInput
inputID="modifiedComment"
name="modifiedComment"
defaultValue={props.defaultDescription}
label={props.translate('moneyRequestConfirmationList.whatsItFor')}
ref={descriptionInputRef}
/>
</View>
</Form>
</ScreenWrapper>
);
}
EditRequestDescriptionPage.propTypes = propTypes;
EditRequestDescriptionPage.displayName = 'EditRequestDescriptionPage';
export default withLocalize(EditRequestDescriptionPage);