diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7fe34a70e5..11be2c541d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
* Fixed mobile bugs - joining by QR code and not showing username taken screen for user who has unique name
+* Use context menu for information about unregistered username instead screen
+
* Shorter dots-placeholder for invite link
* Removed registration attempts selector and corresponding usage.
diff --git a/packages/mobile/src/App.tsx b/packages/mobile/src/App.tsx
index 49b1e7019d..3b777d1164 100644
--- a/packages/mobile/src/App.tsx
+++ b/packages/mobile/src/App.tsx
@@ -45,10 +45,11 @@ import StoreProvider from './Provider'
import { RootStackParamList } from './route.params'
import ConnectionProcessScreen from './screens/ConnectionProcess/ConnectionProcess.screen'
import { DuplicatedUsernameScreen } from './screens/DuplicatedUsername/DuplicatedUsername.screen'
-import { UnregisteredUsernameScreen } from './screens/UnregisteredUsername/UnregisteredUsername.screen'
+
import UsernameTakenScreen from './screens/UsernameTaken/UsernameTaken.screen'
import NewUsernameRequestedScreen from './screens/NewUsernameRequested/NewUsernameRequested.screen'
import { PossibleImpersonationAttackScreen } from './screens/PossibleImpersonationAttack/PossibleImpersonationAttack.screen'
+import { UnregisteredUsernameContextMenu } from './components/ContextMenu/menus/UnregisteredUsernameContextMenu.container'
LogBox.ignoreAllLogs()
@@ -105,7 +106,6 @@ function App(): JSX.Element {
-
+
diff --git a/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx b/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx
index a62feec289..f90abdfc10 100644
--- a/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx
+++ b/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx
@@ -2,9 +2,9 @@ import React, { FC } from 'react'
import { View, Image, FlatList, TouchableWithoutFeedback, TouchableOpacity, Animated } from 'react-native'
import { Typography } from '../Typography/Typography.component'
import { ContextMenuItemProps, ContextMenuProps } from './ContextMenu.types'
-
import { defaultPalette } from '../../styles/palettes/default.palette'
import { appImages } from '../../assets'
+import { Button } from '../Button/Button.component'
export const ContextMenu: FC = ({
visible,
@@ -16,6 +16,8 @@ export const ContextMenu: FC = ({
linkAction = () => {
console.log('No action attached for link tap gesture.')
},
+ unregisteredUsername,
+ username,
}) => {
const [show, setShow] = React.useState(false)
const slidingAnimation = React.useRef(new Animated.Value(0)).current
@@ -140,24 +142,45 @@ export const ContextMenu: FC = ({
)}
-
- item.title}
- renderItem={({ item, index }) => (
-
-
-
- )}
- style={{ backgroundColor: defaultPalette.background.white }}
- showsVerticalScrollIndicator={false}
- />
-
+
+ {items.length !== 0 && (
+
+ item.title}
+ renderItem={({ item, index }) => (
+
+
+
+ )}
+ style={{ backgroundColor: defaultPalette.background.white }}
+ showsVerticalScrollIndicator={false}
+ />
+
+ )}
+
+ {unregisteredUsername && username && (
+
+
+ The username{' '}
+
+ @{username}
+ {' '}
+ has not been registered yet with the community owner, so it’s still possible for someone else to
+ register the same username. When the community owner is online,{' '}
+
+ @{username}
+ {' '}
+ will be registered automatically and this alert will go away.
+
+
+
+ )}
diff --git a/packages/mobile/src/components/ContextMenu/ContextMenu.types.ts b/packages/mobile/src/components/ContextMenu/ContextMenu.types.ts
index 286de05220..2a768d2a85 100644
--- a/packages/mobile/src/components/ContextMenu/ContextMenu.types.ts
+++ b/packages/mobile/src/components/ContextMenu/ContextMenu.types.ts
@@ -9,9 +9,15 @@ export interface ContextMenuProps {
link?: string
linkAction?: () => void
style?: TextStyle
+ unregisteredUsername?: boolean
+ username?: string
}
export interface ContextMenuItemProps {
title: string
action: () => void
}
+
+export type UnregisteredUsernameArgs = {
+ username: string
+}
diff --git a/packages/mobile/src/components/ContextMenu/menus/UnregisteredUsernameContextMenu.container.tsx b/packages/mobile/src/components/ContextMenu/menus/UnregisteredUsernameContextMenu.container.tsx
new file mode 100644
index 0000000000..ab66b04c86
--- /dev/null
+++ b/packages/mobile/src/components/ContextMenu/menus/UnregisteredUsernameContextMenu.container.tsx
@@ -0,0 +1,20 @@
+import React, { FC } from 'react'
+import { useContextMenu } from '../../../hooks/useContextMenu'
+import { MenuName } from '../../../const/MenuNames.enum'
+import { ContextMenu } from '../ContextMenu.component'
+import { UnregisteredUsernameArgs } from '../ContextMenu.types'
+
+export const UnregisteredUsernameContextMenu: FC = () => {
+ const title = 'Unregistered username'
+ const usernameTakenContextMenu = useContextMenu(MenuName.UnregisteredUsername)
+
+ return (
+
+ )
+}
diff --git a/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.component.tsx b/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.component.tsx
deleted file mode 100644
index 1d2070400c..0000000000
--- a/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.component.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { defaultTheme } from '../../../styles/themes/default.theme'
-import React from 'react'
-import { View } from 'react-native'
-import { Appbar } from '../../Appbar/Appbar.component'
-import { Typography } from '../../Typography/Typography.component'
-import { UnregisteredUsernameComponentProps } from 'packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.types'
-import { Button } from '../../Button/Button.component'
-
-const UnregisteredUsernameComponent: React.FC = ({
- handleBackButton,
- username,
-}) => {
- return (
-
-
-
-
- The username @{username} has not been registered yet with the community owner, so it’s still possible for
- someone else to register the same username. When the community owner is online, @{username} will be registered
- automatically and this alert will go away.
-
-
-
-
- )
-}
-
-export default UnregisteredUsernameComponent
diff --git a/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.test.tsx b/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.test.tsx
deleted file mode 100644
index d0faf82b97..0000000000
--- a/packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.test.tsx
+++ /dev/null
@@ -1,234 +0,0 @@
-import { renderComponent } from '../../../utils/functions/renderComponent/renderComponent'
-import UnregisteredUsernameComponent from './UnregisteredUsername.component'
-
-describe('UnregisteredUsername component', () => {
- it('renders component', () => {
- const { toJSON } = renderComponent(
-
- )
- expect(toJSON()).toMatchInlineSnapshot(`
-
-
-
-
-
-
-
-
-
-
-
- Unregistered username
-
-
-
-
-
-
- The username @
- johnny
- has not been registered yet with the community owner, so it’s still possible for someone else to register the same username. When the community owner is online, @
- johnny
- will be registered automatically and this alert will go away.
-
-
-
- OK
-
-
-
-
- `)
- })
-})
diff --git a/packages/mobile/src/const/MenuNames.enum.ts b/packages/mobile/src/const/MenuNames.enum.ts
index c3785667ec..755f8baa62 100644
--- a/packages/mobile/src/const/MenuNames.enum.ts
+++ b/packages/mobile/src/const/MenuNames.enum.ts
@@ -2,4 +2,5 @@ export enum MenuName {
Community = 'CommunityContextMenu',
Channel = 'ChannelContextMenu',
Invitation = 'InvitationContextMenu',
+ UnregisteredUsername = 'UnregisteredUsernameContextMenu',
}
diff --git a/packages/mobile/src/const/ScreenNames.enum.ts b/packages/mobile/src/const/ScreenNames.enum.ts
index a247293844..bbd8b358c6 100644
--- a/packages/mobile/src/const/ScreenNames.enum.ts
+++ b/packages/mobile/src/const/ScreenNames.enum.ts
@@ -13,7 +13,6 @@ export enum ScreenNames {
LeaveCommunityScreen = 'LeaveCommunityScreen',
ConnectionProcessScreen = 'ConnectionProcessScreen',
DuplicatedUsernameScreen = 'DuplicatedUsernameScreen',
- UnregisteredUsernameScreen = 'UnregisteredUsernameScreen',
UsernameTakenScreen = 'UsernameTakenScreen',
NewUsernameRequestedScreen = 'NewUsernameRequestedScreen',
PossibleImpersonationAttackScreen = 'PossibleImpersonationAttackScreen',
diff --git a/packages/mobile/src/route.params.ts b/packages/mobile/src/route.params.ts
index 8221547080..d61c85522e 100644
--- a/packages/mobile/src/route.params.ts
+++ b/packages/mobile/src/route.params.ts
@@ -37,9 +37,7 @@ export type RootStackParamList = {
}
[ScreenNames.ConnectionProcessScreen]: undefined
[ScreenNames.DuplicatedUsernameScreen]: undefined
- [ScreenNames.UnregisteredUsernameScreen]: {
- username: string
- }
+
[ScreenNames.UsernameTakenScreen]: undefined
[ScreenNames.NewUsernameRequestedScreen]: undefined
[ScreenNames.PossibleImpersonationAttackScreen]: undefined
@@ -59,8 +57,6 @@ export type ErrorRouteProp = RouteProp
-export type UnregisteredUsernameRouteProps = RouteProp
-
export type UsernameTakenRouteProps = RouteProp
export type NewUsernameRequestedRouteProps = RouteProp
diff --git a/packages/mobile/src/screens/Channel/Channel.screen.tsx b/packages/mobile/src/screens/Channel/Channel.screen.tsx
index 5b9f8e85c3..c399e8d8d1 100644
--- a/packages/mobile/src/screens/Channel/Channel.screen.tsx
+++ b/packages/mobile/src/screens/Channel/Channel.screen.tsx
@@ -51,10 +51,13 @@ export const ChannelScreen: FC = () => {
const isWebsocketConnected = useSelector(initSelectors.isWebsocketConnected)
let contextMenu: UseContextMenuType> | null = useContextMenu(MenuName.Channel)
+
if (!community?.CA || !isWebsocketConnected) {
contextMenu = null
}
+ const unregisteredUsernameContextMenu = useContextMenu(MenuName.UnregisteredUsername)
+
const [uploadingFiles, setUploadingFiles] = React.useState({})
const filesRef = React.useRef({})
React.useEffect(() => {
@@ -119,16 +122,9 @@ export const ChannelScreen: FC = () => {
const unregisteredUsernameHandleBack = useCallback(
(username: string) => {
- dispatch(
- navigationActions.navigation({
- screen: ScreenNames.UnregisteredUsernameScreen,
- params: {
- username,
- },
- })
- )
+ unregisteredUsernameContextMenu.handleOpen({ username })
},
- [dispatch]
+ [unregisteredUsernameContextMenu]
)
const sendMessageAction = React.useCallback(
diff --git a/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.screen.tsx b/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.screen.tsx
deleted file mode 100644
index a04bf19009..0000000000
--- a/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.screen.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import React, { FC, useCallback } from 'react'
-import { useDispatch } from 'react-redux'
-import { navigationActions } from '../../store/navigation/navigation.slice'
-import { ScreenNames } from '../../const/ScreenNames.enum'
-import { UnregisteredUsernameScreenProps } from './UnregisteredUsername.types'
-import UnregisteredUsernameComponent from '../../components/UserLabel/Unregistered/UnregisteredUsername.component'
-
-export const UnregisteredUsernameScreen: FC = ({ route }) => {
- const dispatch = useDispatch()
-
- const { username } = route.params
-
- const handleBackButton = useCallback(() => {
- dispatch(
- navigationActions.replaceScreen({
- screen: ScreenNames.ChannelScreen,
- })
- )
- }, [dispatch])
-
- return
-}
diff --git a/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.types.ts b/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.types.ts
deleted file mode 100644
index d11bb7f340..0000000000
--- a/packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.types.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { UnregisteredUsernameRouteProps } from '../../route.params'
-
-export interface UnregisteredUsernameScreenProps {
- route: UnregisteredUsernameRouteProps
-}
-
-export interface UnregisteredUsernameComponentProps {
- handleBackButton: () => void
- username: string
-}
diff --git a/packages/mobile/src/store/navigation/navigation.slice.ts b/packages/mobile/src/store/navigation/navigation.slice.ts
index fd9b45717a..5861eb5b27 100644
--- a/packages/mobile/src/store/navigation/navigation.slice.ts
+++ b/packages/mobile/src/store/navigation/navigation.slice.ts
@@ -13,6 +13,7 @@ export class NavigationState {
public [MenuName.Community] = { open: false, args: {} }
public [MenuName.Channel] = { open: false, args: {} }
public [MenuName.Invitation] = { open: false, args: {} }
+ public [MenuName.UnregisteredUsername] = { open: false, args: {} }
public pendingNavigation: ScreenNames | null = null
}