-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathReportScreenContext.ts
23 lines (18 loc) · 1.02 KB
/
ReportScreenContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {createContext, RefObject} from 'react';
import {FlatList, GestureResponderEvent} from 'react-native';
type ReactionListRef = {
showReactionList: (event: GestureResponderEvent | undefined, reactionListAnchor: Element, emojiName: string, reportActionID: string) => void;
hideReactionList: () => void;
isActiveReportAction: (actionID: number | string) => boolean;
};
type FlatListRefType = RefObject<FlatList<unknown>> | null;
type ActionListContextType = {
flatListRef: FlatListRefType;
scrollPosition: {offset: number} | null;
setScrollPosition: (position: {offset: number}) => void;
};
type ReactionListContextType = RefObject<ReactionListRef> | null;
const ActionListContext = createContext<ActionListContextType>({flatListRef: null, scrollPosition: null, setScrollPosition: () => {}});
const ReactionListContext = createContext<ReactionListContextType>(null);
export {ActionListContext, ReactionListContext};
export type {ReactionListRef, ActionListContextType, ReactionListContextType, FlatListRefType};