Skip to content

Commit 87e9774

Browse files
[MM-66923] Fix scroll and private channel icon on invite user (#9363) (#9391)
* [MM-66923] Fix scroll and private channel icon on invite user * Address feedback * Fix test (cherry picked from commit 2111c8f) Co-authored-by: Daniel Espino García <larkox@gmail.com>
1 parent 34c6df6 commit 87e9774

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

app/screens/integration_selector/channel_list_row/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const getIconForChannel = (selectedChannel: Channel): string => {
2626
let icon = 'globe';
2727

2828
if (selectedChannel.type === 'P') {
29-
icon = 'padlock';
29+
icon = 'lock-outline';
3030
}
3131

3232
if (selectedChannel.delete_at) {

app/screens/integration_selector/custom_list/index.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
22
// See LICENSE.txt for license information.
3-
import React, {useCallback} from 'react';
3+
import React, {useCallback, useRef} from 'react';
44
import {
5-
Platform, FlatList, RefreshControl, View,
5+
Platform, RefreshControl, View,
66
} from 'react-native';
7+
import {KeyboardAwareFlatList} from 'react-native-keyboard-aware-scroll-view';
78

9+
import {useAvoidKeyboard} from '@hooks/device';
810
import {makeStyleSheetFromTheme, changeOpacity} from '@utils/theme';
911
import {typography} from '@utils/typography';
1012

@@ -52,9 +54,6 @@ const getStyleFromTheme = makeStyleSheetFromTheme((theme) => {
5254
},
5355
}),
5456
},
55-
container: {
56-
flexGrow: 1,
57-
},
5857
separator: {
5958
height: 1,
6059
flex: 1,
@@ -109,6 +108,8 @@ function CustomList({
109108
canRefresh = true, testID, refreshing = false, onRefresh,
110109
}: Props) {
111110
const style = getStyleFromTheme(theme);
111+
const keyboardAwareFlatListRef = useRef<KeyboardAwareFlatList>(null);
112+
useAvoidKeyboard(keyboardAwareFlatListRef);
112113

113114
// Renders
114115
const renderEmptyList = useCallback(() => {
@@ -159,8 +160,8 @@ function CustomList({
159160
}
160161

161162
return (
162-
<FlatList
163-
contentContainerStyle={style.container}
163+
<KeyboardAwareFlatList
164+
ref={keyboardAwareFlatListRef}
164165
data={data}
165166
keyboardShouldPersistTaps='always'
166167
keyExtractor={keyExtractor}

app/screens/invite/selection.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ describe('Selection', () => {
266266
const {getByTestId} = renderWithIntl(<Selection {...props}/>);
267267

268268
const optionItem = getByTestId('invite.guest_magic_link');
269-
expect(optionItem).toHaveProp('label', 'Allow newly created guests to login without password');
269+
expect(optionItem).toHaveProp('label', 'Use magic link');
270+
expect(optionItem).toHaveProp('description', 'Newly created guests will join and log in without a password, using a magic link sent to their email address');
270271
expect(optionItem).toHaveProp('type', 'toggle');
271272
expect(optionItem).toHaveProp('selected', false);
272273

app/screens/invite/selection.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
22
// See LICENSE.txt for license information.
33

4-
import React, {useCallback, useState, useMemo} from 'react';
4+
import React, {useCallback, useState, useMemo, useRef} from 'react';
55
import {useIntl} from 'react-intl';
66
import {
77
Keyboard,
@@ -13,6 +13,7 @@ import {
1313
type ListRenderItemInfo,
1414
ScrollView,
1515
} from 'react-native';
16+
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
1617
import Animated, {useAnimatedStyle, useDerivedValue} from 'react-native-reanimated';
1718

1819
import SelectedChip from '@components/chips/selected_chip';
@@ -25,7 +26,7 @@ import {Screens} from '@constants';
2526
import {MAX_LIST_HEIGHT, MAX_LIST_TABLET_DIFF} from '@constants/autocomplete';
2627
import {useTheme} from '@context/theme';
2728
import {useAutocompleteDefaultAnimatedValues} from '@hooks/autocomplete';
28-
import {useIsTablet} from '@hooks/device';
29+
import {useAvoidKeyboard, useIsTablet} from '@hooks/device';
2930
import {goToScreen} from '@screens/navigation';
3031
import {makeStyleSheetFromTheme, changeOpacity} from '@utils/theme';
3132

@@ -178,6 +179,9 @@ export default function Selection({
178179

179180
const hasChannelsSelected = selectedChannels.length > 0;
180181

182+
const keyboardAwareRef = useRef<KeyboardAwareScrollView>(null);
183+
useAvoidKeyboard(keyboardAwareRef);
184+
181185
const onLayoutSelectionTeamBar = useCallback((e: LayoutChangeEvent) => {
182186
setTeamBarHeight(e.nativeEvent.layout.height);
183187
}, []);
@@ -372,7 +376,10 @@ export default function Selection({
372376
onLayoutContainer={onLayoutSelectionTeamBar}
373377
onClose={onClose}
374378
/>
375-
<View style={styles.contentContainer}>
379+
<KeyboardAwareScrollView
380+
ref={keyboardAwareRef}
381+
style={styles.contentContainer}
382+
>
376383
<SelectionSearchBar
377384
term={term}
378385
onSearchChange={onSearchChange}
@@ -428,7 +435,8 @@ export default function Selection({
428435
)}
429436
{allowGuestMagicLink && (
430437
<OptionItem
431-
label={intl.formatMessage({id: 'invite.guest_magic_link', defaultMessage: 'Allow newly created guests to login without password'})}
438+
label={intl.formatMessage({id: 'invite.guest_magic_link', defaultMessage: 'Use magic link'})}
439+
description={intl.formatMessage({id: 'invite.guest_magic_link_description', defaultMessage: 'Newly created guests will join and log in without a password, using a magic link sent to their email address'})}
432440
type='toggle'
433441
selected={guestMagicLink}
434442
action={handlePasswordlessInvitesChange}
@@ -438,7 +446,7 @@ export default function Selection({
438446
</>
439447
)}
440448
</View>
441-
</View>
449+
</KeyboardAwareScrollView>
442450
<Animated.View style={searchListContainerStyle}>
443451
<FlatList
444452
data={searchResults}

assets/base/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@
441441
"invite_people_to_team.message": "Here’s a link to collaborate and communicate with us on Mattermost.",
442442
"invite_people_to_team.title": "Join the {team} team",
443443
"invite.custom_message": "Enter a custom message",
444-
"invite.guest_magic_link": "Allow newly created guests to login without password",
444+
"invite.guest_magic_link": "Use magic link",
445+
"invite.guest_magic_link_description": "Newly created guests will join and log in without a password, using a magic link sent to their email address",
445446
"invite.invite_as_guest": "Invite as guest",
446447
"invite.invite_as_guest_description": "Guests are limited to selected channels",
447448
"invite.members.already_member": "This person is already a team member",

0 commit comments

Comments
 (0)