stream-chat-react-native-core 9.2.2-beta.2 → 9.2.2-beta.4

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.
Files changed (73) hide show
  1. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +3 -10
  2. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  3. package/lib/commonjs/components/ImageGallery/ImageGallery.js +2 -2
  4. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  5. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +4 -1
  6. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  7. package/lib/commonjs/components/Message/Message.js +3 -3
  8. package/lib/commonjs/components/Message/Message.js.map +1 -1
  9. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +2 -9
  10. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  11. package/lib/commonjs/contexts/componentsContext/defaultComponents.js +2 -2
  12. package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
  13. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
  14. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  15. package/lib/commonjs/hooks/useAfterKeyboardOpenCallback.js +1 -2
  16. package/lib/commonjs/hooks/useAfterKeyboardOpenCallback.js.map +1 -1
  17. package/lib/commonjs/hooks/useKeyboardVisibility.js +5 -17
  18. package/lib/commonjs/hooks/useKeyboardVisibility.js.map +1 -1
  19. package/lib/commonjs/state-store/audio-player.js +9 -16
  20. package/lib/commonjs/state-store/audio-player.js.map +1 -1
  21. package/lib/commonjs/version.json +1 -1
  22. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +3 -10
  23. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  24. package/lib/module/components/ImageGallery/ImageGallery.js +2 -2
  25. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  26. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +4 -1
  27. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  28. package/lib/module/components/Message/Message.js +3 -3
  29. package/lib/module/components/Message/Message.js.map +1 -1
  30. package/lib/module/components/UIComponents/BottomSheetModal.js +2 -9
  31. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  32. package/lib/module/contexts/componentsContext/defaultComponents.js +2 -2
  33. package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
  34. package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
  35. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  36. package/lib/module/hooks/useAfterKeyboardOpenCallback.js +1 -2
  37. package/lib/module/hooks/useAfterKeyboardOpenCallback.js.map +1 -1
  38. package/lib/module/hooks/useKeyboardVisibility.js +5 -17
  39. package/lib/module/hooks/useKeyboardVisibility.js.map +1 -1
  40. package/lib/module/state-store/audio-player.js +9 -16
  41. package/lib/module/state-store/audio-player.js.map +1 -1
  42. package/lib/module/version.json +1 -1
  43. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  44. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  45. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  46. package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts +2 -0
  47. package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
  48. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  49. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +2 -1
  50. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
  51. package/lib/typescript/hooks/useAfterKeyboardOpenCallback.d.ts.map +1 -1
  52. package/lib/typescript/hooks/useKeyboardVisibility.d.ts.map +1 -1
  53. package/lib/typescript/state-store/audio-player.d.ts.map +1 -1
  54. package/package.json +1 -6
  55. package/src/components/AttachmentPicker/AttachmentPicker.tsx +3 -13
  56. package/src/components/Channel/Channel.tsx +1 -1
  57. package/src/components/ImageGallery/ImageGallery.tsx +1 -1
  58. package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +6 -0
  59. package/src/components/Message/Message.tsx +1 -1
  60. package/src/components/UIComponents/BottomSheetModal.tsx +3 -12
  61. package/src/contexts/componentsContext/defaultComponents.ts +1 -1
  62. package/src/contexts/messageInputContext/MessageInputContext.tsx +1 -1
  63. package/src/hooks/useAfterKeyboardOpenCallback.ts +1 -4
  64. package/src/hooks/useKeyboardVisibility.ts +9 -27
  65. package/src/state-store/audio-player.ts +3 -10
  66. package/src/version.json +1 -1
  67. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +0 -64
  68. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +0 -1
  69. package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +0 -64
  70. package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +0 -1
  71. package/lib/typescript/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.d.ts +0 -11
  72. package/lib/typescript/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.d.ts.map +0 -1
  73. package/src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx +0 -69
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import {
3
3
  BackHandler,
4
- EmitterSubscription,
5
4
  Keyboard,
6
5
  Platform,
7
6
  View,
@@ -21,7 +20,6 @@ import { useComponentsContext } from '../../contexts/componentsContext/Component
21
20
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
21
  import { useStableCallback } from '../../hooks';
23
22
  import { BottomSheet } from '../BottomSheetCompatibility/BottomSheet';
24
- import { KeyboardControllerPackage } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
25
23
 
26
24
  dayjs.extend(duration);
27
25
 
@@ -78,18 +76,10 @@ export const AttachmentPicker = () => {
78
76
  }
79
77
  closePicker();
80
78
  };
81
- let keyboardSubscription: EmitterSubscription | null = null;
82
- if (KeyboardControllerPackage?.KeyboardEvents) {
83
- keyboardSubscription = KeyboardControllerPackage.KeyboardEvents.addListener(
84
- 'keyboardWillShow',
85
- onKeyboardOpenHandler,
86
- );
87
- } else {
88
- const keyboardShowEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
89
- keyboardSubscription = Keyboard.addListener(keyboardShowEvent, onKeyboardOpenHandler);
90
- }
79
+ const keyboardShowEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
80
+ const keyboardSubscription = Keyboard.addListener(keyboardShowEvent, onKeyboardOpenHandler);
91
81
  return () => {
92
- keyboardSubscription?.remove();
82
+ keyboardSubscription.remove();
93
83
  };
94
84
  }, [attachmentPickerStore, closePicker]);
95
85
 
@@ -114,7 +114,7 @@ import {
114
114
  } from '../../utils/utils';
115
115
  import { NotificationAnnouncer } from '../Accessibility/NotificationAnnouncer';
116
116
  import { AttachmentPicker } from '../AttachmentPicker/AttachmentPicker';
117
- import type { KeyboardCompatibleViewProps } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
117
+ import type { KeyboardCompatibleViewProps } from '../KeyboardCompatibleView/KeyboardCompatibleView';
118
118
  import { Emoji } from '../MessageMenu/EmojiPickerList';
119
119
  import { emojis } from '../MessageMenu/emojis';
120
120
  import { toUnicodeScalarString } from '../MessageMenu/utils/toUnicodeScalarString';
@@ -36,7 +36,7 @@ import { useViewport } from '../../hooks/useViewport';
36
36
  import { IconProps } from '../../icons/utils/base';
37
37
  import { ImageGalleryState } from '../../state-store/image-gallery-state-store';
38
38
  import { FileTypes } from '../../types/types';
39
- import { dismissKeyboard } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
39
+ import { dismissKeyboard } from '../KeyboardCompatibleView/KeyboardCompatibleView';
40
40
  import { BottomSheetModal } from '../UIComponents';
41
41
 
42
42
  export type ImageGalleryActionHandler = () => Promise<void> | void;
@@ -22,6 +22,12 @@ import {
22
22
 
23
23
  import { KeyboardProvider } from '../../contexts/keyboardContext/KeyboardContext';
24
24
 
25
+ export type KeyboardCompatibleViewProps = KeyboardAvoidingViewProps;
26
+
27
+ export const dismissKeyboard = () => {
28
+ Keyboard.dismiss();
29
+ };
30
+
25
31
  type State = {
26
32
  bottom: number;
27
33
  };
@@ -77,7 +77,7 @@ import {
77
77
  MessageStatusTypes,
78
78
  } from '../../utils/utils';
79
79
  import type { Thumbnail } from '../Attachment/utils/buildGallery/types';
80
- import { dismissKeyboard } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
80
+ import { dismissKeyboard } from '../KeyboardCompatibleView/KeyboardCompatibleView';
81
81
  import { BottomSheetModal } from '../UIComponents';
82
82
 
83
83
  const createMessageOverlayId = (messageId?: string) =>
@@ -19,7 +19,6 @@ import {
19
19
  View,
20
20
  } from 'react-native';
21
21
  import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
22
- import type { KeyboardEventData } from 'react-native-keyboard-controller';
23
22
  import Animated, {
24
23
  Easing,
25
24
  FadeIn,
@@ -43,7 +42,6 @@ import { BottomSheetProvider } from '../../contexts/bottomSheetContext/BottomShe
43
42
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
44
43
  import { useStableCallback } from '../../hooks';
45
44
  import { primitives } from '../../theme';
46
- import { KeyboardControllerPackage } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
47
45
 
48
46
  export type BottomSheetModalProps = {
49
47
  /**
@@ -377,18 +375,11 @@ const BottomSheetModalInner = (props: PropsWithChildren<BottomSheetModalProps>)
377
375
 
378
376
  const listeners: EventSubscription[] = [];
379
377
 
380
- if (KeyboardControllerPackage?.KeyboardEvents) {
381
- const keyboardDidShowKC = (event: KeyboardEventData) => {
382
- animateKeyboardOffset(event.height);
383
- };
384
-
378
+ if (Platform.OS === 'ios') {
385
379
  listeners.push(
386
- KeyboardControllerPackage.KeyboardEvents.addListener('keyboardDidShow', keyboardDidShowKC),
387
- KeyboardControllerPackage.KeyboardEvents.addListener('keyboardDidHide', keyboardDidHide),
380
+ Keyboard.addListener('keyboardWillShow', keyboardDidShowRN),
381
+ Keyboard.addListener('keyboardWillHide', keyboardDidHide),
388
382
  );
389
- } else if (Platform.OS === 'ios') {
390
- listeners.push(Keyboard.addListener('keyboardWillShow', keyboardDidShowRN));
391
- listeners.push(Keyboard.addListener('keyboardWillHide', keyboardDidHide));
392
383
  }
393
384
 
394
385
  return () => listeners.forEach((l) => l.remove());
@@ -50,7 +50,7 @@ import { ImageGalleryGrid } from '../../components/ImageGallery/components/Image
50
50
  import { EmptyStateIndicator } from '../../components/Indicators/EmptyStateIndicator';
51
51
  import { LoadingErrorIndicator } from '../../components/Indicators/LoadingErrorIndicator';
52
52
  import { LoadingIndicator } from '../../components/Indicators/LoadingIndicator';
53
- import { KeyboardCompatibleView } from '../../components/KeyboardCompatibleView/KeyboardControllerAvoidingView';
53
+ import { KeyboardCompatibleView } from '../../components/KeyboardCompatibleView/KeyboardCompatibleView';
54
54
  import { Message } from '../../components/Message/Message';
55
55
  import { MessagePinnedHeader } from '../../components/Message/MessageItemView/Headers/MessagePinnedHeader';
56
56
  import { MessageReminderHeader } from '../../components/Message/MessageItemView/Headers/MessageReminderHeader';
@@ -23,7 +23,7 @@ import {
23
23
  import { useCreateMessageInputContext } from './hooks/useCreateMessageInputContext';
24
24
  import { useMessageComposer } from './hooks/useMessageComposer';
25
25
 
26
- import { dismissKeyboard } from '../../components/KeyboardCompatibleView/KeyboardControllerAvoidingView';
26
+ import { dismissKeyboard } from '../../components/KeyboardCompatibleView/KeyboardCompatibleView';
27
27
  import { parseLinksFromText } from '../../components/Message/MessageItemView/utils/parseLinks';
28
28
  import { useAudioRecorder } from '../../components/MessageInput/hooks/useAudioRecorder';
29
29
  import { useNotificationApi } from '../../components/Notifications';
@@ -3,7 +3,6 @@ import { EventSubscription, Keyboard, Platform } from 'react-native';
3
3
 
4
4
  import { useStableCallback } from './useStableCallback';
5
5
 
6
- import { KeyboardControllerPackage } from '../components/KeyboardCompatibleView/KeyboardControllerAvoidingView';
7
6
  import { useMessageInputContext } from '../contexts/messageInputContext/MessageInputContext';
8
7
 
9
8
  /**
@@ -50,9 +49,7 @@ export const useAfterKeyboardOpenCallback = <T extends unknown[]>(
50
49
 
51
50
  const keyboardEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
52
51
 
53
- keyboardSubscriptionRef.current = KeyboardControllerPackage?.KeyboardEvents
54
- ? KeyboardControllerPackage.KeyboardEvents.addListener(keyboardEvent, runCallback)
55
- : Keyboard.addListener(keyboardEvent, runCallback);
52
+ keyboardSubscriptionRef.current = Keyboard.addListener(keyboardEvent, runCallback);
56
53
 
57
54
  inputBoxRef.current.focus();
58
55
  });
@@ -1,7 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { EventSubscription, Keyboard, Platform } from 'react-native';
3
-
4
- import { KeyboardControllerPackage } from '../components/KeyboardCompatibleView/KeyboardControllerAvoidingView';
2
+ import { Keyboard, Platform } from 'react-native';
5
3
 
6
4
  /**
7
5
  * A custom hook that provides a boolean value indicating whether the keyboard is visible.
@@ -11,30 +9,14 @@ export const useKeyboardVisibility = () => {
11
9
  const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
12
10
 
13
11
  useEffect(() => {
14
- const listeners: EventSubscription[] = [];
15
- if (KeyboardControllerPackage?.KeyboardEvents) {
16
- listeners.push(
17
- KeyboardControllerPackage.KeyboardEvents.addListener('keyboardWillShow', () =>
18
- setIsKeyboardVisible(true),
19
- ),
20
- );
21
- listeners.push(
22
- KeyboardControllerPackage.KeyboardEvents.addListener('keyboardWillHide', () =>
23
- setIsKeyboardVisible(false),
24
- ),
25
- );
26
- } else {
27
- listeners.push(
28
- Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () =>
29
- setIsKeyboardVisible(true),
30
- ),
31
- );
32
- listeners.push(
33
- Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () =>
34
- setIsKeyboardVisible(false),
35
- ),
36
- );
37
- }
12
+ const listeners = [
13
+ Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () =>
14
+ setIsKeyboardVisible(true),
15
+ ),
16
+ Keyboard.addListener(Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () =>
17
+ setIsKeyboardVisible(false),
18
+ ),
19
+ ];
38
20
 
39
21
  return () => listeners.forEach((listener) => listener.remove());
40
22
  }, []);
@@ -425,17 +425,10 @@ export class AudioPlayer {
425
425
  }
426
426
  this.position = positionInMillis;
427
427
  if (this.isExpoCLI) {
428
- if (positionInMillis === 0) {
429
- // If currentTime is 0, we should replay the video from 0th position.
430
- if (this.playerRef?.replayAsync) {
431
- await this.playerRef.replayAsync({});
432
- }
428
+ if (this.playerRef?.setPositionAsync) {
429
+ await this.playerRef.setPositionAsync(positionInMillis);
433
430
  } else {
434
- if (this.playerRef?.setPositionAsync) {
435
- await this.playerRef.setPositionAsync(positionInMillis);
436
- } else {
437
- this.notifyError('seek-not-supported');
438
- }
431
+ this.notifyError('seek-not-supported');
439
432
  }
440
433
  } else {
441
434
  if (this.playerRef?.seek) {
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "9.2.2-beta.2"
2
+ "version": "9.2.2-beta.4"
3
3
  }
@@ -1,64 +0,0 @@
1
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.dismissKeyboard = exports.KeyboardControllerPackage = exports.KeyboardCompatibleView = void 0;
6
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _KeyboardCompatibleView = require("./KeyboardCompatibleView");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- var _excluded = ["behavior", "children"];
12
- var _this = this,
13
- _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx";
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- var optionalRequire = function optionalRequire() {
17
- try {
18
- return require('react-native-keyboard-controller');
19
- } catch (_unused) {
20
- return undefined;
21
- }
22
- };
23
- var KeyboardControllerPackage = exports.KeyboardControllerPackage = optionalRequire();
24
- var _ref = KeyboardControllerPackage != null ? KeyboardControllerPackage : {},
25
- AndroidSoftInputModes = _ref.AndroidSoftInputModes,
26
- KeyboardController = _ref.KeyboardController,
27
- KeyboardProvider = _ref.KeyboardProvider,
28
- KeyboardAvoidingView = _ref.KeyboardAvoidingView;
29
- var KeyboardCompatibleView = exports.KeyboardCompatibleView = function KeyboardCompatibleView(props) {
30
- var _props$behavior = props.behavior,
31
- behavior = _props$behavior === void 0 ? 'translate-with-padding' : _props$behavior,
32
- children = props.children,
33
- rest = (0, _objectWithoutProperties2.default)(props, _excluded);
34
- (0, _react.useEffect)(function () {
35
- if (AndroidSoftInputModes) {
36
- KeyboardController == null || KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
37
- }
38
- return function () {
39
- return KeyboardController == null ? void 0 : KeyboardController.setDefaultMode();
40
- };
41
- }, []);
42
- if (KeyboardProvider && KeyboardAvoidingView) {
43
- return (0, _jsxRuntime.jsx)(KeyboardProvider, {
44
- children: (0, _jsxRuntime.jsx)(KeyboardAvoidingView, Object.assign({
45
- behavior: behavior
46
- }, rest, {
47
- children: children
48
- }))
49
- });
50
- }
51
- var compatibleBehavior = behavior === 'translate-with-padding' ? 'padding' : behavior;
52
- return (0, _jsxRuntime.jsx)(_KeyboardCompatibleView.KeyboardCompatibleView, Object.assign({
53
- behavior: compatibleBehavior
54
- }, rest, {
55
- children: children
56
- }));
57
- };
58
- var dismissKeyboard = exports.dismissKeyboard = function dismissKeyboard() {
59
- if (KeyboardControllerPackage != null && KeyboardControllerPackage.KeyboardController) {
60
- KeyboardControllerPackage == null || KeyboardControllerPackage.KeyboardController.dismiss();
61
- }
62
- _reactNative.Keyboard.dismiss();
63
- };
64
- //# sourceMappingURL=KeyboardControllerAvoidingView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_KeyboardCompatibleView","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","optionalRequire","_unused","undefined","KeyboardControllerPackage","exports","_ref","AndroidSoftInputModes","KeyboardController","KeyboardProvider","KeyboardAvoidingView","KeyboardCompatibleView","props","_props$behavior","behavior","children","rest","_objectWithoutProperties2","useEffect","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","jsx","assign","compatibleBehavior","dismissKeyboard","dismiss","Keyboard"],"sourceRoot":"../../../../src","sources":["components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,C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,GAAA,EAACZ,oBAAoB,EAAAjB,MAAA,CAAA8B,MAAA;QAACT,QAAQ,EAAEA;MAAS,GAAKE,IAAI;QAAAD,QAAA,EAC/CA;MAAQ,EACW;IAAC,CACP,CAAC;EAEvB;EACA,IAAMS,kBAAkB,GAAGV,QAAQ,KAAK,wBAAwB,GAAG,SAAS,GAAGA,QAAQ;EAEvF,OACE,IAAArC,WAAA,CAAA6C,GAAA,EAAC9C,uBAAA,CAAAmC,sBAA6B,EAAAlB,MAAA,CAAA8B,MAAA;IAACT,QAAQ,EAAEU;EAAmB,GAAKR,IAAI;IAAAD,QAAA,EAClEA;EAAQ,EACoB,CAAC;AAEpC,CAAC;AAEM,IAAMU,eAAe,GAAApB,OAAA,CAAAoB,eAAA,GAAG,SAAlBA,eAAeA,CAAA,EAAS;EACnC,IAAIrB,yBAAyB,YAAzBA,yBAAyB,CAAEI,kBAAkB,EAAE;IACjDJ,yBAAyB,YAAzBA,yBAAyB,CAAEI,kBAAkB,CAACkB,OAAO,CAAC,CAAC;EACzD;EACAC,qBAAQ,CAACD,OAAO,CAAC,CAAC;AACpB,CAAC","ignoreList":[]}
@@ -1,64 +0,0 @@
1
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.dismissKeyboard = exports.KeyboardControllerPackage = exports.KeyboardCompatibleView = void 0;
6
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _KeyboardCompatibleView = require("./KeyboardCompatibleView");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- var _excluded = ["behavior", "children"];
12
- var _this = this,
13
- _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx";
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- var optionalRequire = function optionalRequire() {
17
- try {
18
- return require('react-native-keyboard-controller');
19
- } catch (_unused) {
20
- return undefined;
21
- }
22
- };
23
- var KeyboardControllerPackage = exports.KeyboardControllerPackage = optionalRequire();
24
- var _ref = KeyboardControllerPackage != null ? KeyboardControllerPackage : {},
25
- AndroidSoftInputModes = _ref.AndroidSoftInputModes,
26
- KeyboardController = _ref.KeyboardController,
27
- KeyboardProvider = _ref.KeyboardProvider,
28
- KeyboardAvoidingView = _ref.KeyboardAvoidingView;
29
- var KeyboardCompatibleView = exports.KeyboardCompatibleView = function KeyboardCompatibleView(props) {
30
- var _props$behavior = props.behavior,
31
- behavior = _props$behavior === void 0 ? 'translate-with-padding' : _props$behavior,
32
- children = props.children,
33
- rest = (0, _objectWithoutProperties2.default)(props, _excluded);
34
- (0, _react.useEffect)(function () {
35
- if (AndroidSoftInputModes) {
36
- KeyboardController == null || KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
37
- }
38
- return function () {
39
- return KeyboardController == null ? void 0 : KeyboardController.setDefaultMode();
40
- };
41
- }, []);
42
- if (KeyboardProvider && KeyboardAvoidingView) {
43
- return (0, _jsxRuntime.jsx)(KeyboardProvider, {
44
- children: (0, _jsxRuntime.jsx)(KeyboardAvoidingView, Object.assign({
45
- behavior: behavior
46
- }, rest, {
47
- children: children
48
- }))
49
- });
50
- }
51
- var compatibleBehavior = behavior === 'translate-with-padding' ? 'padding' : behavior;
52
- return (0, _jsxRuntime.jsx)(_KeyboardCompatibleView.KeyboardCompatibleView, Object.assign({
53
- behavior: compatibleBehavior
54
- }, rest, {
55
- children: children
56
- }));
57
- };
58
- var dismissKeyboard = exports.dismissKeyboard = function dismissKeyboard() {
59
- if (KeyboardControllerPackage != null && KeyboardControllerPackage.KeyboardController) {
60
- KeyboardControllerPackage == null || KeyboardControllerPackage.KeyboardController.dismiss();
61
- }
62
- _reactNative.Keyboard.dismiss();
63
- };
64
- //# sourceMappingURL=KeyboardControllerAvoidingView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_KeyboardCompatibleView","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","optionalRequire","_unused","undefined","KeyboardControllerPackage","exports","_ref","AndroidSoftInputModes","KeyboardController","KeyboardProvider","KeyboardAvoidingView","KeyboardCompatibleView","props","_props$behavior","behavior","children","rest","_objectWithoutProperties2","useEffect","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","jsx","assign","compatibleBehavior","dismissKeyboard","dismiss","Keyboard"],"sourceRoot":"../../../../src","sources":["components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,uBAAA,GAAAF,OAAA;AAAmG,IAAAG,WAAA,GAAAH,OAAA;AAAA,IAAAI,SAAA;AAAA,IAAAC,KAAA;EAAAC,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YA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A,EAAC9C,uBAAA,CAAAmC,sBAA6B,EAAAlB,MAAA,CAAA8B,MAAA;IAACT,QAAQ,EAAEU;EAAmB,GAAKR,IAAI;IAAAD,QAAA,EAClEA;EAAQ,EACoB,CAAC;AAEpC,CAAC;AAEM,IAAMU,eAAe,GAAApB,OAAA,CAAAoB,eAAA,GAAG,SAAlBA,eAAeA,CAAA,EAAS;EACnC,IAAIrB,yBAAyB,YAAzBA,yBAAyB,CAAEI,kBAAkB,EAAE;IACjDJ,yBAAyB,YAAzBA,yBAAyB,CAAEI,kBAAkB,CAACkB,OAAO,CAAC,CAAC;EACzD;EACAC,qBAAQ,CAACD,OAAO,CAAC,CAAC;AACpB,CAAC","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps } from 'react-native';
3
- type ExtraKeyboardControllerProps = {
4
- behavior?: 'translate-with-padding';
5
- };
6
- export type KeyboardCompatibleViewProps = ReactNativeKeyboardAvoidingViewProps & ExtraKeyboardControllerProps;
7
- declare const KeyboardControllerPackage: typeof import("react-native-keyboard-controller") | undefined;
8
- export declare const KeyboardCompatibleView: (props: KeyboardCompatibleViewProps) => React.JSX.Element;
9
- export declare const dismissKeyboard: () => void;
10
- export { KeyboardControllerPackage };
11
- //# sourceMappingURL=KeyboardControllerAvoidingView.d.ts.map
@@ -1 +0,0 @@
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,69 +0,0 @@
1
- import React, { useEffect } from 'react';
2
-
3
- import {
4
- Keyboard,
5
- KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps,
6
- } from 'react-native';
7
-
8
- import { KeyboardCompatibleView as KeyboardCompatibleViewDefault } from './KeyboardCompatibleView';
9
-
10
- type ExtraKeyboardControllerProps = {
11
- behavior?: 'translate-with-padding';
12
- };
13
-
14
- type KeyboardControllerModule = typeof import('react-native-keyboard-controller');
15
-
16
- const optionalRequire = <T,>(): T | undefined => {
17
- try {
18
- return require('react-native-keyboard-controller') as T;
19
- } catch {
20
- return undefined;
21
- }
22
- };
23
-
24
- export type KeyboardCompatibleViewProps = ReactNativeKeyboardAvoidingViewProps &
25
- ExtraKeyboardControllerProps;
26
-
27
- const KeyboardControllerPackage = optionalRequire<KeyboardControllerModule>();
28
-
29
- const { AndroidSoftInputModes, KeyboardController, KeyboardProvider, KeyboardAvoidingView } =
30
- KeyboardControllerPackage ?? {};
31
-
32
- export const KeyboardCompatibleView = (props: KeyboardCompatibleViewProps) => {
33
- const { behavior = 'translate-with-padding', children, ...rest } = props;
34
-
35
- useEffect(() => {
36
- if (AndroidSoftInputModes) {
37
- KeyboardController?.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
38
- }
39
-
40
- return () => KeyboardController?.setDefaultMode();
41
- }, []);
42
-
43
- if (KeyboardProvider && KeyboardAvoidingView) {
44
- return (
45
- <KeyboardProvider>
46
- {/* @ts-expect-error - The reason is that react-native-keyboard-controller's KeyboardAvoidingViewProps is a discriminated union, not a simple behavior union so it complains about the `position` value passed. */}
47
- <KeyboardAvoidingView behavior={behavior} {...rest}>
48
- {children}
49
- </KeyboardAvoidingView>
50
- </KeyboardProvider>
51
- );
52
- }
53
- const compatibleBehavior = behavior === 'translate-with-padding' ? 'padding' : behavior;
54
-
55
- return (
56
- <KeyboardCompatibleViewDefault behavior={compatibleBehavior} {...rest}>
57
- {children}
58
- </KeyboardCompatibleViewDefault>
59
- );
60
- };
61
-
62
- export const dismissKeyboard = () => {
63
- if (KeyboardControllerPackage?.KeyboardController) {
64
- KeyboardControllerPackage?.KeyboardController.dismiss();
65
- }
66
- Keyboard.dismiss();
67
- };
68
-
69
- export { KeyboardControllerPackage };