stream-chat-react-native-core 9.0.0-beta.15 → 9.0.0-beta.16
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/AttachmentPicker/components/AttachmentPickerContent.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +17 -2
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +5 -4
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +26 -31
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +65 -36
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +3 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js +4 -2
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -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/AttachmentPicker/components/AttachmentPickerContent.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +17 -2
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +5 -4
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +26 -31
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +65 -36
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +1 -1
- package/lib/module/components/Message/utils/messageActions.js +1 -1
- package/lib/module/components/Message/utils/messageActions.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js +3 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.js +4 -2
- package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -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/ChannelPreview/ChannelDetailsBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewMessage.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts +3 -2
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +2 -2
- package/src/components/AttachmentPicker/components/AttachmentTypePickerButton.tsx +2 -2
- package/src/components/ChannelList/hooks/__tests__/useChannelActionItems.test.tsx +2 -2
- package/src/components/ChannelList/hooks/useChannelActionItems.tsx +1 -1
- package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +15 -1
- package/src/components/ChannelPreview/ChannelPreviewMessage.tsx +7 -2
- package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +26 -29
- package/src/components/ChannelPreview/__tests__/ChannelSwipableWrapper.test.tsx +201 -0
- package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +43 -25
- package/src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx +1 -7
- package/src/components/Message/utils/messageActions.ts +1 -1
- package/src/components/MessageMenu/MessageUserReactions.tsx +3 -1
- package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +9 -2
- package/src/components/UIComponents/BottomSheetModal.tsx +4 -2
- package/src/icons/index.ts +1 -0
- package/src/version.json +1 -1
package/lib/module/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelDetailsBottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ChannelDetailsBottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAUtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAQ/E,MAAM,MAAM,yBAAyB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,uBAAuB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtE,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,aAAa,yBAAyB,sBAoC1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,UAAU;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,sBAuB1E,CAAC;AAQF,eAAO,MAAM,yBAAyB,GAAI,mGAKvC,8BAA8B,sBAchC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelPreviewMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelPreviewMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOhE,OAAO,EACL,oBAAoB,EAErB,MAAM,gDAAgD,CAAC;AAUxD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAC3E,OAAO,CACL,IAAI,CACF,oBAAoB,EACpB,wBAAwB,GAAG,8BAA8B,GAAG,oBAAoB,CACjF,CACF,GAAG;IACF,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,
|
|
1
|
+
{"version":3,"file":"ChannelPreviewMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelPreviewMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOhE,OAAO,EACL,oBAAoB,EAErB,MAAM,gDAAgD,CAAC;AAUxD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAC3E,OAAO,CACL,IAAI,CACF,oBAAoB,EACpB,wBAAwB,GAAG,8BAA8B,GAAG,oBAAoB,CACjF,CACF,GAAG;IACF,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAAI,OAAO,0BAA0B,sBAqGtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelSwipableWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelSwipableWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAKjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ChannelSwipableWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/ChannelPreview/ChannelSwipableWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAKjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAMlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGnF,OAAO,EAKL,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,wBAAwB,yBAKpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,6IAMpC,iBAAiB,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,yBAAyB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC;IAChF,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,aAAa,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;CACvD,CAAC,sBAuFD,CAAC"}
|
|
@@ -23,11 +23,12 @@ export declare class KeyboardCompatibleView extends React.Component<KeyboardAvoi
|
|
|
23
23
|
_initialFrameHeight: number;
|
|
24
24
|
_bottom: number;
|
|
25
25
|
constructor(props: KeyboardAvoidingViewProps);
|
|
26
|
-
_relativeKeyboardHeight(keyboardFrame: KeyboardMetrics): number
|
|
26
|
+
_relativeKeyboardHeight(keyboardFrame: KeyboardMetrics): Promise<number>;
|
|
27
27
|
_onKeyboardChange: KeyboardEventListener;
|
|
28
|
+
_onKeyboardHide: KeyboardEventListener;
|
|
28
29
|
_onLayout: (event: LayoutChangeEvent) => void;
|
|
29
30
|
_setBottom: (value: number) => void;
|
|
30
|
-
_updateBottomIfNecessary: () => void
|
|
31
|
+
_updateBottomIfNecessary: () => Promise<void>;
|
|
31
32
|
_handleAppStateChange: (nextAppState: AppStateStatus) => void;
|
|
32
33
|
setKeyboardListeners: () => void;
|
|
33
34
|
unsetKeyboardListeners: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardCompatibleView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"KeyboardCompatibleView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,cAAc,EAEd,mBAAmB,EAEnB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,eAAe,EAEf,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EAIvB,IAAI,EACL,MAAM,cAAc,CAAC;AAItB,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK,CAAC,SAAS,CACzD,yBAAyB,EACzB;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,CACtE;IACC,MAAM,CAAC,YAAY,EAAE,IAAI,CACvB,yBAAyB,EACzB,UAAU,GAAG,SAAS,GAAG,wBAAwB,CAClD,CAIC;IAEF,MAAM,EAAE,eAAe,GAAG,IAAI,CAAQ;IACtC,cAAc,EAAE,aAAa,GAAG,IAAI,CAAQ;IAC5C,cAAc,EAAE,mBAAmB,EAAE,CAAM;IAC3C,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,CAAQ;IAC7D,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACtC,mBAAmB,SAAK;IACxB,OAAO,EAAE,MAAM,CAAK;gBAER,KAAK,EAAE,yBAAyB;IAUtC,uBAAuB,CAAC,aAAa,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAoC9E,iBAAiB,EAAE,qBAAqB,CAGtC;IAEF,eAAe,EAAE,qBAAqB,CAGpC;IAEF,SAAS,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAkB3C;IAGF,UAAU,GAAI,OAAO,MAAM,UAMzB;IAEF,wBAAwB,sBA0BtB;IAEF,qBAAqB,GAAI,cAAc,cAAc,UAUnD;IAEF,oBAAoB,aAqBlB;IAEF,sBAAsB,aAKpB;IAEF,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAa9C;IAEF,kBAAkB,CAAC,CAAC,EAAE,yBAAyB,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI;IAOxE,iBAAiB;IAUjB,oBAAoB;IAapB,oBAAoB;+BA7CG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS;MA6CiB;IAEjE,MAAM;CAqEP"}
|
package/lib/typescript/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardControllerAvoidingView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"KeyboardControllerAvoidingView.d.ts","sourceRoot":"","sources":["../../../../src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAEL,yBAAyB,IAAI,oCAAoC,EAClE,MAAM,cAAc,CAAC;AAItB,KAAK,4BAA4B,GAAG;IAClC,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC,CAAC;AAYF,MAAM,MAAM,2BAA2B,GAAG,oCAAoC,GAC5E,4BAA4B,CAAC;AAE/B,QAAA,MAAM,yBAAyB,+DAA8C,CAAC;AAK9E,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,sBA4BxE,CAAC;AAEF,eAAO,MAAM,eAAe,YAK3B,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageUserReactions.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageMenu/MessageUserReactions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAajF,OAAO,EACL,mBAAmB,EAEpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,oBAAoB,EAErB,MAAM,gDAAgD,CAAC;AAOxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAajD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,IAAI,CACF,oBAAoB,EACpB,4BAA4B,GAAG,0BAA0B,GAAG,oBAAoB,CACjF,CACF,GACC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC,GAAG;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAMJ,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACpD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,OAAO,wBAAwB,sBAc/E,CAAC;AAgBF,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,
|
|
1
|
+
{"version":3,"file":"MessageUserReactions.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageMenu/MessageUserReactions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAajF,OAAO,EACL,mBAAmB,EAEpB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,oBAAoB,EAErB,MAAM,gDAAgD,CAAC;AAOxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAajD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,IAAI,CACF,oBAAoB,EACpB,4BAA4B,GAAG,0BAA0B,GAAG,oBAAoB,CACjF,CACF,GACC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC,GAAG;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAMJ,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACpD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,OAAO,wBAAwB,sBAc/E,CAAC;AAgBF,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,sBA4NpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UIComponents/BottomSheetModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AA+BhG,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,iBAAiB,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"BottomSheetModal.d.ts","sourceRoot":"","sources":["../../../../src/components/UIComponents/BottomSheetModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AA+BhG,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,iBAAiB,CAAC,qBAAqB,CAAC,sBAsW/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "9.0.0-beta.
|
|
4
|
+
"version": "9.0.0-beta.16",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '../../../contexts';
|
|
22
22
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
23
23
|
import { useAttachmentPickerState, useStableCallback } from '../../../hooks';
|
|
24
|
-
import { Camera, FilePickerIcon, PollThumbnail,
|
|
24
|
+
import { Camera, FilePickerIcon, PollThumbnail, VideoIcon } from '../../../icons';
|
|
25
25
|
import { primitives } from '../../../theme';
|
|
26
26
|
import { CommandSuggestionItem } from '../../AutoCompleteInput/AutoCompleteSuggestionItem';
|
|
27
27
|
|
|
@@ -197,7 +197,7 @@ export const AttachmentCameraPicker = (
|
|
|
197
197
|
/>
|
|
198
198
|
) : (
|
|
199
199
|
<AttachmentPickerGenericContent
|
|
200
|
-
Icon={videoOnly ?
|
|
200
|
+
Icon={videoOnly ? VideoIcon : Camera}
|
|
201
201
|
onPress={openCameraPicker}
|
|
202
202
|
height={height}
|
|
203
203
|
buttonText={t('Open Camera')}
|
|
@@ -19,7 +19,7 @@ import { useAttachmentPickerState } from '../../../hooks/useAttachmentPickerStat
|
|
|
19
19
|
import {
|
|
20
20
|
Camera,
|
|
21
21
|
Picture,
|
|
22
|
-
|
|
22
|
+
VideoIcon,
|
|
23
23
|
FilePickerIcon,
|
|
24
24
|
PollThumbnail,
|
|
25
25
|
CommandsIcon,
|
|
@@ -121,7 +121,7 @@ export const CameraPickerButton = () => {
|
|
|
121
121
|
/>
|
|
122
122
|
{Platform.OS === 'android' ? (
|
|
123
123
|
<AttachmentTypePickerButton
|
|
124
|
-
Icon={
|
|
124
|
+
Icon={VideoIcon}
|
|
125
125
|
selected={selectedPicker === 'camera-video'}
|
|
126
126
|
onPress={onVideoRecorderPickerPress}
|
|
127
127
|
/>
|
|
@@ -110,7 +110,7 @@ describe('useChannelActionItems', () => {
|
|
|
110
110
|
'destructive',
|
|
111
111
|
]);
|
|
112
112
|
expect(result.current.map((item) => item.placement)).toEqual([
|
|
113
|
-
'
|
|
113
|
+
'swipe',
|
|
114
114
|
'both',
|
|
115
115
|
'sheet',
|
|
116
116
|
'sheet',
|
|
@@ -266,7 +266,7 @@ describe('getChannelActionItems', () => {
|
|
|
266
266
|
|
|
267
267
|
expect(actionItems[0].action).toBe(channelActions.unmuteChannel);
|
|
268
268
|
expect(actionItems[0].label).toBe('Unmute Group');
|
|
269
|
-
expect(actionItems[0].placement).toBe('
|
|
269
|
+
expect(actionItems[0].placement).toBe('swipe');
|
|
270
270
|
|
|
271
271
|
expect(actionItems[1].action).toBe(channelActions.unarchive);
|
|
272
272
|
expect(actionItems[1].label).toBe('Unarchive Group');
|
|
@@ -112,7 +112,7 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
|
|
|
112
112
|
: muteActive
|
|
113
113
|
? t('Unmute Group')
|
|
114
114
|
: t('Mute Group'),
|
|
115
|
-
placement: isDirectChat ? 'sheet' : '
|
|
115
|
+
placement: isDirectChat ? 'sheet' : 'swipe',
|
|
116
116
|
type: 'standard',
|
|
117
117
|
},
|
|
118
118
|
];
|
|
@@ -6,7 +6,9 @@ import { Pressable } from 'react-native-gesture-handler';
|
|
|
6
6
|
|
|
7
7
|
import { Channel } from 'stream-chat';
|
|
8
8
|
|
|
9
|
+
import { ChannelPreviewMutedStatus } from './ChannelPreviewMutedStatus';
|
|
9
10
|
import { ChannelPreviewTitle } from './ChannelPreviewTitle';
|
|
11
|
+
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
10
12
|
|
|
11
13
|
import { useBottomSheetContext, useTheme, useTranslationContext } from '../../contexts';
|
|
12
14
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
@@ -14,6 +16,7 @@ import { useStableCallback } from '../../hooks';
|
|
|
14
16
|
import { primitives } from '../../theme';
|
|
15
17
|
import { ChannelActionItem } from '../ChannelList/hooks/useChannelActionItems';
|
|
16
18
|
import { useChannelMembersState } from '../ChannelList/hooks/useChannelMembersState';
|
|
19
|
+
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
|
|
17
20
|
import { useChannelOnlineMemberCount } from '../ChannelList/hooks/useChannelOnlineMemberCount';
|
|
18
21
|
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
|
|
19
22
|
import { ChannelAvatar } from '../ui';
|
|
@@ -35,6 +38,9 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
35
38
|
const memberCount = useMemo(() => Object.keys(members).length, [members]);
|
|
36
39
|
const onlineCount = useChannelOnlineMemberCount(channel);
|
|
37
40
|
const isDirectChat = useIsDirectChat(channel);
|
|
41
|
+
const { muted: channelMuted } = useIsChannelMuted(channel);
|
|
42
|
+
const directChatUserMuted = useChannelMuteActive(channel);
|
|
43
|
+
const muted = isDirectChat ? directChatUserMuted : channelMuted;
|
|
38
44
|
const displayedMemberCount = memberCount > 9 ? '9+' : `${memberCount}`;
|
|
39
45
|
const displayedOnlineCount = onlineCount > 9 ? '9+' : `${onlineCount}`;
|
|
40
46
|
const membersAndOnlineLabel = useMemo(
|
|
@@ -51,7 +57,10 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
51
57
|
<View style={styles.headerContainer}>
|
|
52
58
|
<ChannelAvatar channel={channel} size={'lg'} />
|
|
53
59
|
<View style={styles.metaContainer}>
|
|
54
|
-
<
|
|
60
|
+
<View style={styles.titleContainer}>
|
|
61
|
+
<ChannelPreviewTitle channel={channel} />
|
|
62
|
+
{muted ? <ChannelPreviewMutedStatus /> : null}
|
|
63
|
+
</View>
|
|
55
64
|
<Text style={styles.headerMeta}>
|
|
56
65
|
{isDirectChat ? (onlineCount === 1 ? t('Online') : t('Offline')) : membersAndOnlineLabel}
|
|
57
66
|
</Text>
|
|
@@ -145,6 +154,11 @@ const useStyles = () => {
|
|
|
145
154
|
gap: primitives.spacingXxs,
|
|
146
155
|
...header.metaContainer,
|
|
147
156
|
},
|
|
157
|
+
titleContainer: {
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
flexDirection: 'row',
|
|
160
|
+
gap: primitives.spacingXxs,
|
|
161
|
+
},
|
|
148
162
|
itemContainer: {
|
|
149
163
|
flexDirection: 'row',
|
|
150
164
|
alignItems: 'center',
|
|
@@ -76,6 +76,7 @@ export const ChannelPreviewMessage = (props: ChannelPreviewMessageProps) => {
|
|
|
76
76
|
|
|
77
77
|
const isFailedMessage =
|
|
78
78
|
lastMessage?.status === MessageStatusTypes.FAILED || lastMessage?.type === 'error';
|
|
79
|
+
const showMessageDeliveryStatus = !isMessageDeleted;
|
|
79
80
|
|
|
80
81
|
if (usersTyping.length > 0) {
|
|
81
82
|
return <PreviewTypingIndicator channel={channel} usersTyping={usersTyping} />;
|
|
@@ -120,14 +121,18 @@ export const ChannelPreviewMessage = (props: ChannelPreviewMessageProps) => {
|
|
|
120
121
|
if (channel.data?.name || membersWithoutSelf.length > 1) {
|
|
121
122
|
return (
|
|
122
123
|
<View style={styles.container}>
|
|
123
|
-
|
|
124
|
+
{showMessageDeliveryStatus ? (
|
|
125
|
+
<PreviewMessageDeliveryStatus channel={channel} message={lastMessage} />
|
|
126
|
+
) : null}
|
|
124
127
|
<PreviewLastMessage message={lastMessage} />
|
|
125
128
|
</View>
|
|
126
129
|
);
|
|
127
130
|
} else {
|
|
128
131
|
return (
|
|
129
132
|
<View style={styles.container}>
|
|
130
|
-
|
|
133
|
+
{showMessageDeliveryStatus ? (
|
|
134
|
+
<PreviewMessageDeliveryStatus channel={channel} message={lastMessage} />
|
|
135
|
+
) : null}
|
|
131
136
|
<PreviewLastMessage message={lastMessage} />
|
|
132
137
|
</View>
|
|
133
138
|
);
|
|
@@ -7,15 +7,14 @@ import { Channel } from 'stream-chat';
|
|
|
7
7
|
|
|
8
8
|
import { ChannelDetailsBottomSheet as DefaultChannelDetailsBottomSheet } from './ChannelDetailsBottomSheet';
|
|
9
9
|
import type { ChannelDetailsBottomSheetProps } from './ChannelDetailsBottomSheet';
|
|
10
|
+
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
10
11
|
|
|
11
12
|
import { useTheme } from '../../contexts';
|
|
12
13
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
13
|
-
import {
|
|
14
|
+
import { MenuPointHorizontal, Mute, Sound } from '../../icons';
|
|
14
15
|
import { GetChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
15
16
|
import { useChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
16
|
-
import {
|
|
17
|
-
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
|
|
18
|
-
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
|
|
17
|
+
import { useChannelActions } from '../ChannelList/hooks/useChannelActions';
|
|
19
18
|
import {
|
|
20
19
|
BottomSheetModal,
|
|
21
20
|
RightActions,
|
|
@@ -44,8 +43,12 @@ export const ChannelSwipableWrapper = ({
|
|
|
44
43
|
swipableProps?: SwipableWrapperProps['swipableProps'];
|
|
45
44
|
}>) => {
|
|
46
45
|
const [channelDetailSheetOpen, setChannelDetailSheetOpen] = useState(false);
|
|
47
|
-
const
|
|
46
|
+
const { muteChannel, unmuteChannel } = useChannelActions(channel);
|
|
48
47
|
const channelActionItems = useChannelActionItems({ channel, getChannelActionItems });
|
|
48
|
+
const sheetItems = useMemo(
|
|
49
|
+
() => channelActionItems.filter((item) => item.placement !== 'swipe'),
|
|
50
|
+
[channelActionItems],
|
|
51
|
+
);
|
|
49
52
|
const swipableRegistry = useSwipeRegistryContext();
|
|
50
53
|
|
|
51
54
|
const {
|
|
@@ -53,19 +56,17 @@ export const ChannelSwipableWrapper = ({
|
|
|
53
56
|
} = useTheme();
|
|
54
57
|
const styles = useStyles();
|
|
55
58
|
|
|
56
|
-
const
|
|
57
|
-
const
|
|
59
|
+
const channelMuteState = useIsChannelMuted(channel);
|
|
60
|
+
const channelMuteActive = channelMuteState.muted;
|
|
58
61
|
|
|
59
62
|
const Icon = useCallback(
|
|
60
63
|
() =>
|
|
61
|
-
|
|
62
|
-
<Archive width={20} height={20} stroke={semantics.textOnAccent} />
|
|
63
|
-
) : muteActive ? (
|
|
64
|
+
channelMuteActive ? (
|
|
64
65
|
<Sound width={20} height={20} stroke={semantics.textOnAccent} />
|
|
65
66
|
) : (
|
|
66
67
|
<Mute width={20} height={20} fill={semantics.textOnAccent} />
|
|
67
68
|
),
|
|
68
|
-
[
|
|
69
|
+
[channelMuteActive, semantics.textOnAccent],
|
|
69
70
|
);
|
|
70
71
|
|
|
71
72
|
const swipableActions = useMemo<SwipableActionItem[]>(() => {
|
|
@@ -78,29 +79,25 @@ export const ChannelSwipableWrapper = ({
|
|
|
78
79
|
},
|
|
79
80
|
];
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Content: Icon,
|
|
92
|
-
contentContainerStyle: [styles.contentContainerStyle, styles.standard],
|
|
93
|
-
});
|
|
94
|
-
}
|
|
82
|
+
items.push({
|
|
83
|
+
id: 'mute',
|
|
84
|
+
action: () => {
|
|
85
|
+
const action = channelMuteActive ? unmuteChannel : muteChannel;
|
|
86
|
+
action();
|
|
87
|
+
swipableRegistry?.closeAll();
|
|
88
|
+
},
|
|
89
|
+
Content: Icon,
|
|
90
|
+
contentContainerStyle: [styles.contentContainerStyle, styles.standard],
|
|
91
|
+
});
|
|
95
92
|
|
|
96
93
|
return items;
|
|
97
94
|
}, [
|
|
98
95
|
styles.contentContainerStyle,
|
|
99
96
|
styles.elipsis,
|
|
100
97
|
styles.standard,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
channelMuteActive,
|
|
99
|
+
muteChannel,
|
|
100
|
+
unmuteChannel,
|
|
104
101
|
Icon,
|
|
105
102
|
swipableRegistry,
|
|
106
103
|
]);
|
|
@@ -127,7 +124,7 @@ export const ChannelSwipableWrapper = ({
|
|
|
127
124
|
visible={channelDetailSheetOpen}
|
|
128
125
|
height={356}
|
|
129
126
|
>
|
|
130
|
-
<ChannelDetailsBottomSheetComponent channel={channel} items={
|
|
127
|
+
<ChannelDetailsBottomSheetComponent channel={channel} items={sheetItems} />
|
|
131
128
|
</BottomSheetModal>
|
|
132
129
|
</>
|
|
133
130
|
);
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { act, render } from '@testing-library/react-native';
|
|
5
|
+
import type { Channel } from 'stream-chat';
|
|
6
|
+
|
|
7
|
+
import type { ChannelActionItem } from '../../ChannelList/hooks/useChannelActionItems';
|
|
8
|
+
import * as ChannelActionItemsModule from '../../ChannelList/hooks/useChannelActionItems';
|
|
9
|
+
import * as ChannelActionsModule from '../../ChannelList/hooks/useChannelActions';
|
|
10
|
+
import { ChannelSwipableWrapper } from '../ChannelSwipableWrapper';
|
|
11
|
+
import * as UseIsChannelMutedModule from '../hooks/useIsChannelMuted';
|
|
12
|
+
|
|
13
|
+
const rightActionsProbe = {
|
|
14
|
+
items: [] as Array<{ action: () => void; id: string }>,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const mockSwipableWrapper = jest.fn(
|
|
18
|
+
({
|
|
19
|
+
children,
|
|
20
|
+
swipableProps,
|
|
21
|
+
}: React.PropsWithChildren<{
|
|
22
|
+
swipableProps?: { renderRightActions?: (...args: never[]) => void };
|
|
23
|
+
}>) => {
|
|
24
|
+
const rightActions = swipableProps?.renderRightActions?.({} as never, {} as never);
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
{children}
|
|
28
|
+
{rightActions}
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
jest.mock('../../../contexts', () => ({
|
|
35
|
+
useTheme: () => ({
|
|
36
|
+
theme: {
|
|
37
|
+
semantics: {
|
|
38
|
+
accentPrimary: '#00f',
|
|
39
|
+
backgroundCoreSurface: '#fff',
|
|
40
|
+
textOnAccent: '#000',
|
|
41
|
+
textPrimary: '#111',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
jest.mock('../../../contexts/swipeableContext/SwipeRegistryContext', () => ({
|
|
48
|
+
useSwipeRegistryContext: () => ({
|
|
49
|
+
closeAll: jest.fn(),
|
|
50
|
+
}),
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
jest.mock('../../UIComponents', () => ({
|
|
54
|
+
BottomSheetModal: ({ children }: React.PropsWithChildren) => <>{children}</>,
|
|
55
|
+
RightActions: ({ items }: { items: Array<{ action: () => void; id: string }> }) => {
|
|
56
|
+
rightActionsProbe.items = items;
|
|
57
|
+
return null;
|
|
58
|
+
},
|
|
59
|
+
SwipableWrapper: (...args: unknown[]) => mockSwipableWrapper(...args),
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
describe('ChannelSwipableWrapper', () => {
|
|
63
|
+
const channel = { cid: 'messaging:test-channel', id: 'test-channel' } as Channel;
|
|
64
|
+
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
jest.clearAllMocks();
|
|
67
|
+
rightActionsProbe.items = [];
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('uses channel mute for direct-channel swipe actions and keeps mute user in the sheet', () => {
|
|
71
|
+
const muteChannel = jest.fn();
|
|
72
|
+
const unmuteChannel = jest.fn();
|
|
73
|
+
const customBottomSheet = jest.fn(() => null);
|
|
74
|
+
const items: ChannelActionItem[] = [
|
|
75
|
+
{
|
|
76
|
+
Icon: () => null,
|
|
77
|
+
action: jest.fn(),
|
|
78
|
+
id: 'mute',
|
|
79
|
+
label: 'Mute User',
|
|
80
|
+
placement: 'sheet',
|
|
81
|
+
type: 'standard',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
Icon: () => null,
|
|
85
|
+
action: jest.fn(),
|
|
86
|
+
id: 'archive',
|
|
87
|
+
label: 'Archive Chat',
|
|
88
|
+
placement: 'sheet',
|
|
89
|
+
type: 'standard',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
jest.spyOn(ChannelActionsModule, 'useChannelActions').mockReturnValue({
|
|
94
|
+
archive: jest.fn(),
|
|
95
|
+
blockUser: jest.fn(),
|
|
96
|
+
deleteChannel: jest.fn(),
|
|
97
|
+
leave: jest.fn(),
|
|
98
|
+
muteChannel,
|
|
99
|
+
muteUser: jest.fn(),
|
|
100
|
+
pin: jest.fn(),
|
|
101
|
+
unarchive: jest.fn(),
|
|
102
|
+
unblockUser: jest.fn(),
|
|
103
|
+
unmuteChannel,
|
|
104
|
+
unmuteUser: jest.fn(),
|
|
105
|
+
unpin: jest.fn(),
|
|
106
|
+
});
|
|
107
|
+
jest.spyOn(ChannelActionItemsModule, 'useChannelActionItems').mockReturnValue(items);
|
|
108
|
+
jest.spyOn(UseIsChannelMutedModule, 'useIsChannelMuted').mockReturnValue({
|
|
109
|
+
createdAt: null,
|
|
110
|
+
expiresAt: null,
|
|
111
|
+
muted: false,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
render(
|
|
115
|
+
<ChannelSwipableWrapper channel={channel} ChannelDetailsBottomSheet={customBottomSheet}>
|
|
116
|
+
<Text>child</Text>
|
|
117
|
+
</ChannelSwipableWrapper>,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
expect(customBottomSheet).toHaveBeenCalledWith(
|
|
121
|
+
expect.objectContaining({
|
|
122
|
+
channel,
|
|
123
|
+
items,
|
|
124
|
+
}),
|
|
125
|
+
undefined,
|
|
126
|
+
);
|
|
127
|
+
expect(rightActionsProbe.items.map((item) => item.id)).toEqual(['openSheet', 'mute']);
|
|
128
|
+
|
|
129
|
+
act(() => {
|
|
130
|
+
rightActionsProbe.items[1].action();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
expect(muteChannel).toHaveBeenCalledTimes(1);
|
|
134
|
+
expect(unmuteChannel).not.toHaveBeenCalled();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('removes mute group from the sheet while keeping mute as the quick swipe action', () => {
|
|
138
|
+
const muteChannel = jest.fn();
|
|
139
|
+
const customBottomSheet = jest.fn(() => null);
|
|
140
|
+
const muteItem = {
|
|
141
|
+
Icon: () => null,
|
|
142
|
+
action: jest.fn(),
|
|
143
|
+
id: 'mute',
|
|
144
|
+
label: 'Mute Group',
|
|
145
|
+
placement: 'swipe',
|
|
146
|
+
type: 'standard',
|
|
147
|
+
} as const satisfies ChannelActionItem;
|
|
148
|
+
const archiveItem = {
|
|
149
|
+
Icon: () => null,
|
|
150
|
+
action: jest.fn(),
|
|
151
|
+
id: 'archive',
|
|
152
|
+
label: 'Archive Group',
|
|
153
|
+
placement: 'both',
|
|
154
|
+
type: 'standard',
|
|
155
|
+
} as const satisfies ChannelActionItem;
|
|
156
|
+
|
|
157
|
+
jest.spyOn(ChannelActionsModule, 'useChannelActions').mockReturnValue({
|
|
158
|
+
archive: jest.fn(),
|
|
159
|
+
blockUser: jest.fn(),
|
|
160
|
+
deleteChannel: jest.fn(),
|
|
161
|
+
leave: jest.fn(),
|
|
162
|
+
muteChannel,
|
|
163
|
+
muteUser: jest.fn(),
|
|
164
|
+
pin: jest.fn(),
|
|
165
|
+
unarchive: jest.fn(),
|
|
166
|
+
unblockUser: jest.fn(),
|
|
167
|
+
unmuteChannel: jest.fn(),
|
|
168
|
+
unmuteUser: jest.fn(),
|
|
169
|
+
unpin: jest.fn(),
|
|
170
|
+
});
|
|
171
|
+
jest
|
|
172
|
+
.spyOn(ChannelActionItemsModule, 'useChannelActionItems')
|
|
173
|
+
.mockReturnValue([muteItem, archiveItem]);
|
|
174
|
+
jest.spyOn(UseIsChannelMutedModule, 'useIsChannelMuted').mockReturnValue({
|
|
175
|
+
createdAt: null,
|
|
176
|
+
expiresAt: null,
|
|
177
|
+
muted: false,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
render(
|
|
181
|
+
<ChannelSwipableWrapper channel={channel} ChannelDetailsBottomSheet={customBottomSheet}>
|
|
182
|
+
<Text>child</Text>
|
|
183
|
+
</ChannelSwipableWrapper>,
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
expect(customBottomSheet).toHaveBeenCalledWith(
|
|
187
|
+
expect.objectContaining({
|
|
188
|
+
channel,
|
|
189
|
+
items: [archiveItem],
|
|
190
|
+
}),
|
|
191
|
+
undefined,
|
|
192
|
+
);
|
|
193
|
+
expect(rightActionsProbe.items.map((item) => item.id)).toEqual(['openSheet', 'mute']);
|
|
194
|
+
|
|
195
|
+
act(() => {
|
|
196
|
+
rightActionsProbe.items[1].action();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
expect(muteChannel).toHaveBeenCalledTimes(1);
|
|
200
|
+
});
|
|
201
|
+
});
|