* MM-62915 and MM-62919 (#8568)
(cherry picked from commit ee66890d32)
* remove duplicate backgroundColor in search results header
---------
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
parent
3d3542fc80
commit
b00c550cd6
18 changed files with 200 additions and 168 deletions
|
|
@ -10,6 +10,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|||
|
||||
import com.mattermost.networkclient.ApiClientModuleImpl;
|
||||
import com.mattermost.networkclient.enums.RetryTypes;
|
||||
import com.mattermost.turbolog.TurboLog;
|
||||
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Response;
|
||||
|
|
@ -21,9 +22,12 @@ public class Network {
|
|||
private static final Promise emptyPromise = new ResolvePromise();
|
||||
|
||||
public static void init(Context context) {
|
||||
final ReactApplicationContext reactContext = (ApiClientModuleImpl.context == null) ? (ReactApplicationContext) context.getApplicationContext() : ApiClientModuleImpl.context;
|
||||
clientModule = new ApiClientModuleImpl(reactContext);
|
||||
createClientOptions();
|
||||
if (clientModule == null) {
|
||||
clientModule = new ApiClientModuleImpl(context);
|
||||
createClientOptions();
|
||||
} else {
|
||||
TurboLog.Companion.i("ReactNative", "Network already initialized");
|
||||
}
|
||||
}
|
||||
|
||||
public static void get(String baseUrl, String endpoint, ReadableMap options, Promise promise) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class CustomPushNotification(
|
|||
init {
|
||||
try {
|
||||
DatabaseHelper.instance?.init(context)
|
||||
Network.init(context)
|
||||
NotificationHelper.cleanNotificationPreferencesIfNeeded(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
|
|
@ -51,6 +50,7 @@ class CustomPushNotification(
|
|||
val isIdLoaded = initialData.getString("id_loaded") == "true"
|
||||
val notificationId = NotificationHelper.getNotificationId(initialData)
|
||||
val serverUrl = addServerUrlToBundle(initialData)
|
||||
Network.init(mContext)
|
||||
|
||||
GlobalScope.launch {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -13,12 +13,16 @@ import androidx.annotation.Nullable;
|
|||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.Person;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
import com.mattermost.helpers.*;
|
||||
import com.mattermost.turbolog.TurboLog;
|
||||
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
|
||||
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
|
||||
import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
|
||||
|
||||
public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
||||
|
|
@ -26,6 +30,15 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
private Bundle bundle;
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
private ReactApplicationContext getReactContext(Context context) {
|
||||
if (context instanceof ReactApplication) {
|
||||
ReactNativeHost host = ((ReactApplication) context).getReactNativeHost();
|
||||
return (ReactApplicationContext) host.getReactInstanceManager().getCurrentReactContext();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
|
|
@ -40,6 +53,7 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
|
||||
final int notificationId = intent.getIntExtra(CustomPushNotificationHelper.NOTIFICATION_ID, -1);
|
||||
final String serverUrl = bundle.getString("server_url");
|
||||
Network.init(context);
|
||||
if (serverUrl != null) {
|
||||
replyToMessage(serverUrl, notificationId, message);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ exports[`components/channel_list/categories/body/channel_item should match snaps
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
null,
|
||||
|
|
@ -213,7 +213,7 @@ exports[`components/channel_list/categories/body/channel_item should match snaps
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
null,
|
||||
|
|
@ -251,7 +251,7 @@ exports[`components/channel_list/categories/body/channel_item should match snaps
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
null,
|
||||
|
|
@ -361,7 +361,7 @@ exports[`components/channel_list/categories/body/channel_item should match snaps
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
null,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
|
|||
marginRight: 12,
|
||||
},
|
||||
text: {
|
||||
color: theme.sidebarText,
|
||||
color: changeOpacity(theme.sidebarText, 0.72),
|
||||
},
|
||||
highlight: {
|
||||
color: theme.sidebarUnreadText,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ exports[`Thread item in the channel list Threads Component should match snapshot
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
false,
|
||||
|
|
@ -174,7 +174,7 @@ exports[`Thread item in the channel list Threads Component should match snapshot
|
|||
"lineHeight": 24,
|
||||
},
|
||||
{
|
||||
"color": "#ffffff",
|
||||
"color": "rgba(255,255,255,0.72)",
|
||||
},
|
||||
false,
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {useRoute} from '@react-navigation/native';
|
||||
import {useIsFocused, useRoute} from '@react-navigation/native';
|
||||
import React, {useCallback, useState} from 'react';
|
||||
import {Freeze} from 'react-freeze';
|
||||
import {ScrollView, View} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, withTiming} from 'react-native-reanimated';
|
||||
import {type Edge, SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
|
|
@ -28,10 +29,6 @@ const edges: Edge[] = ['left', 'right'];
|
|||
|
||||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
||||
return {
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.sidebarBg,
|
||||
},
|
||||
flex: {
|
||||
flex: 1,
|
||||
},
|
||||
|
|
@ -62,6 +59,7 @@ const AccountScreen = ({currentUser, enableCustomUserStatuses, showFullName}: Ac
|
|||
const route = useRoute();
|
||||
const insets = useSafeAreaInsets();
|
||||
const isTablet = useIsTablet();
|
||||
const isFocused = useIsFocused();
|
||||
|
||||
let tabletSidebarStyle;
|
||||
if (isTablet) {
|
||||
|
|
@ -113,27 +111,29 @@ const AccountScreen = ({currentUser, enableCustomUserStatuses, showFullName}: Ac
|
|||
) : null;
|
||||
|
||||
return (
|
||||
<SafeAreaView
|
||||
edges={edges}
|
||||
style={styles.container}
|
||||
testID='account.screen'
|
||||
>
|
||||
<View style={[{height: insets.top, flexDirection: 'row'}]}>
|
||||
<View style={[styles.container, tabletSidebarStyle]}/>
|
||||
{isTablet && <View style={styles.tabletContainer}/>}
|
||||
</View>
|
||||
<Animated.View
|
||||
onLayout={onLayout}
|
||||
style={[styles.flexRow, animated]}
|
||||
<Freeze freeze={!isFocused}>
|
||||
<SafeAreaView
|
||||
edges={edges}
|
||||
style={styles.flex}
|
||||
testID='account.screen'
|
||||
>
|
||||
{content}
|
||||
{isTablet &&
|
||||
<View style={[styles.tabletContainer, styles.tabletDivider]}>
|
||||
<AccountTabletView/>
|
||||
<View style={[{height: insets.top, flexDirection: 'row'}]}>
|
||||
<View style={[styles.flex, tabletSidebarStyle]}/>
|
||||
{isTablet && <View style={styles.tabletContainer}/>}
|
||||
</View>
|
||||
}
|
||||
</Animated.View>
|
||||
</SafeAreaView>
|
||||
<Animated.View
|
||||
onLayout={onLayout}
|
||||
style={[styles.flexRow, animated]}
|
||||
>
|
||||
{content}
|
||||
{isTablet &&
|
||||
<View style={[styles.tabletContainer, styles.tabletDivider]}>
|
||||
<AccountTabletView/>
|
||||
</View>
|
||||
}
|
||||
</Animated.View>
|
||||
</SafeAreaView>
|
||||
</Freeze>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
import {useIsFocused, useRoute} from '@react-navigation/native';
|
||||
import React, {useCallback, useState, useEffect, useMemo} from 'react';
|
||||
import {Freeze} from 'react-freeze';
|
||||
import {useIntl} from 'react-intl';
|
||||
import {ActivityIndicator, DeviceEventEmitter, type ListRenderItemInfo, View} from 'react-native';
|
||||
import {ActivityIndicator, DeviceEventEmitter, type ListRenderItemInfo, StyleSheet, View} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
|
||||
import {SafeAreaView, type Edge} from 'react-native-safe-area-context';
|
||||
|
||||
|
|
@ -19,7 +20,6 @@ import {useServerUrl} from '@context/server';
|
|||
import {useTheme} from '@context/theme';
|
||||
import {useCollapsibleHeader} from '@hooks/header';
|
||||
import {getDateForDateLine, selectOrderedPosts} from '@utils/post_list';
|
||||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
|
||||
import EmptyState from './components/empty';
|
||||
|
||||
|
|
@ -35,20 +35,16 @@ type Props = {
|
|||
mentions: PostModel[];
|
||||
}
|
||||
|
||||
const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
|
||||
const styles = StyleSheet.create({
|
||||
flex: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
},
|
||||
empty: {
|
||||
alignItems: 'center',
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
const RecentMentionsScreen = ({appsEnabled, customEmojiNames, mentions, currentTimezone}: Props) => {
|
||||
const theme = useTheme();
|
||||
|
|
@ -58,7 +54,6 @@ const RecentMentionsScreen = ({appsEnabled, customEmojiNames, mentions, currentT
|
|||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const serverUrl = useServerUrl();
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
const params = route.params as {direction: string};
|
||||
const toLeft = params.direction === 'left';
|
||||
|
|
@ -165,45 +160,47 @@ const RecentMentionsScreen = ({appsEnabled, customEmojiNames, mentions, currentT
|
|||
}, [appsEnabled, customEmojiNames]);
|
||||
|
||||
return (
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
style={styles.flex}
|
||||
edges={EDGES}
|
||||
testID='recent_mentions.screen'
|
||||
>
|
||||
<Animated.View style={[styles.container, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
<Freeze freeze={!isFocused}>
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
style={styles.flex}
|
||||
edges={EDGES}
|
||||
testID='recent_mentions.screen'
|
||||
>
|
||||
<Animated.View style={[styles.flex, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
</Animated.View>
|
||||
<Animated.FlatList
|
||||
ref={scrollRef}
|
||||
contentContainerStyle={paddingTop}
|
||||
ListEmptyComponent={renderEmptyList()}
|
||||
data={posts}
|
||||
scrollToOverflowEnabled={true}
|
||||
showsVerticalScrollIndicator={false}
|
||||
progressViewOffset={scrollPaddingTop}
|
||||
scrollEventThrottle={16}
|
||||
indicatorStyle='black'
|
||||
onScroll={onScroll}
|
||||
onRefresh={handleRefresh}
|
||||
refreshing={refreshing}
|
||||
renderItem={renderItem}
|
||||
removeClippedSubviews={true}
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
testID='recent_mentions.post_list.flat_list'
|
||||
/>
|
||||
</Animated.View>
|
||||
<Animated.FlatList
|
||||
ref={scrollRef}
|
||||
contentContainerStyle={paddingTop}
|
||||
ListEmptyComponent={renderEmptyList()}
|
||||
data={posts}
|
||||
scrollToOverflowEnabled={true}
|
||||
showsVerticalScrollIndicator={false}
|
||||
progressViewOffset={scrollPaddingTop}
|
||||
scrollEventThrottle={16}
|
||||
indicatorStyle='black'
|
||||
onScroll={onScroll}
|
||||
onRefresh={handleRefresh}
|
||||
refreshing={refreshing}
|
||||
renderItem={renderItem}
|
||||
removeClippedSubviews={true}
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
testID='recent_mentions.post_list.flat_list'
|
||||
/>
|
||||
</Animated.View>
|
||||
</SafeAreaView>
|
||||
</ExtraKeyboardProvider>
|
||||
</SafeAreaView>
|
||||
</ExtraKeyboardProvider>
|
||||
</Freeze>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
import {useIsFocused, useRoute} from '@react-navigation/native';
|
||||
import React, {useCallback, useEffect, useMemo, useState} from 'react';
|
||||
import {Freeze} from 'react-freeze';
|
||||
import {useIntl} from 'react-intl';
|
||||
import {DeviceEventEmitter, type ListRenderItemInfo, View} from 'react-native';
|
||||
import {DeviceEventEmitter, type ListRenderItemInfo, StyleSheet, View} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
|
||||
import {type Edge, SafeAreaView} from 'react-native-safe-area-context';
|
||||
|
||||
|
|
@ -20,7 +21,6 @@ import {useServerUrl} from '@context/server';
|
|||
import {useTheme} from '@context/theme';
|
||||
import {useCollapsibleHeader} from '@hooks/header';
|
||||
import {getDateForDateLine, selectOrderedPosts} from '@utils/post_list';
|
||||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
|
||||
import EmptyState from './components/empty';
|
||||
|
||||
|
|
@ -36,20 +36,16 @@ type Props = {
|
|||
|
||||
const edges: Edge[] = ['bottom', 'left', 'right'];
|
||||
|
||||
const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
|
||||
const styles = StyleSheet.create({
|
||||
flex: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
},
|
||||
empty: {
|
||||
alignItems: 'center',
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
function SavedMessages({appsEnabled, posts, currentTimezone, customEmojiNames}: Props) {
|
||||
const intl = useIntl();
|
||||
|
|
@ -59,7 +55,6 @@ function SavedMessages({appsEnabled, posts, currentTimezone, customEmojiNames}:
|
|||
const serverUrl = useServerUrl();
|
||||
const route = useRoute();
|
||||
const isFocused = useIsFocused();
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
const params = route.params as {direction: string};
|
||||
const toLeft = params.direction === 'left';
|
||||
|
|
@ -167,45 +162,47 @@ function SavedMessages({appsEnabled, posts, currentTimezone, customEmojiNames}:
|
|||
}, [appsEnabled, currentTimezone, customEmojiNames, theme]);
|
||||
|
||||
return (
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
edges={edges}
|
||||
style={styles.flex}
|
||||
testID='saved_messages.screen'
|
||||
>
|
||||
<Animated.View style={[styles.container, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
<Freeze freeze={!isFocused}>
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
edges={edges}
|
||||
style={styles.flex}
|
||||
testID='saved_messages.screen'
|
||||
>
|
||||
<Animated.View style={[styles.flex, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
</Animated.View>
|
||||
<Animated.FlatList
|
||||
ref={scrollRef}
|
||||
contentContainerStyle={paddingTop}
|
||||
ListEmptyComponent={emptyList}
|
||||
data={data}
|
||||
onRefresh={handleRefresh}
|
||||
refreshing={refreshing}
|
||||
renderItem={renderItem}
|
||||
scrollToOverflowEnabled={true}
|
||||
showsVerticalScrollIndicator={false}
|
||||
progressViewOffset={scrollPaddingTop}
|
||||
scrollEventThrottle={16}
|
||||
indicatorStyle='black'
|
||||
onScroll={onScroll}
|
||||
removeClippedSubviews={true}
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
testID='saved_messages.post_list.flat_list'
|
||||
/>
|
||||
</Animated.View>
|
||||
<Animated.FlatList
|
||||
ref={scrollRef}
|
||||
contentContainerStyle={paddingTop}
|
||||
ListEmptyComponent={emptyList}
|
||||
data={data}
|
||||
onRefresh={handleRefresh}
|
||||
refreshing={refreshing}
|
||||
renderItem={renderItem}
|
||||
scrollToOverflowEnabled={true}
|
||||
showsVerticalScrollIndicator={false}
|
||||
progressViewOffset={scrollPaddingTop}
|
||||
scrollEventThrottle={16}
|
||||
indicatorStyle='black'
|
||||
onScroll={onScroll}
|
||||
removeClippedSubviews={true}
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
testID='saved_messages.post_list.flat_list'
|
||||
/>
|
||||
</Animated.View>
|
||||
</SafeAreaView>
|
||||
</ExtraKeyboardProvider>
|
||||
</SafeAreaView>
|
||||
</ExtraKeyboardProvider>
|
||||
</Freeze>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ const getStyleFromTheme = makeStyleSheetFromTheme((theme: Theme) => {
|
|||
return {
|
||||
container: {
|
||||
marginTop: 10,
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: changeOpacity(theme.centerChannelColor, 0.1),
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
},
|
||||
badge: {
|
||||
backgroundColor: theme.buttonBg,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useCallback, useMemo} from 'react';
|
||||
import {FlatList, type ListRenderItemInfo, type StyleProp, type ViewStyle} from 'react-native';
|
||||
import {DeviceEventEmitter, FlatList, type ListRenderItemInfo, type StyleProp, type ViewStyle} from 'react-native';
|
||||
|
||||
import FormattedText from '@components/formatted_text';
|
||||
import NoResultsWithTerm from '@components/no_results_with_term';
|
||||
import DateSeparator from '@components/post_list/date_separator';
|
||||
import PostWithChannelInfo from '@components/post_with_channel_info';
|
||||
import {Screens} from '@constants';
|
||||
import {Events, Screens} from '@constants';
|
||||
import {ExtraKeyboardProvider} from '@context/extra_keyboard';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {convertSearchTermToRegex, parseSearchTerms} from '@utils/markdown';
|
||||
|
|
@ -17,7 +17,7 @@ import {TabTypes} from '@utils/search';
|
|||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {typography} from '@utils/typography';
|
||||
|
||||
import type {PostListItem, PostListOtherItem} from '@typings/components/post_list';
|
||||
import type {PostListItem, PostListOtherItem, ViewableItemsChanged} from '@typings/components/post_list';
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
import type {SearchPattern} from '@typings/global/markdown';
|
||||
|
||||
|
|
@ -99,6 +99,21 @@ const PostResults = ({
|
|||
/>
|
||||
), [searchValue]);
|
||||
|
||||
const onViewableItemsChanged = useCallback(({viewableItems}: ViewableItemsChanged) => {
|
||||
if (!viewableItems.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const viewableItemsMap = viewableItems.reduce((acc: Record<string, boolean>, {item, isViewable}) => {
|
||||
if (isViewable && item.type === 'post') {
|
||||
acc[`${Screens.SEARCH}-${item.value.currentPost.id}`] = true;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
DeviceEventEmitter.emit(Events.ITEM_IN_VIEWPORT, viewableItemsMap);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ExtraKeyboardProvider>
|
||||
<FlatList
|
||||
|
|
@ -126,6 +141,7 @@ const PostResults = ({
|
|||
scrollEventThrottle={16}
|
||||
scrollToOverflowEnabled={true}
|
||||
showsVerticalScrollIndicator={true}
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
testID='search_results.post_list.flat_list'
|
||||
/>
|
||||
</ExtraKeyboardProvider>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useMemo} from 'react';
|
||||
import {StyleSheet, useWindowDimensions, View} from 'react-native';
|
||||
import {Freeze} from 'react-freeze';
|
||||
import {StyleSheet, View} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, withTiming} from 'react-native-reanimated';
|
||||
|
||||
import FileResults from '@components/files_search/file_results';
|
||||
import Loading from '@components/loading';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {useWindowDimensions} from '@hooks/device';
|
||||
import {TabTypes, type TabType} from '@utils/search';
|
||||
|
||||
import PostResults from './post_results';
|
||||
|
|
@ -99,25 +101,29 @@ const Results = ({
|
|||
{!loading &&
|
||||
<Animated.View style={[styles.container, transform]}>
|
||||
<View style={styles.result}>
|
||||
<PostResults
|
||||
appsEnabled={appsEnabled}
|
||||
currentTimezone={currentTimezone}
|
||||
customEmojiNames={customEmojiNames}
|
||||
posts={posts}
|
||||
matches={matches}
|
||||
paddingTop={paddingTop}
|
||||
searchValue={searchValue}
|
||||
/>
|
||||
<Freeze freeze={selectedTab !== TabTypes.MESSAGES}>
|
||||
<PostResults
|
||||
appsEnabled={appsEnabled}
|
||||
currentTimezone={currentTimezone}
|
||||
customEmojiNames={customEmojiNames}
|
||||
posts={posts}
|
||||
matches={matches}
|
||||
paddingTop={paddingTop}
|
||||
searchValue={searchValue}
|
||||
/>
|
||||
</Freeze>
|
||||
</View>
|
||||
<View style={styles.result}>
|
||||
<FileResults
|
||||
canDownloadFiles={canDownloadFiles}
|
||||
fileChannels={fileChannels}
|
||||
fileInfos={fileInfos}
|
||||
paddingTop={paddingTop}
|
||||
publicLinkEnabled={publicLinkEnabled}
|
||||
searchValue={searchValue}
|
||||
/>
|
||||
<Freeze freeze={selectedTab !== TabTypes.FILES}>
|
||||
<FileResults
|
||||
canDownloadFiles={canDownloadFiles}
|
||||
fileChannels={fileChannels}
|
||||
fileInfos={fileInfos}
|
||||
paddingTop={paddingTop}
|
||||
publicLinkEnabled={publicLinkEnabled}
|
||||
searchValue={searchValue}
|
||||
/>
|
||||
</Freeze>
|
||||
</View>
|
||||
</Animated.View>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@
|
|||
import {useHardwareKeyboardEvents} from '@mattermost/hardware-keyboard';
|
||||
import {useIsFocused, useNavigation} from '@react-navigation/native';
|
||||
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
||||
import {Freeze} from 'react-freeze';
|
||||
import {useIntl} from 'react-intl';
|
||||
import {FlatList, type LayoutChangeEvent, Platform, type ViewStyle, KeyboardAvoidingView, Keyboard} from 'react-native';
|
||||
import {FlatList, type LayoutChangeEvent, Platform, type ViewStyle, KeyboardAvoidingView, Keyboard, StyleSheet} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, useDerivedValue, withTiming, type AnimatedStyle} from 'react-native-reanimated';
|
||||
import {type Edge, SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
|
||||
|
|
@ -13,7 +14,6 @@ import {getPosts} from '@actions/local/post';
|
|||
import {addSearchToTeamSearchHistory} from '@actions/local/team';
|
||||
import {searchPosts, searchFiles} from '@actions/remote/search';
|
||||
import Autocomplete from '@components/autocomplete';
|
||||
import FreezeScreen from '@components/freeze_screen';
|
||||
import Loading from '@components/loading';
|
||||
import NavigationHeader from '@components/navigation_header';
|
||||
import RoundedHeaderContext from '@components/rounded_header_context';
|
||||
|
|
@ -27,7 +27,6 @@ import {useCollapsibleHeader} from '@hooks/header';
|
|||
import NavigationStore from '@store/navigation_store';
|
||||
import {type FileFilter, FileFilters, filterFileExtensions} from '@utils/file';
|
||||
import {TabTypes, type TabType} from '@utils/search';
|
||||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
|
||||
import Initial from './initial';
|
||||
import Results from './results';
|
||||
|
|
@ -53,10 +52,9 @@ type Props = {
|
|||
teams: TeamModel[];
|
||||
}
|
||||
|
||||
const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
|
||||
const styles = StyleSheet.create({
|
||||
flex: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.centerChannelBg,
|
||||
},
|
||||
loading: {
|
||||
flex: 1,
|
||||
|
|
@ -65,7 +63,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
|
|||
autocompleteContainer: {
|
||||
zIndex: 11,
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
const getSearchParams = (terms: string, filterValue?: FileFilter) => {
|
||||
const fileExtensions = filterFileExtensions(filterValue);
|
||||
|
|
@ -86,7 +84,6 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
const theme = useTheme();
|
||||
const insets = useSafeAreaInsets();
|
||||
const keyboardHeight = useKeyboardHeight();
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
const stateIndex = nav.getState()?.index;
|
||||
const serverUrl = useServerUrl();
|
||||
|
|
@ -354,7 +351,7 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
useHardwareKeyboardEvents(events);
|
||||
|
||||
return (
|
||||
<FreezeScreen freeze={!isFocused}>
|
||||
<Freeze freeze={!isFocused}>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
|
|
@ -446,7 +443,7 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
teamId={searchTeamId}
|
||||
/>
|
||||
}
|
||||
</FreezeScreen>
|
||||
</Freeze>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {DeviceEventEmitter, View, TouchableOpacity, useWindowDimensions} from 'react-native';
|
||||
import {DeviceEventEmitter, View, TouchableOpacity} from 'react-native';
|
||||
import Animated, {useAnimatedStyle, withTiming} from 'react-native-reanimated';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
import {Shadow} from 'react-native-shadow-2';
|
||||
|
||||
import {Events, Navigation as NavigationConstants, Screens, View as ViewConstants} from '@constants';
|
||||
import {useWindowDimensions} from '@hooks/device';
|
||||
import NavigationStore from '@store/navigation_store';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
|
||||
|
|
|
|||
|
|
@ -1454,7 +1454,7 @@ PODS:
|
|||
- Yoga
|
||||
- react-native-netinfo (11.4.1):
|
||||
- React-Core
|
||||
- react-native-network-client (1.8.0):
|
||||
- react-native-network-client (1.8.1):
|
||||
- Alamofire (~> 5.10.2)
|
||||
- DoubleConversion
|
||||
- glog
|
||||
|
|
@ -2518,7 +2518,7 @@ SPEC CHECKSUMS:
|
|||
react-native-emm: f6003bebdf4fef4feef7c61f96a5c174f43c6b5f
|
||||
react-native-image-picker: 130fad649d07e4eec8faaed361d3bba570e1e5ff
|
||||
react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187
|
||||
react-native-network-client: 91d7b8fd83885a7fe470b23270bf71689871865d
|
||||
react-native-network-client: f2996a6440c422e64e787bdf8c8e3f992be1cee6
|
||||
react-native-notifications: 3bafa1237ae8a47569a84801f17d80242fe9f6a5
|
||||
react-native-paste-input: d33daa183942fa57f34dff2088805a60895f14d2
|
||||
react-native-performance: 125a96c145e29918b55b45ce25cbba54f1e24dcd
|
||||
|
|
|
|||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -21,7 +21,7 @@
|
|||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.5.1",
|
||||
"@mattermost/react-native-network-client": "1.8.0",
|
||||
"@mattermost/react-native-network-client": "1.8.1",
|
||||
"@mattermost/react-native-paste-input": "0.8.1",
|
||||
"@mattermost/react-native-turbo-log": "0.5.0",
|
||||
"@mattermost/rnshare": "file:./libraries/@mattermost/rnshare",
|
||||
|
|
@ -4631,9 +4631,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@mattermost/react-native-network-client": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@mattermost/react-native-network-client/-/react-native-network-client-1.8.0.tgz",
|
||||
"integrity": "sha512-Iv2ehPAxBwt07yrevbqVlzITG3TXWDZdHlEWDH5n3RvT/dytXYVfR8ckc4AAa7UOuWEtVBm2CLRsI3nNd+62aQ==",
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@mattermost/react-native-network-client/-/react-native-network-client-1.8.1.tgz",
|
||||
"integrity": "sha512-CrIVcIkSJej2Dg2162z2U4qyL0QIV/LYuHd0wXh9wnrcGBjk8Dt0TDhUkUaTe8V1YKYVQiJU7vsL9GlDMxVuXQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"validator": "13.12.0",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.5.1",
|
||||
"@mattermost/react-native-network-client": "1.8.0",
|
||||
"@mattermost/react-native-network-client": "1.8.1",
|
||||
"@mattermost/react-native-paste-input": "0.8.1",
|
||||
"@mattermost/react-native-turbo-log": "0.5.0",
|
||||
"@mattermost/rnshare": "file:./libraries/@mattermost/rnshare",
|
||||
|
|
|
|||
Loading…
Reference in a new issue