File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
examples/SampleApp/src/components Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1- import React , { useState } from 'react' ;
1+ import React , { useCallback , useState } from 'react' ;
22import {
33 useAttachmentPickerState ,
44 AttachmentPickerContentProps ,
55 AttachmentPickerContent ,
66 AttachmentPickerGenericContent ,
77 useStableCallback ,
8+ useTheme ,
89 useTranslationContext ,
910} from 'stream-chat-react-native' ;
1011import { ShareLocationIcon } from '../icons/ShareLocationIcon.tsx' ;
@@ -14,6 +15,14 @@ export const CustomAttachmentPickerContent = (props: AttachmentPickerContentProp
1415 const [ modalVisible , setModalVisible ] = useState ( false ) ;
1516 const { selectedPicker } = useAttachmentPickerState ( ) ;
1617 const { t } = useTranslationContext ( ) ;
18+ const {
19+ theme : { semantics } ,
20+ } = useTheme ( ) ;
21+
22+ const Icon = useCallback (
23+ ( ) => < ShareLocationIcon stroke = { semantics . textTertiary } /> ,
24+ [ semantics . textTertiary ] ,
25+ ) ;
1726
1827 const onRequestClose = ( ) => {
1928 setModalVisible ( false ) ;
@@ -27,7 +36,7 @@ export const CustomAttachmentPickerContent = (props: AttachmentPickerContentProp
2736 return (
2837 < >
2938 < AttachmentPickerGenericContent
30- Icon = { ShareLocationIcon }
39+ Icon = { Icon }
3140 onPress = { onOpenModal }
3241 height = { props . height }
3342 buttonText = { t ( 'Share Location' ) }
Original file line number Diff line number Diff line change 1- import React , { useMemo } from 'react' ;
1+ import React , { useMemo , useState } from 'react' ;
22import { StyleSheet , View } from 'react-native' ;
33import {
44 AttachmentTypePickerButton ,
@@ -13,15 +13,22 @@ import {
1313 useTheme ,
1414} from 'stream-chat-react-native' ;
1515import { ShareLocationIcon } from '../icons/ShareLocationIcon' ;
16+ import { LiveLocationCreateModal } from './LocationSharing/CreateLocationModal' ;
1617
1718export const CustomAttachmentPickerSelectionBar = ( ) => {
19+ const [ modalVisible , setModalVisible ] = useState ( false ) ;
1820 const { attachmentPickerStore } = useAttachmentPickerContext ( ) ;
1921 const { selectedPicker } = useAttachmentPickerState ( ) ;
2022
2123 const styles = useStyles ( ) ;
2224
25+ const onRequestClose = ( ) => {
26+ setModalVisible ( false ) ;
27+ } ;
28+
2329 const onOpenModal = useStableCallback ( ( ) => {
2430 attachmentPickerStore . setSelectedPicker ( 'location' ) ;
31+ setModalVisible ( true ) ;
2532 } ) ;
2633
2734 return (
@@ -36,6 +43,9 @@ export const CustomAttachmentPickerSelectionBar = () => {
3643 onPress = { onOpenModal }
3744 selected = { selectedPicker === 'location' }
3845 />
46+ { modalVisible ? (
47+ < LiveLocationCreateModal visible = { modalVisible } onRequestClose = { onRequestClose } />
48+ ) : null }
3949 </ View >
4050 ) ;
4151} ;
You can’t perform that action at this time.
0 commit comments