-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MainTabsScreen: Add Users icon to bottom nav #5506
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* @flow strict-local */ | ||
|
||
import React, { useCallback } from 'react'; | ||
import type { Node } from 'react'; | ||
|
||
import type { UserOrBot } from '../types'; | ||
import { useSelector } from '../react-redux'; | ||
import UserList from './UserList'; | ||
import { getUsers, getPresence } from '../selectors'; | ||
import { useNavigation } from '../react-navigation'; | ||
|
||
type Props = $ReadOnly<{| | ||
filter: string, | ||
|}>; | ||
|
||
export default function UsersProfileCard(props: Props): Node { | ||
const { filter } = props; | ||
const users = useSelector(getUsers); | ||
const presences = useSelector(getPresence); | ||
|
||
const navigation = useNavigation(); | ||
const handleUserNarrow = useCallback( | ||
(user: UserOrBot) => { | ||
navigation.push('account-details', { userId: user.user_id }); | ||
}, | ||
[navigation], | ||
); | ||
|
||
return ( | ||
<UserList users={users} filter={filter} presences={presences} onPress={handleUserNarrow} /> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* @flow strict-local */ | ||
import React from 'react'; | ||
import type { Node } from 'react'; | ||
import { SafeAreaView } from 'react-native-safe-area-context'; | ||
|
||
import type { AppNavigationProp } from '../nav/AppNavigator'; | ||
import UsersProfileCard from './UsersProfileCard'; | ||
|
||
type Props = $ReadOnly<{| | ||
navigation: AppNavigationProp<'users'>, | ||
|}>; | ||
|
||
export default function UsersInfoScreen(props: Props): Node { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: function name of default export should match filename |
||
return ( | ||
<SafeAreaView mode="padding" edges={['top']} style={{ flex: 1 }} scrollEnabled={false}> | ||
<UsersProfileCard filter="" /> | ||
</SafeAreaView> | ||
); | ||
Comment on lines
+13
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of having a trivial wrapper component like this, let's have just one component that does the job of both this and the inner component. (I see the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should follow the model of the other screen components that have the same navigation-related context -- which means the ones that also appear in
MainTabsScreen
in the same way that you're adding this one there. Take a look at thenavigation
props on those.