stream-chat-react-native-core 9.4.0-beta.1 → 9.4.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +10 -5
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Audio/AudioAttachment.js +2 -4
- package/lib/commonjs/components/Attachment/Audio/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsActionItems.js +2 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsActionItems.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +4 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js +5 -3
- package/lib/commonjs/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +5 -3
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +3 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewPinnedStatus.js +30 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewPinnedStatus.js.map +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +8 -3
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +2 -1
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/index.js +11 -0
- package/lib/commonjs/components/ChannelPreview/hooks/index.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +3 -0
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelPinned.js +11 -0
- package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelPinned.js.map +1 -0
- package/lib/commonjs/components/Message/Message.js +53 -16
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js +6 -84
- package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js +8 -29
- package/lib/commonjs/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageActionList.js +1 -1
- package/lib/commonjs/components/Poll/components/CreatePollHeader.js +5 -5
- package/lib/commonjs/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js +25 -56
- package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollInputDialog.js +9 -11
- package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollModal.js +50 -0
- package/lib/commonjs/components/Poll/components/PollModal.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollModalHeader.js +4 -5
- package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +10 -24
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/commonjs/components/Poll/components/index.js +11 -0
- package/lib/commonjs/components/Poll/components/index.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +2 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageComposer.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageComposer.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +3 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js +20 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItemsById.js +3 -1
- package/lib/commonjs/hooks/actions/useChannelActionItemsById.js.map +1 -1
- package/lib/commonjs/i18n/ar.json +6 -1
- package/lib/commonjs/i18n/en.json +5 -0
- package/lib/commonjs/i18n/es.json +6 -1
- package/lib/commonjs/i18n/fr.json +6 -1
- package/lib/commonjs/i18n/he.json +6 -1
- package/lib/commonjs/i18n/hi.json +6 -1
- package/lib/commonjs/i18n/it.json +6 -1
- package/lib/commonjs/i18n/ja.json +6 -1
- package/lib/commonjs/i18n/ko.json +6 -1
- package/lib/commonjs/i18n/nl.json +6 -1
- package/lib/commonjs/i18n/pt-br.json +6 -1
- package/lib/commonjs/i18n/ru.json +6 -1
- package/lib/commonjs/i18n/tr.json +6 -1
- package/lib/commonjs/icons/index.js +12 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +10 -5
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Audio/AudioAttachment.js +2 -4
- package/lib/module/components/Attachment/Audio/AudioAttachment.js.map +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsActionItems.js +2 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsActionItems.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +4 -1
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js +5 -3
- package/lib/module/components/ChannelList/hooks/useCreateChannelsContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +5 -3
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreview.js +3 -0
- package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewPinnedStatus.js +30 -0
- package/lib/module/components/ChannelPreview/ChannelPreviewPinnedStatus.js.map +1 -0
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js +8 -3
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +2 -1
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/index.js +11 -0
- package/lib/module/components/ChannelPreview/hooks/index.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +3 -0
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useIsChannelPinned.js +11 -0
- package/lib/module/components/ChannelPreview/hooks/useIsChannelPinned.js.map +1 -0
- package/lib/module/components/Message/Message.js +53 -16
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageItemView.js +6 -84
- package/lib/module/components/Message/MessageItemView/MessageItemView.js.map +1 -1
- package/lib/module/components/MessageInput/MessageComposer.js +8 -29
- package/lib/module/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageActionList.js +1 -1
- package/lib/module/components/Poll/components/CreatePollHeader.js +5 -5
- package/lib/module/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/module/components/Poll/components/PollButtons.js +25 -56
- package/lib/module/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/module/components/Poll/components/PollInputDialog.js +9 -11
- package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/module/components/Poll/components/PollModal.js +50 -0
- package/lib/module/components/Poll/components/PollModal.js.map +1 -0
- package/lib/module/components/Poll/components/PollModalHeader.js +4 -5
- package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js +10 -24
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/module/components/Poll/components/index.js +11 -0
- package/lib/module/components/Poll/components/index.js.map +1 -1
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +2 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageComposer.js +2 -2
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageComposer.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +3 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActionItems.js +20 -1
- package/lib/module/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActionItemsById.js +3 -1
- package/lib/module/hooks/actions/useChannelActionItemsById.js.map +1 -1
- package/lib/module/i18n/ar.json +6 -1
- package/lib/module/i18n/en.json +5 -0
- package/lib/module/i18n/es.json +6 -1
- package/lib/module/i18n/fr.json +6 -1
- package/lib/module/i18n/he.json +6 -1
- package/lib/module/i18n/hi.json +6 -1
- package/lib/module/i18n/it.json +6 -1
- package/lib/module/i18n/ja.json +6 -1
- package/lib/module/i18n/ko.json +6 -1
- package/lib/module/i18n/nl.json +6 -1
- package/lib/module/i18n/pt-br.json +6 -1
- package/lib/module/i18n/ru.json +6 -1
- package/lib/module/i18n/tr.json +6 -1
- package/lib/module/icons/index.js +12 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Audio/AudioAttachment.d.ts +1 -0
- package/lib/typescript/components/Attachment/Audio/AudioAttachment.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/ChannelList.d.ts +1 -1
- package/lib/typescript/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/hooks/useCreateChannelsContext.d.ts +1 -1
- package/lib/typescript/components/ChannelList/hooks/useCreateChannelsContext.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewPinnedStatus.d.ts +6 -0
- package/lib/typescript/components/ChannelPreview/ChannelPreviewPinnedStatus.d.ts.map +1 -0
- package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts +3 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/index.d.ts +1 -0
- package/lib/typescript/components/ChannelPreview/hooks/index.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +1 -0
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useIsChannelPinned.d.ts +3 -0
- package/lib/typescript/components/ChannelPreview/hooks/useIsChannelPinned.d.ts.map +1 -0
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageComposer.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/CreatePollHeader.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollButtons.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollModal.d.ts +9 -0
- package/lib/typescript/components/Poll/components/PollModal.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/index.d.ts +1 -0
- package/lib/typescript/components/Poll/components/index.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +1 -0
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +1 -0
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageComposer.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +2 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +2 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/hooks/actions/useChannelActionItems.d.ts +35 -2
- package/lib/typescript/hooks/actions/useChannelActionItems.d.ts.map +1 -1
- package/lib/typescript/hooks/actions/useChannelActionItemsById.d.ts +3 -2
- package/lib/typescript/hooks/actions/useChannelActionItemsById.d.ts.map +1 -1
- package/lib/typescript/i18n/ar.json +6 -1
- package/lib/typescript/i18n/en.json +5 -0
- package/lib/typescript/i18n/es.json +6 -1
- package/lib/typescript/i18n/fr.json +6 -1
- package/lib/typescript/i18n/he.json +6 -1
- package/lib/typescript/i18n/hi.json +6 -1
- package/lib/typescript/i18n/it.json +6 -1
- package/lib/typescript/i18n/ja.json +6 -1
- package/lib/typescript/i18n/ko.json +6 -1
- package/lib/typescript/i18n/nl.json +6 -1
- package/lib/typescript/i18n/pt-br.json +6 -1
- package/lib/typescript/i18n/ru.json +6 -1
- package/lib/typescript/i18n/tr.json +6 -1
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +5 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Attachment/Attachment.tsx +15 -6
- package/src/components/Attachment/Audio/AudioAttachment.tsx +3 -4
- package/src/components/ChannelDetails/__tests__/useChannelDetailsActionItems.test.tsx +6 -2
- package/src/components/ChannelDetails/hooks/useChannelDetailsActionItems.ts +1 -1
- package/src/components/ChannelList/ChannelList.tsx +3 -0
- package/src/components/ChannelList/hooks/useCreateChannelsContext.ts +3 -0
- package/src/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.tsx +3 -2
- package/src/components/ChannelPreview/ChannelPreview.tsx +21 -3
- package/src/components/ChannelPreview/ChannelPreviewPinnedStatus.tsx +25 -0
- package/src/components/ChannelPreview/ChannelPreviewView.tsx +18 -2
- package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +5 -1
- package/src/components/ChannelPreview/hooks/__tests__/useIsChannelPinned.test.tsx +35 -0
- package/src/components/ChannelPreview/hooks/index.ts +1 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +3 -1
- package/src/components/ChannelPreview/hooks/useIsChannelPinned.ts +8 -0
- package/src/components/Message/Message.tsx +68 -22
- package/src/components/Message/MessageItemView/MessageItemView.tsx +5 -116
- package/src/components/Message/MessageItemView/__tests__/MessageItemView.test.tsx +22 -13
- package/src/components/MessageInput/MessageComposer.tsx +9 -30
- package/src/components/MessageMenu/MessageActionList.tsx +1 -1
- package/src/components/Poll/components/CreatePollHeader.tsx +12 -5
- package/src/components/Poll/components/PollButtons.tsx +14 -38
- package/src/components/Poll/components/PollInputDialog.tsx +12 -12
- package/src/components/Poll/components/PollModal.tsx +55 -0
- package/src/components/Poll/components/PollModalHeader.tsx +4 -5
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +6 -18
- package/src/components/Poll/components/__tests__/CreatePollHeader.test.tsx +4 -36
- package/src/components/Poll/components/__tests__/PollModalHeader.test.tsx +8 -45
- package/src/components/Poll/components/index.ts +1 -0
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.tsx.snap +5 -5
- package/src/components/index.ts +1 -0
- package/src/contexts/channelsContext/ChannelsContext.tsx +1 -0
- package/src/contexts/componentsContext/defaultComponents.ts +2 -0
- package/src/contexts/messageInputContext/hooks/useCreateMessageComposer.ts +10 -4
- package/src/contexts/themeContext/utils/theme.ts +4 -0
- package/src/hooks/actions/__tests__/useChannelActionItems.test.tsx +137 -14
- package/src/hooks/actions/__tests__/useChannelActionItemsById.test.tsx +3 -1
- package/src/hooks/actions/useChannelActionItems.tsx +60 -2
- package/src/hooks/actions/useChannelActionItemsById.ts +8 -1
- package/src/i18n/ar.json +6 -1
- package/src/i18n/en.json +5 -0
- package/src/i18n/es.json +6 -1
- package/src/i18n/fr.json +6 -1
- package/src/i18n/he.json +6 -1
- package/src/i18n/hi.json +6 -1
- package/src/i18n/it.json +6 -1
- package/src/i18n/ja.json +6 -1
- package/src/i18n/ko.json +6 -1
- package/src/i18n/nl.json +6 -1
- package/src/i18n/pt-br.json +6 -1
- package/src/i18n/ru.json +6 -1
- package/src/i18n/tr.json +6 -1
- package/src/icons/index.ts +1 -0
- package/src/version.json +1 -1
|
@@ -223,38 +223,47 @@ describe('MessageItemView', () => {
|
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
it('
|
|
226
|
+
it('keeps message-item-view-wrapper free of group-positional padding', async () => {
|
|
227
227
|
const user = generateUser();
|
|
228
228
|
const message = generateMessage({ user });
|
|
229
229
|
|
|
230
230
|
renderMessage({ groupStyles: ['top'], message });
|
|
231
231
|
|
|
232
232
|
await waitFor(() => {
|
|
233
|
-
|
|
233
|
+
const innerStyle = screen.getByTestId('message-item-view-wrapper').props.style;
|
|
234
|
+
expect(innerStyle).toMatchObject({
|
|
234
235
|
alignItems: 'flex-end',
|
|
235
236
|
gap: 8,
|
|
236
237
|
flexDirection: 'row',
|
|
237
|
-
paddingTop: 8,
|
|
238
|
-
paddingBottom: 4,
|
|
239
238
|
});
|
|
239
|
+
expect(innerStyle.paddingTop).toBeUndefined();
|
|
240
|
+
expect(innerStyle.paddingBottom).toBeUndefined();
|
|
240
241
|
});
|
|
241
242
|
});
|
|
242
243
|
|
|
243
|
-
it('
|
|
244
|
+
it('hoists the per-group padding delta onto message-wrapper for top messages', async () => {
|
|
244
245
|
const user = generateUser();
|
|
245
246
|
const message = generateMessage({ user });
|
|
246
247
|
|
|
247
|
-
renderMessage({ message });
|
|
248
|
+
renderMessage({ groupStyles: ['top'], message });
|
|
248
249
|
|
|
249
250
|
await waitFor(() => {
|
|
250
|
-
|
|
251
|
+
expect(screen.getByTestId('message-wrapper').props.style).toEqual(
|
|
252
|
+
expect.arrayContaining([expect.objectContaining({ paddingTop: 8 })]),
|
|
253
|
+
);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
251
256
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
it('hoists the per-group padding delta onto message-wrapper for bottom messages', async () => {
|
|
258
|
+
const user = generateUser();
|
|
259
|
+
const message = generateMessage({ user });
|
|
260
|
+
|
|
261
|
+
renderMessage({ message });
|
|
262
|
+
|
|
263
|
+
await waitFor(() => {
|
|
264
|
+
expect(screen.getByTestId('message-wrapper').props.style).toEqual(
|
|
265
|
+
expect.arrayContaining([expect.objectContaining({ paddingBottom: 8 })]),
|
|
266
|
+
);
|
|
258
267
|
});
|
|
259
268
|
});
|
|
260
269
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
5
4
|
import Animated, {
|
|
6
5
|
Extrapolation,
|
|
7
6
|
interpolate,
|
|
@@ -52,9 +51,9 @@ import { MessageInputHeightState } from '../../state-store/message-input-height-
|
|
|
52
51
|
import { primitives } from '../../theme';
|
|
53
52
|
import { transitions } from '../../utils/animations/transitions';
|
|
54
53
|
import { type TextInputOverrideComponent } from '../AutoCompleteInput/AutoCompleteInput';
|
|
54
|
+
import { PollModal } from '../Poll/components/PollModal';
|
|
55
55
|
import { CreatePoll } from '../Poll/CreatePollContent';
|
|
56
56
|
import { PortalWhileClosingView } from '../UIComponents/PortalWhileClosingView';
|
|
57
|
-
import { SafeAreaViewWrapper } from '../UIComponents/SafeAreaViewWrapper';
|
|
58
57
|
|
|
59
58
|
const useStyles = () => {
|
|
60
59
|
const {
|
|
@@ -67,16 +66,6 @@ const useStyles = () => {
|
|
|
67
66
|
flexShrink: 1,
|
|
68
67
|
minWidth: 0,
|
|
69
68
|
},
|
|
70
|
-
pollModalWrapper: {
|
|
71
|
-
alignItems: 'center',
|
|
72
|
-
flex: 1,
|
|
73
|
-
justifyContent: 'center',
|
|
74
|
-
backgroundColor: semantics.backgroundCoreElevation1,
|
|
75
|
-
},
|
|
76
|
-
pollSafeArea: {
|
|
77
|
-
flex: 1,
|
|
78
|
-
backgroundColor: semantics.backgroundCoreElevation1,
|
|
79
|
-
},
|
|
80
69
|
container: {
|
|
81
70
|
alignItems: 'center',
|
|
82
71
|
flexDirection: 'row',
|
|
@@ -457,23 +446,13 @@ const MessageComposerWithContext = (props: MessageComposerPropsWithContext) => {
|
|
|
457
446
|
</Animated.View>
|
|
458
447
|
|
|
459
448
|
{showPollCreationDialog ? (
|
|
460
|
-
<
|
|
461
|
-
<
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
<SafeAreaViewWrapper style={styles.pollSafeArea}>
|
|
468
|
-
<CreatePoll
|
|
469
|
-
closePollCreationDialog={closePollCreationDialog}
|
|
470
|
-
createPollOptionGap={createPollOptionGap}
|
|
471
|
-
sendMessage={sendMessage}
|
|
472
|
-
/>
|
|
473
|
-
</SafeAreaViewWrapper>
|
|
474
|
-
</GestureHandlerRootView>
|
|
475
|
-
</Modal>
|
|
476
|
-
</View>
|
|
449
|
+
<PollModal onRequestClose={closePollCreationDialog} visible={showPollCreationDialog}>
|
|
450
|
+
<CreatePoll
|
|
451
|
+
closePollCreationDialog={closePollCreationDialog}
|
|
452
|
+
createPollOptionGap={createPollOptionGap}
|
|
453
|
+
sendMessage={sendMessage}
|
|
454
|
+
/>
|
|
455
|
+
</PollModal>
|
|
477
456
|
) : null}
|
|
478
457
|
</MicPositionProvider>
|
|
479
458
|
);
|
|
@@ -4,7 +4,7 @@ import { StyleSheet, Text, View } from 'react-native';
|
|
|
4
4
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
5
5
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
6
6
|
import { Check, IconProps } from '../../../icons';
|
|
7
|
-
import {
|
|
7
|
+
import { Cross } from '../../../icons/xmark-1';
|
|
8
8
|
import { primitives } from '../../../theme';
|
|
9
9
|
import { Button } from '../../ui';
|
|
10
10
|
import { useCanCreatePoll } from '../hooks/useCanCreatePoll';
|
|
@@ -43,9 +43,16 @@ export const CreatePollHeader = ({
|
|
|
43
43
|
|
|
44
44
|
const renderSendPollIcon = useCallback(
|
|
45
45
|
(props: IconProps) => {
|
|
46
|
-
return
|
|
46
|
+
return (
|
|
47
|
+
<Check
|
|
48
|
+
{...props}
|
|
49
|
+
height={18}
|
|
50
|
+
stroke={canCreatePoll ? semantics.textOnAccent : semantics.textDisabled}
|
|
51
|
+
width={18}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
47
54
|
},
|
|
48
|
-
[semantics.textOnAccent],
|
|
55
|
+
[canCreatePoll, semantics.textOnAccent, semantics.textDisabled],
|
|
49
56
|
);
|
|
50
57
|
|
|
51
58
|
return (
|
|
@@ -54,9 +61,9 @@ export const CreatePollHeader = ({
|
|
|
54
61
|
accessibilityLabelKey='a11y/Close poll creation'
|
|
55
62
|
variant='secondary'
|
|
56
63
|
onPress={onBackPressHandler}
|
|
57
|
-
type='
|
|
64
|
+
type='outline'
|
|
58
65
|
size='md'
|
|
59
|
-
LeadingIcon={
|
|
66
|
+
LeadingIcon={Cross}
|
|
60
67
|
iconOnly
|
|
61
68
|
/>
|
|
62
69
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { GenericPollButton, PollButtonProps } from './Button';
|
|
6
5
|
import { PollAnswersList } from './PollAnswersList';
|
|
7
6
|
import { PollInputDialog } from './PollInputDialog';
|
|
7
|
+
import { PollModal } from './PollModal';
|
|
8
8
|
import { PollModalHeader } from './PollModalHeader';
|
|
9
9
|
import { PollAllOptions } from './PollOption';
|
|
10
10
|
import { PollResults } from './PollResults';
|
|
@@ -12,7 +12,6 @@ import { PollResults } from './PollResults';
|
|
|
12
12
|
import { useChatContext, usePollContext, useTheme, useTranslationContext } from '../../../contexts';
|
|
13
13
|
import { primitives } from '../../../theme';
|
|
14
14
|
import { defaultPollOptionCount } from '../../../utils/constants';
|
|
15
|
-
import { SafeAreaViewWrapper } from '../../UIComponents/SafeAreaViewWrapper';
|
|
16
15
|
import {
|
|
17
16
|
useAddCommentOpen,
|
|
18
17
|
useAllCommentsOpen,
|
|
@@ -51,14 +50,10 @@ export const ViewResultsButton = (props: PollButtonProps) => {
|
|
|
51
50
|
type='outline'
|
|
52
51
|
/>
|
|
53
52
|
{showResults ? (
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<PollResults message={message} poll={poll} />
|
|
59
|
-
</SafeAreaViewWrapper>
|
|
60
|
-
</GestureHandlerRootView>
|
|
61
|
-
</Modal>
|
|
53
|
+
<PollModal onRequestClose={closeViewResults} visible={showResults}>
|
|
54
|
+
<PollModalHeader onPress={closeViewResults} title={t('Poll Results')} />
|
|
55
|
+
<PollResults message={message} poll={poll} />
|
|
56
|
+
</PollModal>
|
|
62
57
|
) : null}
|
|
63
58
|
</>
|
|
64
59
|
);
|
|
@@ -81,8 +76,6 @@ export const ShowAllOptionsButton = (props: PollButtonProps) => {
|
|
|
81
76
|
openAllOptions();
|
|
82
77
|
}, [message, onPress, openAllOptions, poll]);
|
|
83
78
|
|
|
84
|
-
const styles = useStyles();
|
|
85
|
-
|
|
86
79
|
return (
|
|
87
80
|
<>
|
|
88
81
|
{options && options.length > defaultPollOptionCount ? (
|
|
@@ -92,14 +85,10 @@ export const ShowAllOptionsButton = (props: PollButtonProps) => {
|
|
|
92
85
|
/>
|
|
93
86
|
) : null}
|
|
94
87
|
{showAllOptions ? (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<PollAllOptions message={message} poll={poll} />
|
|
100
|
-
</SafeAreaViewWrapper>
|
|
101
|
-
</GestureHandlerRootView>
|
|
102
|
-
</Modal>
|
|
88
|
+
<PollModal onRequestClose={closeAllOptions} visible={showAllOptions}>
|
|
89
|
+
<PollModalHeader onPress={closeAllOptions} title={t('Poll Options')} />
|
|
90
|
+
<PollAllOptions message={message} poll={poll} />
|
|
91
|
+
</PollModal>
|
|
103
92
|
) : null}
|
|
104
93
|
</>
|
|
105
94
|
);
|
|
@@ -122,8 +111,6 @@ export const ShowAllCommentsButton = (props: PollButtonProps) => {
|
|
|
122
111
|
openAllComments();
|
|
123
112
|
}, [message, onPress, openAllComments, poll]);
|
|
124
113
|
|
|
125
|
-
const styles = useStyles();
|
|
126
|
-
|
|
127
114
|
return (
|
|
128
115
|
<>
|
|
129
116
|
{answersCount && answersCount > 0 ? (
|
|
@@ -133,14 +120,10 @@ export const ShowAllCommentsButton = (props: PollButtonProps) => {
|
|
|
133
120
|
/>
|
|
134
121
|
) : null}
|
|
135
122
|
{showAnswers ? (
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<PollAnswersList message={message} poll={poll} />
|
|
141
|
-
</SafeAreaViewWrapper>
|
|
142
|
-
</GestureHandlerRootView>
|
|
143
|
-
</Modal>
|
|
123
|
+
<PollModal onRequestClose={closeAllComments} visible={showAnswers}>
|
|
124
|
+
<PollModalHeader onPress={closeAllComments} title={t('Poll Comments')} />
|
|
125
|
+
<PollAnswersList message={message} poll={poll} />
|
|
126
|
+
</PollModal>
|
|
144
127
|
) : null}
|
|
145
128
|
</>
|
|
146
129
|
);
|
|
@@ -254,9 +237,6 @@ const useStyles = () => {
|
|
|
254
237
|
return useMemo(() => {
|
|
255
238
|
return StyleSheet.create({
|
|
256
239
|
buttonsContainer: { gap: primitives.spacingXs },
|
|
257
|
-
modalRoot: {
|
|
258
|
-
flex: 1,
|
|
259
|
-
},
|
|
260
240
|
endVoteButton: {
|
|
261
241
|
borderColor: isPollCreatedByClient
|
|
262
242
|
? semantics.chatBorderOnChatOutgoing
|
|
@@ -267,10 +247,6 @@ const useStyles = () => {
|
|
|
267
247
|
? semantics.chatBorderOnChatOutgoing
|
|
268
248
|
: semantics.chatBorderOnChatIncoming,
|
|
269
249
|
},
|
|
270
|
-
safeArea: {
|
|
271
|
-
backgroundColor: semantics.backgroundCoreElevation1,
|
|
272
|
-
flex: 1,
|
|
273
|
-
},
|
|
274
250
|
});
|
|
275
251
|
}, [semantics, isPollCreatedByClient]);
|
|
276
252
|
};
|
|
@@ -72,19 +72,11 @@ export const PollInputDialog = ({
|
|
|
72
72
|
/>
|
|
73
73
|
</View>
|
|
74
74
|
<View style={[styles.buttonContainer, buttonContainer]}>
|
|
75
|
-
<Button
|
|
76
|
-
variant={'secondary'}
|
|
77
|
-
type={'ghost'}
|
|
78
|
-
label={t('Cancel')}
|
|
79
|
-
size='md'
|
|
80
|
-
onPress={closeDialog}
|
|
81
|
-
style={styles.button}
|
|
82
|
-
/>
|
|
83
75
|
<Button
|
|
84
76
|
variant={'primary'}
|
|
85
77
|
type={'solid'}
|
|
86
78
|
label={t('Send')}
|
|
87
|
-
size='
|
|
79
|
+
size='lg'
|
|
88
80
|
onPress={() => {
|
|
89
81
|
onSubmit(dialogInput);
|
|
90
82
|
closeDialog();
|
|
@@ -92,6 +84,14 @@ export const PollInputDialog = ({
|
|
|
92
84
|
style={styles.button}
|
|
93
85
|
disabled={!dialogInput}
|
|
94
86
|
/>
|
|
87
|
+
<Button
|
|
88
|
+
variant={'secondary'}
|
|
89
|
+
type={'outline'}
|
|
90
|
+
label={t('Cancel')}
|
|
91
|
+
size='lg'
|
|
92
|
+
onPress={closeDialog}
|
|
93
|
+
style={styles.button}
|
|
94
|
+
/>
|
|
95
95
|
</View>
|
|
96
96
|
</Animated.View>
|
|
97
97
|
</KeyboardAvoidingView>
|
|
@@ -112,8 +112,8 @@ const useStyles = () => {
|
|
|
112
112
|
return useMemo(
|
|
113
113
|
() =>
|
|
114
114
|
StyleSheet.create({
|
|
115
|
-
button: {
|
|
116
|
-
buttonContainer: {
|
|
115
|
+
button: { width: undefined, ...button },
|
|
116
|
+
buttonContainer: { gap: primitives.spacingXs },
|
|
117
117
|
container: {
|
|
118
118
|
backgroundColor: semantics.backgroundCoreElevation1,
|
|
119
119
|
borderRadius: primitives.radiusXl,
|
|
@@ -132,7 +132,7 @@ const useStyles = () => {
|
|
|
132
132
|
input: {
|
|
133
133
|
alignItems: 'center',
|
|
134
134
|
borderColor: semantics.borderUtilityActive,
|
|
135
|
-
borderRadius: primitives.
|
|
135
|
+
borderRadius: primitives.radiusLg,
|
|
136
136
|
borderWidth: 1,
|
|
137
137
|
fontSize: primitives.typographyFontSizeMd,
|
|
138
138
|
padding: primitives.spacingSm,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useMemo } from 'react';
|
|
2
|
+
import { Modal, ModalProps, StyleSheet } from 'react-native';
|
|
3
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
4
|
+
|
|
5
|
+
import { useTheme } from '../../../contexts';
|
|
6
|
+
import { SafeAreaViewWrapper } from '../../UIComponents/SafeAreaViewWrapper';
|
|
7
|
+
|
|
8
|
+
export type PollModalProps = PropsWithChildren<{
|
|
9
|
+
animationType?: ModalProps['animationType'];
|
|
10
|
+
onRequestClose?: () => void;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export const PollModal = ({
|
|
15
|
+
animationType = 'slide',
|
|
16
|
+
children,
|
|
17
|
+
onRequestClose,
|
|
18
|
+
visible,
|
|
19
|
+
}: PollModalProps) => {
|
|
20
|
+
const styles = useStyles();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Modal
|
|
24
|
+
animationType={animationType}
|
|
25
|
+
navigationBarTranslucent
|
|
26
|
+
onRequestClose={onRequestClose}
|
|
27
|
+
presentationStyle='pageSheet'
|
|
28
|
+
statusBarTranslucent
|
|
29
|
+
visible={visible}
|
|
30
|
+
>
|
|
31
|
+
<GestureHandlerRootView style={styles.root}>
|
|
32
|
+
<SafeAreaViewWrapper style={styles.safeArea}>{children}</SafeAreaViewWrapper>
|
|
33
|
+
</GestureHandlerRootView>
|
|
34
|
+
</Modal>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const useStyles = () => {
|
|
39
|
+
const {
|
|
40
|
+
theme: { semantics },
|
|
41
|
+
} = useTheme();
|
|
42
|
+
return useMemo(
|
|
43
|
+
() =>
|
|
44
|
+
StyleSheet.create({
|
|
45
|
+
root: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
},
|
|
48
|
+
safeArea: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
backgroundColor: semantics.backgroundCoreElevation1,
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
[semantics],
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../../../contexts';
|
|
5
|
-
import {
|
|
5
|
+
import { Cross } from '../../../icons/xmark-1';
|
|
6
6
|
import { primitives } from '../../../theme';
|
|
7
7
|
import { Button } from '../../ui';
|
|
8
8
|
|
|
@@ -27,10 +27,10 @@ export const PollModalHeader = ({ onPress, title }: PollModalHeaderProps) => {
|
|
|
27
27
|
<Button
|
|
28
28
|
accessibilityLabelKey='a11y/Close poll'
|
|
29
29
|
variant='secondary'
|
|
30
|
-
type='
|
|
30
|
+
type='outline'
|
|
31
31
|
size='md'
|
|
32
32
|
iconOnly
|
|
33
|
-
LeadingIcon={
|
|
33
|
+
LeadingIcon={Cross}
|
|
34
34
|
onPress={onPress}
|
|
35
35
|
testID='poll-results-close-button'
|
|
36
36
|
/>
|
|
@@ -56,8 +56,7 @@ const useStyles = () => {
|
|
|
56
56
|
alignItems: 'center',
|
|
57
57
|
flexDirection: 'row',
|
|
58
58
|
justifyContent: 'space-between',
|
|
59
|
-
|
|
60
|
-
paddingVertical: 10,
|
|
59
|
+
padding: primitives.spacingMd,
|
|
61
60
|
backgroundColor: semantics.backgroundCoreElevation1,
|
|
62
61
|
},
|
|
63
62
|
centerContainer: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { LocalMessage, Poll, PollOption, PollVote as PollVoteClass } from 'stream-chat';
|
|
6
5
|
|
|
@@ -15,9 +14,9 @@ import {
|
|
|
15
14
|
} from '../../../../contexts';
|
|
16
15
|
|
|
17
16
|
import { primitives } from '../../../../theme';
|
|
18
|
-
import { SafeAreaViewWrapper } from '../../../UIComponents/SafeAreaViewWrapper';
|
|
19
17
|
import { usePollState } from '../../hooks/usePollState';
|
|
20
18
|
import { GenericPollButton } from '../Button';
|
|
19
|
+
import { PollModal } from '../PollModal';
|
|
21
20
|
import { PollModalHeader } from '../PollModalHeader';
|
|
22
21
|
|
|
23
22
|
export type ShowAllVotesButtonProps = {
|
|
@@ -62,18 +61,14 @@ export const ShowAllVotesButton = (props: ShowAllVotesButtonProps) => {
|
|
|
62
61
|
</View>
|
|
63
62
|
) : null}
|
|
64
63
|
{showAllVotes ? (
|
|
65
|
-
<
|
|
64
|
+
<PollModal
|
|
66
65
|
animationType='fade'
|
|
67
66
|
onRequestClose={() => setShowAllVotes(false)}
|
|
68
67
|
visible={showAllVotes}
|
|
69
68
|
>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<PollOptionFullResults message={message} option={option} poll={poll} />
|
|
74
|
-
</SafeAreaViewWrapper>
|
|
75
|
-
</GestureHandlerRootView>
|
|
76
|
-
</Modal>
|
|
69
|
+
<PollModalHeader onPress={() => setShowAllVotes(false)} title={t('Votes')} />
|
|
70
|
+
<PollOptionFullResults message={message} option={option} poll={poll} />
|
|
71
|
+
</PollModal>
|
|
77
72
|
) : null}
|
|
78
73
|
</>
|
|
79
74
|
);
|
|
@@ -156,9 +151,6 @@ const useStyles = () => {
|
|
|
156
151
|
alignItems: 'center',
|
|
157
152
|
paddingBottom: primitives.spacingXs,
|
|
158
153
|
},
|
|
159
|
-
modalRoot: {
|
|
160
|
-
flex: 1,
|
|
161
|
-
},
|
|
162
154
|
title: {
|
|
163
155
|
flex: 1,
|
|
164
156
|
fontSize: primitives.typographyFontSizeLg,
|
|
@@ -183,10 +175,6 @@ const useStyles = () => {
|
|
|
183
175
|
marginStart: primitives.spacingMd,
|
|
184
176
|
textAlign: 'left',
|
|
185
177
|
},
|
|
186
|
-
safeArea: {
|
|
187
|
-
backgroundColor: semantics.backgroundCoreElevation1,
|
|
188
|
-
flex: 1,
|
|
189
|
-
},
|
|
190
178
|
inlineButton: {
|
|
191
179
|
borderColor: semantics.borderCoreDefault,
|
|
192
180
|
borderTopWidth: 1,
|
|
@@ -43,39 +43,8 @@ const collectPathData = (node: unknown): string[] => {
|
|
|
43
43
|
return [...(typeof props?.d === 'string' ? [props.d] : []), ...collectPathData(children)];
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const collectTransforms = (node: unknown): string[] => {
|
|
47
|
-
if (!node || typeof node !== 'object') {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (Array.isArray(node)) {
|
|
52
|
-
return node.reduce<string[]>((acc, child) => [...acc, ...collectTransforms(child)], []);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const { children, props } = node as {
|
|
56
|
-
children?: unknown;
|
|
57
|
-
props?: { style?: StyleProp<ViewStyle> };
|
|
58
|
-
};
|
|
59
|
-
const style = StyleSheet.flatten(props?.style);
|
|
60
|
-
const styleTransforms = Array.isArray(style?.transform)
|
|
61
|
-
? style.transform.flatMap((transform) => {
|
|
62
|
-
if (
|
|
63
|
-
transform &&
|
|
64
|
-
typeof transform === 'object' &&
|
|
65
|
-
'rotate' in transform &&
|
|
66
|
-
typeof transform.rotate === 'string'
|
|
67
|
-
) {
|
|
68
|
-
return [transform.rotate];
|
|
69
|
-
}
|
|
70
|
-
return [];
|
|
71
|
-
})
|
|
72
|
-
: [];
|
|
73
|
-
|
|
74
|
-
return [...styleTransforms, ...collectTransforms(children)];
|
|
75
|
-
};
|
|
76
|
-
|
|
77
46
|
describe('CreatePollHeader', () => {
|
|
78
|
-
it('renders a secondary
|
|
47
|
+
it('renders a secondary outline cross close button', () => {
|
|
79
48
|
render(
|
|
80
49
|
<ThemeProvider>
|
|
81
50
|
<CreatePollHeader onBackPressHandler={jest.fn()} onCreatePollPressHandler={jest.fn()} />
|
|
@@ -84,11 +53,10 @@ describe('CreatePollHeader', () => {
|
|
|
84
53
|
|
|
85
54
|
const style = getCloseButtonWrapperStyle();
|
|
86
55
|
expect(style.backgroundColor).toBeUndefined();
|
|
87
|
-
expect(style.borderWidth).
|
|
88
|
-
expect(style.borderColor).
|
|
56
|
+
expect(style.borderWidth).toBe(1);
|
|
57
|
+
expect(style.borderColor).toBeDefined();
|
|
89
58
|
expect(collectPathData(screen.toJSON())).toContain(
|
|
90
|
-
'
|
|
59
|
+
'M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375',
|
|
91
60
|
);
|
|
92
|
-
expect(collectTransforms(screen.toJSON())).toContain('-90deg');
|
|
93
61
|
});
|
|
94
62
|
});
|
|
@@ -47,41 +47,6 @@ const collectPathData = (node: unknown): string[] => {
|
|
|
47
47
|
return [...(typeof props?.d === 'string' ? [props.d] : []), ...collectPathData(children)];
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const collectTransforms = (node: unknown): string[] => {
|
|
51
|
-
if (!node || typeof node !== 'object') {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (Array.isArray(node)) {
|
|
56
|
-
return node.reduce<string[]>((acc, child) => [...acc, ...collectTransforms(child)], []);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const { children, props } = node as {
|
|
60
|
-
children?: unknown;
|
|
61
|
-
props?: { style?: StyleProp<ViewStyle>; transform?: unknown };
|
|
62
|
-
};
|
|
63
|
-
const style = StyleSheet.flatten(props?.style);
|
|
64
|
-
const styleTransforms = Array.isArray(style?.transform)
|
|
65
|
-
? style.transform.flatMap((transform) => {
|
|
66
|
-
if (
|
|
67
|
-
transform &&
|
|
68
|
-
typeof transform === 'object' &&
|
|
69
|
-
'rotate' in transform &&
|
|
70
|
-
typeof transform.rotate === 'string'
|
|
71
|
-
) {
|
|
72
|
-
return [transform.rotate];
|
|
73
|
-
}
|
|
74
|
-
return [];
|
|
75
|
-
})
|
|
76
|
-
: [];
|
|
77
|
-
|
|
78
|
-
return [
|
|
79
|
-
...(typeof props?.transform === 'string' ? [props.transform] : []),
|
|
80
|
-
...styleTransforms,
|
|
81
|
-
...collectTransforms(children),
|
|
82
|
-
];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
50
|
const renderPollModalHeader = () =>
|
|
86
51
|
render(
|
|
87
52
|
<ThemeProvider>
|
|
@@ -94,33 +59,31 @@ describe('PollModalHeader', () => {
|
|
|
94
59
|
setPlatform(originalPlatform);
|
|
95
60
|
});
|
|
96
61
|
|
|
97
|
-
it('renders a secondary
|
|
62
|
+
it('renders a secondary outline cross button outside Android', () => {
|
|
98
63
|
setPlatform('ios');
|
|
99
64
|
|
|
100
65
|
renderPollModalHeader();
|
|
101
66
|
|
|
102
67
|
const style = getCloseButtonWrapperStyle();
|
|
103
68
|
expect(style.backgroundColor).toBeUndefined();
|
|
104
|
-
expect(style.borderWidth).
|
|
105
|
-
expect(style.borderColor).
|
|
69
|
+
expect(style.borderWidth).toBe(1);
|
|
70
|
+
expect(style.borderColor).toBeDefined();
|
|
106
71
|
expect(collectPathData(screen.toJSON())).toContain(
|
|
107
|
-
'
|
|
72
|
+
'M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375',
|
|
108
73
|
);
|
|
109
|
-
expect(collectTransforms(screen.toJSON())).toContain('-90deg');
|
|
110
74
|
});
|
|
111
75
|
|
|
112
|
-
it('renders a secondary
|
|
76
|
+
it('renders a secondary outline cross button on Android', () => {
|
|
113
77
|
setPlatform('android');
|
|
114
78
|
|
|
115
79
|
renderPollModalHeader();
|
|
116
80
|
|
|
117
81
|
const style = getCloseButtonWrapperStyle();
|
|
118
82
|
expect(style.backgroundColor).toBeUndefined();
|
|
119
|
-
expect(style.borderWidth).
|
|
120
|
-
expect(style.borderColor).
|
|
83
|
+
expect(style.borderWidth).toBe(1);
|
|
84
|
+
expect(style.borderColor).toBeDefined();
|
|
121
85
|
expect(collectPathData(screen.toJSON())).toContain(
|
|
122
|
-
'
|
|
86
|
+
'M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375',
|
|
123
87
|
);
|
|
124
|
-
expect(collectTransforms(screen.toJSON())).toContain('-90deg');
|
|
125
88
|
});
|
|
126
89
|
});
|