From 18c44178d742ab29f287d9435d28448c65e3a34c Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:03:24 -0300 Subject: [PATCH] [IMPROVE] Migrate away from react-native-prompt-android to action sheet (#4300) * Chore: Migrate away from react-native-prompt-android to action sheet * fix header provile view with action sheet * finished change password * Close livechat and removed closeRoom dispatch * remove lib react-native-prompt-android * fix right buttons * fix profile view in tablets * fix action and room action for tablets * remove onSubmitEditing * fix keyboard for android tablet in landscape * create base for actionSheet containers * migrate EnterPasswordSheet to base * migrate to base component * fix colors and copy * remove secure entry * fix onSubmit * fix android animation Co-authored-by: GleidsonDaniel --- app/actions/actionsTypes.ts | 1 - app/actions/room.ts | 10 +- .../index.tsx | 137 ++++++++++++++++++ app/containers/ActionSheet/FooterButtons.tsx | 36 ----- app/containers/ActionSheet/styles.ts | 7 - .../containers/CloseLivechatSheet/index.tsx | 24 +++ app/externalModules.d.ts | 1 - app/lib/methods/helpers/closeLivechat.ts | 27 ++++ app/lib/services/restApi.ts | 2 +- app/reducers/room.test.ts | 9 +- app/sagas/room.js | 40 ----- app/stacks/MasterDetailStack/index.tsx | 6 +- .../DeleteAccountActionSheetContent/index.tsx | 100 ++++++------- app/views/ProfileView/index.tsx | 41 +++--- app/views/RoomActionsView/index.tsx | 44 +++++- app/views/RoomView/RightButtons.tsx | 37 ++++- package.json | 1 - yarn.lock | 5 - 18 files changed, 320 insertions(+), 208 deletions(-) create mode 100644 app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx delete mode 100644 app/containers/ActionSheet/FooterButtons.tsx create mode 100644 app/ee/omnichannel/containers/CloseLivechatSheet/index.tsx create mode 100644 app/lib/methods/helpers/closeLivechat.ts diff --git a/app/actions/actionsTypes.ts b/app/actions/actionsTypes.ts index 29c384781..f33c9ec7f 100644 --- a/app/actions/actionsTypes.ts +++ b/app/actions/actionsTypes.ts @@ -27,7 +27,6 @@ export const ROOM = createRequestTypes('ROOM', [ 'LEAVE', 'DELETE', 'REMOVED', - 'CLOSE', 'FORWARD', 'USER_TYPING' ]); diff --git a/app/actions/room.ts b/app/actions/room.ts index f0d5ed81b..168110199 100644 --- a/app/actions/room.ts +++ b/app/actions/room.ts @@ -19,7 +19,6 @@ interface IBaseReturn extends Action { type TSubscribeRoom = IBaseReturn; type TUnsubscribeRoom = IBaseReturn; -type TCloseRoom = IBaseReturn; type TRoom = Record; @@ -45,7 +44,7 @@ interface IUserTyping extends Action { status: boolean; } -export type TActionsRoom = TSubscribeRoom & TUnsubscribeRoom & TCloseRoom & ILeaveRoom & IDeleteRoom & IForwardRoom & IUserTyping; +export type TActionsRoom = TSubscribeRoom & TUnsubscribeRoom & ILeaveRoom & IDeleteRoom & IForwardRoom & IUserTyping; export function subscribeRoom(rid: string): TSubscribeRoom { return { @@ -79,13 +78,6 @@ export function deleteRoom(roomType: ERoomType, room: TRoom, selected?: ISelecte }; } -export function closeRoom(rid: string): TCloseRoom { - return { - type: ROOM.CLOSE, - rid - }; -} - export function forwardRoom(rid: string, transferData: ITransferData): IForwardRoom { return { type: ROOM.FORWARD, diff --git a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx new file mode 100644 index 000000000..95de597f8 --- /dev/null +++ b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx @@ -0,0 +1,137 @@ +import React, { useState } from 'react'; +import { StyleSheet, Text, View } from 'react-native'; + +import { CustomIcon, TIconsName } from '../../CustomIcon'; +import i18n from '../../../i18n'; +import { isIOS } from '../../../lib/methods/helpers'; +import { useTheme } from '../../../theme'; +import sharedStyles from '../../../views/Styles'; +import Button from '../../Button'; +import { FormTextInput } from '../../TextInput/FormTextInput'; +import { useActionSheet } from '../Provider'; + +const styles = StyleSheet.create({ + subtitleText: { + fontSize: 14, + ...sharedStyles.textRegular, + marginBottom: 10 + }, + buttonSeparator: { + marginRight: 8 + }, + footerButtonsContainer: { + flexDirection: 'row', + paddingTop: 16 + }, + titleContainerText: { + fontSize: 16, + ...sharedStyles.textSemibold + }, + titleContainer: { + paddingRight: 80, + marginBottom: 16, + flexDirection: 'row', + alignItems: 'center' + } +}); + +const FooterButtons = ({ + cancelAction = () => {}, + confirmAction = () => {}, + cancelTitle = '', + confirmTitle = '', + disabled = false, + cancelBackgroundColor = '', + confirmBackgroundColor = '' +}): React.ReactElement => { + const { colors } = useTheme(); + return ( + +