Skip to content

Commit 03d3b10

Browse files
committed
fix: crash for live location sharing
1 parent b793704 commit 03d3b10

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

examples/SampleApp/src/components/AttachmentPickerContent.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import React, { useCallback, useState } from 'react';
1+
import React, { useState } from 'react';
22
import {
33
useAttachmentPickerState,
44
AttachmentPickerContentProps,
55
AttachmentPickerContent,
66
AttachmentPickerGenericContent,
77
useStableCallback,
8-
useTheme,
98
useTranslationContext,
109
} from 'stream-chat-react-native';
1110
import { ShareLocationIcon } from '../icons/ShareLocationIcon.tsx';
@@ -15,14 +14,6 @@ export const CustomAttachmentPickerContent = (props: AttachmentPickerContentProp
1514
const [modalVisible, setModalVisible] = useState(false);
1615
const { selectedPicker } = useAttachmentPickerState();
1716
const { t } = useTranslationContext();
18-
const {
19-
theme: { semantics },
20-
} = useTheme();
21-
22-
const Icon = useCallback(
23-
() => <ShareLocationIcon stroke={semantics.textTertiary} />,
24-
[semantics.textTertiary],
25-
);
2617

2718
const onRequestClose = () => {
2819
setModalVisible(false);
@@ -36,7 +27,7 @@ export const CustomAttachmentPickerContent = (props: AttachmentPickerContentProp
3627
return (
3728
<>
3829
<AttachmentPickerGenericContent
39-
Icon={Icon}
30+
Icon={ShareLocationIcon}
4031
onPress={onOpenModal}
4132
height={props.height}
4233
buttonText={t('Share Location')}

examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, useState } from 'react';
1+
import React, { useMemo } from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import {
44
AttachmentTypePickerButton,
@@ -13,22 +13,15 @@ import {
1313
useTheme,
1414
} from 'stream-chat-react-native';
1515
import { ShareLocationIcon } from '../icons/ShareLocationIcon';
16-
import { LiveLocationCreateModal } from './LocationSharing/CreateLocationModal';
1716

1817
export const CustomAttachmentPickerSelectionBar = () => {
19-
const [modalVisible, setModalVisible] = useState(false);
2018
const { attachmentPickerStore } = useAttachmentPickerContext();
2119
const { selectedPicker } = useAttachmentPickerState();
2220

2321
const styles = useStyles();
2422

25-
const onRequestClose = () => {
26-
setModalVisible(false);
27-
};
28-
2923
const onOpenModal = useStableCallback(() => {
3024
attachmentPickerStore.setSelectedPicker('location');
31-
setModalVisible(true);
3225
});
3326

3427
return (
@@ -43,9 +36,6 @@ export const CustomAttachmentPickerSelectionBar = () => {
4336
onPress={onOpenModal}
4437
selected={selectedPicker === 'location'}
4538
/>
46-
{modalVisible ? (
47-
<LiveLocationCreateModal visible={modalVisible} onRequestClose={onRequestClose} />
48-
) : null}
4939
</View>
5040
);
5141
};

package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ export const AttachmentFilePicker = (props: AttachmentPickerContentProps) => {
223223
};
224224

225225
export type { AttachmentPickerContentProps } from './AttachmentPickerGenericContent';
226+
export { AttachmentPickerGenericContent } from './AttachmentPickerGenericContent';
226227

227228
export const AttachmentPickerContent = (props: AttachmentPickerContentProps) => {
228229
const { height } = props;

0 commit comments

Comments
 (0)