MCPcopy Create free account
hub / github.com/CommE2E/comm / ThreadPickerModal

Function ThreadPickerModal

native/calendar/thread-picker-modal.react.js:32–86  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

30 +route: NavigationRoute<'ThreadPickerModal'>,
31};
32function ThreadPickerModal(props: Props): React.Node {
33 const {
34 navigation,
35 route: {
36 params: { dateString },
37 },
38 } = props;
39
40 const viewerID = useSelector(
41 state => state.currentUserInfo && state.currentUserInfo.id,
42 );
43 const dispatch = useDispatch();
44
45 const rootNavigatorContext = React.useContext(RootNavigatorContext);
46 const threadPicked = React.useCallback(
47 (threadID: string) => {
48 invariant(
49 dateString && viewerID && rootNavigatorContext,
50 'inputs to threadPicked should be set',
51 );
52 rootNavigatorContext.setKeyboardHandlingEnabled(false);
53 dispatch({
54 type: createLocalEntryActionType,
55 payload: createLocalEntry(threadID, dateString, viewerID),
56 });
57 },
58 [rootNavigatorContext, dispatch, viewerID, dateString],
59 );
60
61 React.useEffect(
62 () =>
63 navigation.addListener('blur', async () => {
64 await waitForInteractions();
65 invariant(
66 rootNavigatorContext,
67 'RootNavigatorContext should be set in onScreenBlur',
68 );
69 rootNavigatorContext.setKeyboardHandlingEnabled(true);
70 }),
71 [navigation, rootNavigatorContext],
72 );
73
74 const index = useGlobalThreadSearchIndex();
75 const onScreenThreadInfos = useOnScreenEntryEditableThreadInfos();
76 return (
77 <Modal>
78 <ThreadList
79 threadInfos={onScreenThreadInfos}
80 onSelect={threadPicked}
81 itemStyle={styles.threadListItem}
82 searchIndex={index}
83 />
84 </Modal>
85 );
86}
87
88const styles = StyleSheet.create({
89 threadListItem: {

Callers

nothing calls this directly

Calls 7

useSelectorFunction · 0.90
useDispatchFunction · 0.90
createLocalEntryFunction · 0.90
waitForInteractionsFunction · 0.90
addListenerMethod · 0.65

Tested by

no test coverage detected