-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
members, avatar, rename report, settings, default view for other reports
- Loading branch information
Showing
22 changed files
with
1,131 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type InviteMembersToGroupChat = { | ||
reportID: string; | ||
inviteeEmails: string[]; | ||
}; | ||
|
||
export default InviteMembersToGroupChat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import type {StackScreenProps} from '@react-navigation/stack'; | ||
import React, {useCallback} from 'react'; | ||
import {Keyboard} from 'react-native'; | ||
import FormProvider from '@components/Form/FormProvider'; | ||
import InputWrapper from '@components/Form/InputWrapper'; | ||
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import TextInput from '@components/TextInput'; | ||
import useAutoFocusInput from '@hooks/useAutoFocusInput'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import * as ValidationUtils from '@libs/ValidationUtils'; | ||
import type {NewChatNavigatorParamList} from '@navigation/types'; | ||
import * as Report from '@userActions/Report'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
import type SCREENS from '@src/SCREENS'; | ||
import INPUT_IDS from '@src/types/form/NewChatNameForm'; | ||
|
||
type GroupChatNameEditPageProps = StackScreenProps<NewChatNavigatorParamList, typeof SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME>; | ||
|
||
function GroupChatNameEditPage({route}: GroupChatNameEditPageProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const {inputCallbackRef} = useAutoFocusInput(); | ||
const currentChatName = decodeURIComponent(route.params.chatName); | ||
const validate = useCallback((values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM>) => { | ||
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM> = {}; | ||
const chatName = values.newChatName.trim(); | ||
if (!ValidationUtils.isRequiredFulfilled(chatName)) { | ||
errors.newChatName = 'groupConfirmPage.editName.nameRequiredError'; | ||
} | ||
return errors; | ||
}, []); | ||
|
||
const editName = useCallback((values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM>) => { | ||
Report.setGroupDraft(undefined, values[INPUT_IDS.NEW_CHAT_NAME]); | ||
Keyboard.dismiss(); | ||
Navigation.goBack(ROUTES.NEW_CHAT_CONFIRM); | ||
}, []); | ||
|
||
return ( | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom={false} | ||
style={[styles.defaultModalContainer]} | ||
testID={GroupChatNameEditPage.displayName} | ||
shouldEnableMaxHeight | ||
> | ||
<HeaderWithBackButton | ||
title={translate('groupConfirmPage.groupName')} | ||
onBackButtonPress={Navigation.goBack} | ||
/> | ||
<FormProvider | ||
formID={ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM} | ||
onSubmit={editName} | ||
submitButtonText={translate('common.save')} | ||
validate={validate} | ||
style={[styles.mh5, styles.flex1]} | ||
enabledWhenOffline | ||
> | ||
<InputWrapper | ||
InputComponent={TextInput} | ||
maxLength={CONST.TAG_NAME_LIMIT} | ||
defaultValue={currentChatName} | ||
label={translate('common.name')} | ||
accessibilityLabel={translate('common.name')} | ||
inputID={INPUT_IDS.NEW_CHAT_NAME} | ||
role={CONST.ROLE.PRESENTATION} | ||
ref={inputCallbackRef} | ||
/> | ||
</FormProvider> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
GroupChatNameEditPage.displayName = 'GroupChatNameEditPage'; | ||
|
||
export default GroupChatNameEditPage; |
Oops, something went wrong.