@sendbird/uikit-react-native 1.1.1 → 2.0.0-rc.0

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 (174) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/ChatFlatList.js +10 -8
  3. package/lib/commonjs/components/ChatFlatList.js.map +1 -1
  4. package/lib/commonjs/components/FileViewer.js +8 -3
  5. package/lib/commonjs/components/FileViewer.js.map +1 -1
  6. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +47 -15
  7. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  8. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +51 -34
  9. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  10. package/lib/commonjs/components/MessageRenderer/MessageIncomingSenderName.js +2 -1
  11. package/lib/commonjs/components/MessageRenderer/MessageIncomingSenderName.js.map +1 -1
  12. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +3 -1
  13. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  14. package/lib/commonjs/components/MessageRenderer/index.js +7 -2
  15. package/lib/commonjs/components/MessageRenderer/index.js.map +1 -1
  16. package/lib/commonjs/containers/SendbirdUIKitContainer.js +12 -15
  17. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  18. package/lib/commonjs/contexts/SendbirdChat.js +9 -9
  19. package/lib/commonjs/contexts/SendbirdChat.js.map +1 -1
  20. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +39 -6
  21. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  22. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +4 -4
  23. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  24. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  25. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js +4 -2
  26. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  27. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js +1 -1
  28. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js.map +1 -1
  29. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +4 -2
  30. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  31. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +44 -13
  32. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  33. package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
  34. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js +7 -6
  35. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
  36. package/lib/commonjs/fragments/createGroupChannelFragment.js +12 -12
  37. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  38. package/lib/commonjs/fragments/createGroupChannelListFragment.js +1 -1
  39. package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
  40. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +4 -4
  41. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
  42. package/lib/commonjs/hooks/useConnection.js +35 -34
  43. package/lib/commonjs/hooks/useConnection.js.map +1 -1
  44. package/lib/commonjs/hooks/usePushTokenRegistration.js +2 -2
  45. package/lib/commonjs/hooks/usePushTokenRegistration.js.map +1 -1
  46. package/lib/commonjs/index.js +10 -1
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/libs/InternalLocalCacheStorage.js +8 -0
  49. package/lib/commonjs/libs/InternalLocalCacheStorage.js.map +1 -1
  50. package/lib/commonjs/libs/SBUError.js +41 -0
  51. package/lib/commonjs/libs/SBUError.js.map +1 -0
  52. package/lib/commonjs/libs/SBUUtils.js +20 -0
  53. package/lib/commonjs/libs/SBUUtils.js.map +1 -0
  54. package/lib/commonjs/localization/StringSet.type.js +6 -0
  55. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  56. package/lib/commonjs/platform/createFileService.expo.js +6 -4
  57. package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
  58. package/lib/commonjs/platform/createFileService.native.js +18 -8
  59. package/lib/commonjs/platform/createFileService.native.js.map +1 -1
  60. package/lib/commonjs/platform/types.js +4 -0
  61. package/lib/commonjs/platform/types.js.map +1 -1
  62. package/lib/commonjs/version.js +1 -1
  63. package/lib/commonjs/version.js.map +1 -1
  64. package/lib/module/components/ChatFlatList.js +10 -8
  65. package/lib/module/components/ChatFlatList.js.map +1 -1
  66. package/lib/module/components/FileViewer.js +9 -4
  67. package/lib/module/components/FileViewer.js.map +1 -1
  68. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +48 -17
  69. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  70. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +52 -35
  71. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  72. package/lib/module/components/MessageRenderer/MessageIncomingSenderName.js +2 -1
  73. package/lib/module/components/MessageRenderer/MessageIncomingSenderName.js.map +1 -1
  74. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +3 -1
  75. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  76. package/lib/module/components/MessageRenderer/index.js +7 -2
  77. package/lib/module/components/MessageRenderer/index.js.map +1 -1
  78. package/lib/module/containers/SendbirdUIKitContainer.js +10 -15
  79. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  80. package/lib/module/contexts/SendbirdChat.js +10 -10
  81. package/lib/module/contexts/SendbirdChat.js.map +1 -1
  82. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +38 -7
  83. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  84. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +5 -5
  85. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  86. package/lib/module/domain/groupChannel/types.js.map +1 -1
  87. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js +3 -2
  88. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  89. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js +1 -1
  90. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js.map +1 -1
  91. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +3 -2
  92. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  93. package/lib/module/domain/groupChannelSettings/module/moduleContext.js +43 -14
  94. package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  95. package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
  96. package/lib/module/fragments/createGroupChannelCreateFragment.js +7 -6
  97. package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
  98. package/lib/module/fragments/createGroupChannelFragment.js +12 -12
  99. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  100. package/lib/module/fragments/createGroupChannelListFragment.js +1 -1
  101. package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
  102. package/lib/module/fragments/createGroupChannelMembersFragment.js +4 -4
  103. package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
  104. package/lib/module/hooks/useConnection.js +35 -35
  105. package/lib/module/hooks/useConnection.js.map +1 -1
  106. package/lib/module/hooks/usePushTokenRegistration.js +2 -2
  107. package/lib/module/hooks/usePushTokenRegistration.js.map +1 -1
  108. package/lib/module/index.js +1 -0
  109. package/lib/module/index.js.map +1 -1
  110. package/lib/module/libs/InternalLocalCacheStorage.js +7 -0
  111. package/lib/module/libs/InternalLocalCacheStorage.js.map +1 -1
  112. package/lib/module/libs/SBUError.js +32 -0
  113. package/lib/module/libs/SBUError.js.map +1 -0
  114. package/lib/module/libs/SBUUtils.js +10 -0
  115. package/lib/module/libs/SBUUtils.js.map +1 -0
  116. package/lib/module/localization/StringSet.type.js +6 -0
  117. package/lib/module/localization/StringSet.type.js.map +1 -1
  118. package/lib/module/platform/createFileService.expo.js +5 -4
  119. package/lib/module/platform/createFileService.expo.js.map +1 -1
  120. package/lib/module/platform/createFileService.native.js +18 -9
  121. package/lib/module/platform/createFileService.native.js.map +1 -1
  122. package/lib/module/platform/types.js +1 -1
  123. package/lib/module/platform/types.js.map +1 -1
  124. package/lib/module/version.js +1 -1
  125. package/lib/module/version.js.map +1 -1
  126. package/lib/typescript/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.d.ts +2 -2
  127. package/lib/typescript/src/components/MessageRenderer/index.d.ts +1 -1
  128. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  129. package/lib/typescript/src/contexts/SendbirdChat.d.ts +1 -1
  130. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/index.d.ts +3 -3
  131. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +6 -6
  132. package/lib/typescript/src/domain/groupChannel/types.d.ts +3 -3
  133. package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +2 -2
  134. package/lib/typescript/src/hooks/useContext.d.ts +5 -5
  135. package/lib/typescript/src/index.d.ts +1 -0
  136. package/lib/typescript/src/libs/InternalLocalCacheStorage.d.ts +2 -0
  137. package/lib/typescript/src/libs/SBUError.d.ts +14 -0
  138. package/lib/typescript/src/libs/SBUUtils.d.ts +3 -0
  139. package/lib/typescript/src/localization/StringSet.type.d.ts +3 -0
  140. package/lib/typescript/src/platform/types.d.ts +2 -1
  141. package/lib/typescript/src/version.d.ts +1 -1
  142. package/package.json +8 -8
  143. package/src/components/ChatFlatList.tsx +5 -4
  144. package/src/components/FileViewer.tsx +12 -4
  145. package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +55 -12
  146. package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +38 -30
  147. package/src/components/MessageRenderer/MessageIncomingSenderName.tsx +1 -1
  148. package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +5 -3
  149. package/src/components/MessageRenderer/index.tsx +5 -2
  150. package/src/containers/SendbirdUIKitContainer.tsx +13 -9
  151. package/src/contexts/SendbirdChat.tsx +18 -13
  152. package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +28 -4
  153. package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +5 -5
  154. package/src/domain/groupChannel/types.ts +6 -6
  155. package/src/domain/groupChannelList/component/GroupChannelListList.tsx +3 -2
  156. package/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.tsx +1 -1
  157. package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +3 -2
  158. package/src/domain/groupChannelSettings/module/moduleContext.tsx +33 -18
  159. package/src/domain/groupChannelUserList/types.ts +3 -3
  160. package/src/fragments/createGroupChannelCreateFragment.tsx +8 -7
  161. package/src/fragments/createGroupChannelFragment.tsx +4 -12
  162. package/src/fragments/createGroupChannelListFragment.tsx +1 -1
  163. package/src/fragments/createGroupChannelMembersFragment.tsx +4 -3
  164. package/src/hooks/useConnection.ts +40 -43
  165. package/src/hooks/usePushTokenRegistration.ts +2 -2
  166. package/src/index.ts +1 -0
  167. package/src/libs/InternalLocalCacheStorage.ts +5 -0
  168. package/src/libs/SBUError.ts +26 -0
  169. package/src/libs/SBUUtils.ts +9 -0
  170. package/src/localization/StringSet.type.ts +10 -0
  171. package/src/platform/createFileService.expo.ts +5 -4
  172. package/src/platform/createFileService.native.ts +17 -9
  173. package/src/platform/types.ts +3 -1
  174. package/src/version.ts +1 -1
@@ -1,5 +1,6 @@
1
1
  import { Platform } from 'react-native';
2
- import { getFileExtension, getFileType } from '@sendbird/uikit-utils';
2
+ import { getFileExtension, getFileType, normalizeFileName } from '@sendbird/uikit-utils';
3
+ import SBUError from '../libs/SBUError';
3
4
  import fileTypeGuard from '../utils/fileTypeGuard';
4
5
  import nativePermissionGranted from '../utils/nativePermissionGranted';
5
6
 
@@ -68,12 +69,13 @@ const createNativeFileService = _ref => {
68
69
  if (!granted) {
69
70
  var _options$onOpenFailur;
70
71
 
71
- options === null || options === void 0 ? void 0 : (_options$onOpenFailur = options.onOpenFailureWithToastMessage) === null || _options$onOpenFailur === void 0 ? void 0 : _options$onOpenFailur.call(options);
72
+ options === null || options === void 0 ? void 0 : (_options$onOpenFailur = options.onOpenFailure) === null || _options$onOpenFailur === void 0 ? void 0 : _options$onOpenFailur.call(options, SBUError.PERMISSIONS_DENIED);
72
73
  return null;
73
74
  }
74
75
  }
75
76
 
76
77
  const response = await imagePickerModule.launchCamera({
78
+ presentationStyle: 'fullScreen',
77
79
  cameraType: (options === null || options === void 0 ? void 0 : options.cameraType) ?? 'back',
78
80
  mediaType: (() => {
79
81
  switch (options === null || options === void 0 ? void 0 : options.mediaType) {
@@ -96,7 +98,7 @@ const createNativeFileService = _ref => {
96
98
  if (response.errorCode === 'camera_unavailable') {
97
99
  var _options$onOpenFailur2;
98
100
 
99
- options === null || options === void 0 ? void 0 : (_options$onOpenFailur2 = options.onOpenFailureWithToastMessage) === null || _options$onOpenFailur2 === void 0 ? void 0 : _options$onOpenFailur2.call(options);
101
+ options === null || options === void 0 ? void 0 : (_options$onOpenFailur2 = options.onOpenFailure) === null || _options$onOpenFailur2 === void 0 ? void 0 : _options$onOpenFailur2.call(options, SBUError.DEVICE_UNAVAILABLE, new Error(response.errorMessage));
100
102
  return null;
101
103
  }
102
104
 
@@ -128,12 +130,13 @@ const createNativeFileService = _ref => {
128
130
  if (!granted) {
129
131
  var _options$onOpenFailur3;
130
132
 
131
- options === null || options === void 0 ? void 0 : (_options$onOpenFailur3 = options.onOpenFailureWithToastMessage) === null || _options$onOpenFailur3 === void 0 ? void 0 : _options$onOpenFailur3.call(options);
133
+ options === null || options === void 0 ? void 0 : (_options$onOpenFailur3 = options.onOpenFailure) === null || _options$onOpenFailur3 === void 0 ? void 0 : _options$onOpenFailur3.call(options, SBUError.PERMISSIONS_DENIED);
132
134
  return null;
133
135
  }
134
136
  }
135
137
 
136
138
  const response = await imagePickerModule.launchImageLibrary({
139
+ presentationStyle: 'fullScreen',
137
140
  selectionLimit,
138
141
  mediaType: (() => {
139
142
  switch (options === null || options === void 0 ? void 0 : options.mediaType) {
@@ -156,7 +159,7 @@ const createNativeFileService = _ref => {
156
159
  if (response.errorCode === 'camera_unavailable') {
157
160
  var _options$onOpenFailur4;
158
161
 
159
- options === null || options === void 0 ? void 0 : (_options$onOpenFailur4 = options.onOpenFailureWithToastMessage) === null || _options$onOpenFailur4 === void 0 ? void 0 : _options$onOpenFailur4.call(options);
162
+ options === null || options === void 0 ? void 0 : (_options$onOpenFailur4 = options.onOpenFailure) === null || _options$onOpenFailur4 === void 0 ? void 0 : _options$onOpenFailur4.call(options, SBUError.DEVICE_UNAVAILABLE, new Error(response.errorMessage));
160
163
  return null;
161
164
  }
162
165
 
@@ -194,7 +197,7 @@ const createNativeFileService = _ref => {
194
197
  if (!documentPickerModule.isCancel(e) && documentPickerModule.isInProgress(e)) {
195
198
  var _options$onOpenFailur5;
196
199
 
197
- options === null || options === void 0 ? void 0 : (_options$onOpenFailur5 = options.onOpenFailureWithToastMessage) === null || _options$onOpenFailur5 === void 0 ? void 0 : _options$onOpenFailur5.call(options);
200
+ options === null || options === void 0 ? void 0 : (_options$onOpenFailur5 = options.onOpenFailure) === null || _options$onOpenFailur5 === void 0 ? void 0 : _options$onOpenFailur5.call(options, SBUError.UNKNOWN, e);
198
201
  }
199
202
 
200
203
  return null;
@@ -228,8 +231,14 @@ const createNativeFileService = _ref => {
228
231
  });
229
232
  const fileType = getFileType(getFileExtension(options.fileUrl));
230
233
 
231
- if (Platform.OS === 'ios' && fileType.match(/image|video/)) {
232
- await mediaLibraryModule.save(downloadPath);
234
+ if (Platform.OS === 'ios' && (fileType === 'image' || fileType === 'video')) {
235
+ const type = {
236
+ 'image': 'photo',
237
+ 'video': 'video'
238
+ }[fileType];
239
+ await mediaLibraryModule.save(downloadPath, {
240
+ type
241
+ });
233
242
  }
234
243
 
235
244
  if (Platform.OS === 'android') {
@@ -239,7 +248,7 @@ const createNativeFileService = _ref => {
239
248
  'image': 'images',
240
249
  'video': 'video'
241
250
  };
242
- await fsModule.FileSystem.cpExternal(downloadPath, options.fileName, dirType[fileType]);
251
+ await fsModule.FileSystem.cpExternal(downloadPath, normalizeFileName(options.fileName, getFileExtension(options.fileUrl)), dirType[fileType]);
243
252
  }
244
253
 
245
254
  return downloadPath;
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","getFileExtension","getFileType","fileTypeGuard","nativePermissionGranted","getAndroidStoragePermissionsByAPILevel","permissionModule","OS","Version","PERMISSIONS","ANDROID","READ_MEDIA_AUDIO","READ_MEDIA_IMAGES","READ_MEDIA_VIDEO","READ_EXTERNAL_STORAGE","WRITE_EXTERNAL_STORAGE","createNativeFileService","imagePickerModule","documentPickerModule","mediaLibraryModule","fsModule","cameraPermissions","select","ios","IOS","CAMERA","MICROPHONE","android","default","mediaLibraryPermissions","MEDIA_LIBRARY","PHOTO_LIBRARY","NativeFileService","hasCameraPermission","status","checkMultiple","requestCameraPermission","requestMultiple","hasMediaLibraryPermission","requestMediaLibraryPermission","openCamera","options","hasPermission","granted","onOpenFailureWithToastMessage","response","launchCamera","cameraType","mediaType","didCancel","errorCode","fileName","name","fileSize","size","type","uri","assets","openMediaLibrary","selectionLimit","launchImageLibrary","slice","map","openDocument","pickSingle","e","isCancel","isInProgress","save","Error","basePath","Dirs","CacheDir","DocumentDir","downloadPath","extensionFromUrl","fileUrl","match","FileSystem","fetch","path","fileType","dirType","cpExternal"],"sources":["createFileService.native.ts"],"sourcesContent":["import type CameraRoll from '@react-native-community/cameraroll';\nimport { Platform } from 'react-native';\nimport type * as DocumentPicker from 'react-native-document-picker';\nimport type * as FileAccess from 'react-native-file-access';\nimport type * as ImagePicker from 'react-native-image-picker';\nimport type * as Permissions from 'react-native-permissions';\nimport type { Permission } from 'react-native-permissions';\n\nimport { getFileExtension, getFileType } from '@sendbird/uikit-utils';\n\nimport fileTypeGuard from '../utils/fileTypeGuard';\nimport nativePermissionGranted from '../utils/nativePermissionGranted';\nimport type {\n FilePickerResponse,\n FileServiceInterface,\n OpenCameraOptions,\n OpenDocumentOptions,\n OpenMediaLibraryOptions,\n SaveOptions,\n} from './types';\n\nfunction getAndroidStoragePermissionsByAPILevel(permissionModule: typeof Permissions): Permission[] {\n if (Platform.OS !== 'android') return [];\n\n if (Platform.Version > 32) {\n return [\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_AUDIO,\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_IMAGES,\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_VIDEO,\n ];\n }\n\n if (Platform.Version > 28) {\n return [permissionModule.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE];\n }\n\n return [\n permissionModule.PERMISSIONS.ANDROID.WRITE_EXTERNAL_STORAGE,\n permissionModule.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE,\n ];\n}\n\nconst createNativeFileService = ({\n imagePickerModule,\n documentPickerModule,\n permissionModule,\n mediaLibraryModule,\n fsModule,\n}: {\n imagePickerModule: typeof ImagePicker;\n documentPickerModule: typeof DocumentPicker;\n permissionModule: typeof Permissions;\n mediaLibraryModule: typeof CameraRoll;\n fsModule: typeof FileAccess;\n}): FileServiceInterface => {\n const cameraPermissions: Permission[] = Platform.select({\n ios: [permissionModule.PERMISSIONS.IOS.CAMERA, permissionModule.PERMISSIONS.IOS.MICROPHONE],\n android: [permissionModule.PERMISSIONS.ANDROID.CAMERA],\n default: [],\n });\n const mediaLibraryPermissions: Permission[] = Platform.select({\n ios: [permissionModule.PERMISSIONS.IOS.MEDIA_LIBRARY, permissionModule.PERMISSIONS.IOS.PHOTO_LIBRARY],\n android: getAndroidStoragePermissionsByAPILevel(permissionModule),\n default: [],\n });\n\n class NativeFileService implements FileServiceInterface {\n async hasCameraPermission(): Promise<boolean> {\n const status = await permissionModule.checkMultiple(cameraPermissions);\n return nativePermissionGranted(status);\n }\n async requestCameraPermission(): Promise<boolean> {\n const status = await permissionModule.requestMultiple(cameraPermissions);\n return nativePermissionGranted(status);\n }\n async hasMediaLibraryPermission(): Promise<boolean> {\n const status = await permissionModule.checkMultiple(mediaLibraryPermissions);\n return nativePermissionGranted(status);\n }\n async requestMediaLibraryPermission(): Promise<boolean> {\n const status = await permissionModule.requestMultiple(mediaLibraryPermissions);\n return nativePermissionGranted(status);\n }\n\n async openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse> {\n const hasPermission = await this.hasCameraPermission();\n if (!hasPermission) {\n const granted = await this.requestCameraPermission();\n if (!granted) {\n options?.onOpenFailureWithToastMessage?.();\n return null;\n }\n }\n\n const response = await imagePickerModule.launchCamera({\n cameraType: options?.cameraType ?? 'back',\n mediaType: (() => {\n switch (options?.mediaType) {\n case 'photo':\n return 'photo';\n case 'video':\n return 'video';\n case 'all':\n return 'mixed';\n default:\n return 'photo';\n }\n })(),\n });\n if (response.didCancel) return null;\n if (response.errorCode === 'camera_unavailable') {\n options?.onOpenFailureWithToastMessage?.();\n return null;\n }\n\n const { fileName: name, fileSize: size, type, uri } = response.assets?.[0] ?? {};\n return fileTypeGuard({ uri, size, name, type });\n }\n async openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<FilePickerResponse[] | null> {\n /**\n * NOTE: options.selectionLimit {@link https://github.com/react-native-image-picker/react-native-image-picker#options}\n * We do not support 0 (any number of files)\n **/\n const selectionLimit = options?.selectionLimit || 1;\n const hasPermission = await this.hasMediaLibraryPermission();\n if (!hasPermission) {\n const granted = await this.requestMediaLibraryPermission();\n if (!granted) {\n options?.onOpenFailureWithToastMessage?.();\n return null;\n }\n }\n\n const response = await imagePickerModule.launchImageLibrary({\n selectionLimit,\n mediaType: (() => {\n switch (options?.mediaType) {\n case 'photo':\n return 'photo';\n case 'video':\n return 'video';\n case 'all':\n return 'mixed';\n default:\n return 'photo';\n }\n })(),\n });\n if (response.didCancel) return null;\n if (response.errorCode === 'camera_unavailable') {\n options?.onOpenFailureWithToastMessage?.();\n return null;\n }\n\n return (response.assets || [])\n .slice(0, selectionLimit)\n .map(({ fileName: name, fileSize: size, type, uri }) => fileTypeGuard({ uri, size, name, type }));\n }\n async openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse> {\n try {\n const { uri, size, name, type } = await documentPickerModule.pickSingle();\n return fileTypeGuard({ uri, size, name, type });\n } catch (e) {\n if (!documentPickerModule.isCancel(e) && documentPickerModule.isInProgress(e)) {\n options?.onOpenFailureWithToastMessage?.();\n }\n return null;\n }\n }\n async save(options: SaveOptions): Promise<string> {\n const hasPermission = await this.hasMediaLibraryPermission();\n if (!hasPermission) {\n const granted = await this.requestMediaLibraryPermission();\n if (!granted) throw new Error('Permission not granted');\n }\n\n const basePath = Platform.select({ android: fsModule.Dirs.CacheDir, default: fsModule.Dirs.DocumentDir });\n let downloadPath = `${basePath}/${options.fileName}`;\n if (!getFileExtension(options.fileName)) {\n const extensionFromUrl = getFileExtension(options.fileUrl);\n if (getFileType(extensionFromUrl).match(/image|video/)) {\n downloadPath += extensionFromUrl;\n }\n }\n\n await fsModule.FileSystem.fetch(options.fileUrl, { path: downloadPath });\n const fileType = getFileType(getFileExtension(options.fileUrl));\n\n if (Platform.OS === 'ios' && fileType.match(/image|video/)) {\n await mediaLibraryModule.save(downloadPath);\n }\n\n if (Platform.OS === 'android') {\n const dirType = { 'file': 'downloads', 'audio': 'audio', 'image': 'images', 'video': 'video' } as const;\n await fsModule.FileSystem.cpExternal(downloadPath, options.fileName, dirType[fileType]);\n }\n return downloadPath;\n }\n }\n\n return new NativeFileService();\n};\n\nexport default createNativeFileService;\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,cAAzB;AAOA,SAASC,gBAAT,EAA2BC,WAA3B,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AO,CAACmC,OAAlC,EAA2C;QAAEI,IAAI,EAAEN;MAAR,CAA3C,CAAN;MACA,MAAMO,QAAQ,GAAG/E,WAAW,CAACD,gBAAgB,CAACwC,OAAO,CAACmC,OAAT,CAAjB,CAA5B;;MAEA,IAAI5E,QAAQ,CAACO,EAAT,KAAgB,KAAhB,IAAyB0E,QAAQ,CAACJ,KAAT,CAAe,aAAf,CAA7B,EAA4D;QAC1D,MAAM1D,kBAAkB,CAACiD,IAAnB,CAAwBM,YAAxB,CAAN;MACD;;MAED,IAAI1E,QAAQ,CAACO,EAAT,KAAgB,SAApB,EAA+B;QAC7B,MAAM2E,OAAO,GAAG;UAAE,QAAQ,WAAV;UAAuB,SAAS,OAAhC;UAAyC,SAAS,QAAlD;UAA4D,SAAS;QAArE,CAAhB;QACA,MAAM9D,QAAQ,CAAC0D,UAAT,CAAoBK,UAApB,CAA+BT,YAA/B,EAA6CjC,OAAO,CAACU,QAArD,EAA+D+B,OAAO,CAACD,QAAD,CAAtE,CAAN;MACD;;MACD,OAAOP,YAAP;IACD;;EAnIqD;;EAsIxD,OAAO,IAAI1C,iBAAJ,EAAP;AACD,CA/JD;;AAiKA,eAAehB,uBAAf"}
1
+ {"version":3,"names":["Platform","getFileExtension","getFileType","normalizeFileName","SBUError","fileTypeGuard","nativePermissionGranted","getAndroidStoragePermissionsByAPILevel","permissionModule","OS","Version","PERMISSIONS","ANDROID","READ_MEDIA_AUDIO","READ_MEDIA_IMAGES","READ_MEDIA_VIDEO","READ_EXTERNAL_STORAGE","WRITE_EXTERNAL_STORAGE","createNativeFileService","imagePickerModule","documentPickerModule","mediaLibraryModule","fsModule","cameraPermissions","select","ios","IOS","CAMERA","MICROPHONE","android","default","mediaLibraryPermissions","MEDIA_LIBRARY","PHOTO_LIBRARY","NativeFileService","hasCameraPermission","status","checkMultiple","requestCameraPermission","requestMultiple","hasMediaLibraryPermission","requestMediaLibraryPermission","openCamera","options","hasPermission","granted","onOpenFailure","PERMISSIONS_DENIED","response","launchCamera","presentationStyle","cameraType","mediaType","didCancel","errorCode","DEVICE_UNAVAILABLE","Error","errorMessage","fileName","name","fileSize","size","type","uri","assets","openMediaLibrary","selectionLimit","launchImageLibrary","slice","map","openDocument","pickSingle","e","isCancel","isInProgress","UNKNOWN","save","basePath","Dirs","CacheDir","DocumentDir","downloadPath","extensionFromUrl","fileUrl","match","FileSystem","fetch","path","fileType","dirType","cpExternal"],"sources":["createFileService.native.ts"],"sourcesContent":["import type CameraRoll from '@react-native-community/cameraroll';\nimport { Platform } from 'react-native';\nimport type * as DocumentPicker from 'react-native-document-picker';\nimport type * as FileAccess from 'react-native-file-access';\nimport type * as ImagePicker from 'react-native-image-picker';\nimport type * as Permissions from 'react-native-permissions';\nimport type { Permission } from 'react-native-permissions';\n\nimport { getFileExtension, getFileType, normalizeFileName } from '@sendbird/uikit-utils';\n\nimport SBUError from '../libs/SBUError';\nimport fileTypeGuard from '../utils/fileTypeGuard';\nimport nativePermissionGranted from '../utils/nativePermissionGranted';\nimport type {\n FilePickerResponse,\n FileServiceInterface,\n OpenCameraOptions,\n OpenDocumentOptions,\n OpenMediaLibraryOptions,\n SaveOptions,\n} from './types';\n\nfunction getAndroidStoragePermissionsByAPILevel(permissionModule: typeof Permissions): Permission[] {\n if (Platform.OS !== 'android') return [];\n\n if (Platform.Version > 32) {\n return [\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_AUDIO,\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_IMAGES,\n permissionModule.PERMISSIONS.ANDROID.READ_MEDIA_VIDEO,\n ];\n }\n\n if (Platform.Version > 28) {\n return [permissionModule.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE];\n }\n\n return [\n permissionModule.PERMISSIONS.ANDROID.WRITE_EXTERNAL_STORAGE,\n permissionModule.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE,\n ];\n}\n\nconst createNativeFileService = ({\n imagePickerModule,\n documentPickerModule,\n permissionModule,\n mediaLibraryModule,\n fsModule,\n}: {\n imagePickerModule: typeof ImagePicker;\n documentPickerModule: typeof DocumentPicker;\n permissionModule: typeof Permissions;\n mediaLibraryModule: typeof CameraRoll;\n fsModule: typeof FileAccess;\n}): FileServiceInterface => {\n const cameraPermissions: Permission[] = Platform.select({\n ios: [permissionModule.PERMISSIONS.IOS.CAMERA, permissionModule.PERMISSIONS.IOS.MICROPHONE],\n android: [permissionModule.PERMISSIONS.ANDROID.CAMERA],\n default: [],\n });\n const mediaLibraryPermissions: Permission[] = Platform.select({\n ios: [permissionModule.PERMISSIONS.IOS.MEDIA_LIBRARY, permissionModule.PERMISSIONS.IOS.PHOTO_LIBRARY],\n android: getAndroidStoragePermissionsByAPILevel(permissionModule),\n default: [],\n });\n\n class NativeFileService implements FileServiceInterface {\n async hasCameraPermission(): Promise<boolean> {\n const status = await permissionModule.checkMultiple(cameraPermissions);\n return nativePermissionGranted(status);\n }\n async requestCameraPermission(): Promise<boolean> {\n const status = await permissionModule.requestMultiple(cameraPermissions);\n return nativePermissionGranted(status);\n }\n async hasMediaLibraryPermission(): Promise<boolean> {\n const status = await permissionModule.checkMultiple(mediaLibraryPermissions);\n return nativePermissionGranted(status);\n }\n async requestMediaLibraryPermission(): Promise<boolean> {\n const status = await permissionModule.requestMultiple(mediaLibraryPermissions);\n return nativePermissionGranted(status);\n }\n\n async openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse> {\n const hasPermission = await this.hasCameraPermission();\n if (!hasPermission) {\n const granted = await this.requestCameraPermission();\n if (!granted) {\n options?.onOpenFailure?.(SBUError.PERMISSIONS_DENIED);\n return null;\n }\n }\n\n const response = await imagePickerModule.launchCamera({\n presentationStyle: 'fullScreen',\n cameraType: options?.cameraType ?? 'back',\n mediaType: (() => {\n switch (options?.mediaType) {\n case 'photo':\n return 'photo';\n case 'video':\n return 'video';\n case 'all':\n return 'mixed';\n default:\n return 'photo';\n }\n })(),\n });\n if (response.didCancel) return null;\n if (response.errorCode === 'camera_unavailable') {\n options?.onOpenFailure?.(SBUError.DEVICE_UNAVAILABLE, new Error(response.errorMessage));\n return null;\n }\n\n const { fileName: name, fileSize: size, type, uri } = response.assets?.[0] ?? {};\n return fileTypeGuard({ uri, size, name, type });\n }\n async openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<FilePickerResponse[] | null> {\n /**\n * NOTE: options.selectionLimit {@link https://github.com/react-native-image-picker/react-native-image-picker#options}\n * We do not support 0 (any number of files)\n **/\n const selectionLimit = options?.selectionLimit || 1;\n const hasPermission = await this.hasMediaLibraryPermission();\n if (!hasPermission) {\n const granted = await this.requestMediaLibraryPermission();\n if (!granted) {\n options?.onOpenFailure?.(SBUError.PERMISSIONS_DENIED);\n return null;\n }\n }\n\n const response = await imagePickerModule.launchImageLibrary({\n presentationStyle: 'fullScreen',\n selectionLimit,\n mediaType: (() => {\n switch (options?.mediaType) {\n case 'photo':\n return 'photo';\n case 'video':\n return 'video';\n case 'all':\n return 'mixed';\n default:\n return 'photo';\n }\n })(),\n });\n if (response.didCancel) return null;\n if (response.errorCode === 'camera_unavailable') {\n options?.onOpenFailure?.(SBUError.DEVICE_UNAVAILABLE, new Error(response.errorMessage));\n return null;\n }\n\n return (response.assets || [])\n .slice(0, selectionLimit)\n .map(({ fileName: name, fileSize: size, type, uri }) => fileTypeGuard({ uri, size, name, type }));\n }\n async openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse> {\n try {\n const { uri, size, name, type } = await documentPickerModule.pickSingle();\n return fileTypeGuard({ uri, size, name, type });\n } catch (e) {\n if (!documentPickerModule.isCancel(e) && documentPickerModule.isInProgress(e)) {\n options?.onOpenFailure?.(SBUError.UNKNOWN, e);\n }\n return null;\n }\n }\n async save(options: SaveOptions): Promise<string> {\n const hasPermission = await this.hasMediaLibraryPermission();\n if (!hasPermission) {\n const granted = await this.requestMediaLibraryPermission();\n if (!granted) throw new Error('Permission not granted');\n }\n\n const basePath = Platform.select({ android: fsModule.Dirs.CacheDir, default: fsModule.Dirs.DocumentDir });\n let downloadPath = `${basePath}/${options.fileName}`;\n if (!getFileExtension(options.fileName)) {\n const extensionFromUrl = getFileExtension(options.fileUrl);\n if (getFileType(extensionFromUrl).match(/image|video/)) {\n downloadPath += extensionFromUrl;\n }\n }\n\n await fsModule.FileSystem.fetch(options.fileUrl, { path: downloadPath });\n const fileType = getFileType(getFileExtension(options.fileUrl));\n\n if (Platform.OS === 'ios' && (fileType === 'image' || fileType === 'video')) {\n const type = ({ 'image': 'photo', 'video': 'video' } as const)[fileType];\n await mediaLibraryModule.save(downloadPath, { type });\n }\n\n if (Platform.OS === 'android') {\n const dirType = { 'file': 'downloads', 'audio': 'audio', 'image': 'images', 'video': 'video' } as const;\n await fsModule.FileSystem.cpExternal(\n downloadPath,\n normalizeFileName(options.fileName, getFileExtension(options.fileUrl)),\n dirType[fileType],\n );\n }\n return downloadPath;\n }\n }\n\n return new NativeFileService();\n};\n\nexport default createNativeFileService;\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,cAAzB;AAOA,SAASC,gBAAT,EAA2BC,WAA3B,EAAwCC,iBAAxC,QAAiE,uBAAjE;AAEA,OAAOC,QAAP,MAAqB,kBAArB;AACA,OAAOC,aAAP,MAA0B,wBAA1B;AACA,OAAOC,uBAAP,MAAoC,kCAApC;;AAUA,SAASC,sCAAT,CAAgDC,gBAAhD,EAAoG;EAClG,IAAIR,QAAQ,CAACS,EAAT,KAAgB,SAApB,EAA+B,OAAO,EAAP;;EAE/B,IAAIT,QAAQ,CAACU,OAAT,GAAmB,EAAvB,EAA2B;IACzB,OAAO,CACLF,gBAAgB,CAACG,WAAjB,CAA6BC,OAA7B,CAAqCC,gBADhC,EAELL,gBAAgB,CAACG,WAAjB,CAA6BC,OAA7B,CAAqCE,iBAFhC,EAGLN,gBAAgB,CAACG,WAAjB,CAA6BC,OAA7B,CAAqCG,gBAHhC,CAAP;EAKD;;EAED,IAAIf,QAAQ,CAACU,OAAT,GAAmB,EAAvB,EAA2B;IACzB,OAAO,CAACF,gBAAgB,CAACG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AAInF,QAAQ,CAACS,EAAT,KAAgB,KAAhB,KAA0B+E,QAAQ,KAAK,OAAb,IAAwBA,QAAQ,KAAK,OAA/D,CAAJ,EAA6E;QAC3E,MAAM1B,IAAI,GAAI;UAAE,SAAS,OAAX;UAAoB,SAAS;QAA7B,CAAD,CAAkD0B,QAAlD,CAAb;QACA,MAAMnE,kBAAkB,CAACuD,IAAnB,CAAwBK,YAAxB,EAAsC;UAAEnB;QAAF,CAAtC,CAAN;MACD;;MAED,IAAI9D,QAAQ,CAACS,EAAT,KAAgB,SAApB,EAA+B;QAC7B,MAAMgF,OAAO,GAAG;UAAE,QAAQ,WAAV;UAAuB,SAAS,OAAhC;UAAyC,SAAS,QAAlD;UAA4D,SAAS;QAArE,CAAhB;QACA,MAAMnE,QAAQ,CAAC+D,UAAT,CAAoBK,UAApB,CACJT,YADI,EAEJ9E,iBAAiB,CAACwC,OAAO,CAACe,QAAT,EAAmBzD,gBAAgB,CAAC0C,OAAO,CAACwC,OAAT,CAAnC,CAFb,EAGJM,OAAO,CAACD,QAAD,CAHH,CAAN;MAKD;;MACD,OAAOP,YAAP;IACD;;EA1IqD;;EA6IxD,OAAO,IAAI/C,iBAAJ,EAAP;AACD,CAtKD;;AAwKA,eAAehB,uBAAf"}
@@ -1,2 +1,2 @@
1
-
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type Unsubscribe = () => void | undefined;\nexport type DownloadedPath = string;\nexport type FilePickerResponse = FileType | null;\nexport type FileType = { uri: string; size: number; name: string; type: string };\n\n// ---------- NotificationService ---------- //\nexport interface NotificationServiceInterface {\n hasPushPermission(): Promise<boolean>;\n requestPushPermission(): Promise<boolean>;\n\n getAPNSToken(): Promise<string | null>;\n getFCMToken(): Promise<string | null>;\n onTokenRefresh(handler: (token: string) => void): Unsubscribe;\n}\n\n// ---------- ClipboardService ---------- //\nexport interface ClipboardServiceInterface {\n setString(text: string): void;\n getString(): Promise<string>;\n}\n\n// ---------- FileService ---------- //\nexport interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {}\n\nexport interface OpenResultListener {\n onOpenFailureWithToastMessage?: () => void;\n}\nexport interface OpenMediaLibraryOptions extends OpenResultListener {\n selectionLimit?: number;\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport interface OpenCameraOptions extends OpenResultListener {\n cameraType?: 'front' | 'back';\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport type OpenDocumentOptions = OpenResultListener;\nexport interface SaveOptions {\n fileUrl: string;\n fileName: string;\n fileType?: string | null;\n}\n\nexport interface FilePickerServiceInterface {\n openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<null | FilePickerResponse[]>;\n openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse>;\n openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse>;\n}\n\nexport interface FileSystemServiceInterface {\n // NOTE: On iOS, You can access the downloaded files by providing options below to info.plist\n // - Supports opening documents in place\n // - Application supports iTunes file sharing\n save(options?: SaveOptions): Promise<DownloadedPath | null>;\n}\n\n// ---------- MediaService ---------- //\ninterface VideoProps {\n source: { uri: string } | number;\n resizeMode?: 'cover' | 'contain' | 'stretch';\n onLoad?: () => void;\n}\ninterface GetVideoThumbnailOptions {\n url: string;\n timeMills?: number;\n quality?: number;\n}\nexport interface MediaServiceInterface {\n VideoComponent<Props = {}>(props: VideoProps & Props): JSX.Element;\n getVideoThumbnail(options: GetVideoThumbnailOptions): Promise<{ path: string } | null>;\n // compressImage(options: {\n // path: string;\n // compressionRate: number;\n // resizingWidth: number;\n // resizingHeight: number;\n // }): Promise<{ path: string }>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type SBUError from '../libs/SBUError';\n\nexport type Unsubscribe = () => void | undefined;\nexport type DownloadedPath = string;\nexport type FilePickerResponse = FileType | null;\nexport type FileType = { uri: string; size: number; name: string; type: string };\n\n// ---------- NotificationService ---------- //\nexport interface NotificationServiceInterface {\n hasPushPermission(): Promise<boolean>;\n requestPushPermission(): Promise<boolean>;\n\n getAPNSToken(): Promise<string | null>;\n getFCMToken(): Promise<string | null>;\n onTokenRefresh(handler: (token: string) => void): Unsubscribe;\n}\n\n// ---------- ClipboardService ---------- //\nexport interface ClipboardServiceInterface {\n setString(text: string): void;\n getString(): Promise<string>;\n}\n\n// ---------- FileService ---------- //\nexport interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {}\n\nexport interface OpenResultListener {\n onOpenFailure?: (error: SBUError, originError?: unknown) => void;\n}\nexport interface OpenMediaLibraryOptions extends OpenResultListener {\n selectionLimit?: number;\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport interface OpenCameraOptions extends OpenResultListener {\n cameraType?: 'front' | 'back';\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport type OpenDocumentOptions = OpenResultListener;\nexport interface SaveOptions {\n fileUrl: string;\n fileName: string;\n fileType?: string | null;\n}\n\nexport interface FilePickerServiceInterface {\n openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<null | FilePickerResponse[]>;\n openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse>;\n openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse>;\n}\n\nexport interface FileSystemServiceInterface {\n // NOTE: On iOS, You can access the downloaded files by providing options below to info.plist\n // - Supports opening documents in place\n // - Application supports iTunes file sharing\n save(options?: SaveOptions): Promise<DownloadedPath | null>;\n}\n\n// ---------- MediaService ---------- //\ninterface VideoProps {\n source: { uri: string } | number;\n resizeMode?: 'cover' | 'contain' | 'stretch';\n onLoad?: () => void;\n}\ninterface GetVideoThumbnailOptions {\n url: string;\n timeMills?: number;\n quality?: number;\n}\nexport interface MediaServiceInterface {\n VideoComponent<Props = {}>(props: VideoProps & Props): JSX.Element;\n getVideoThumbnail(options: GetVideoThumbnailOptions): Promise<{ path: string } | null>;\n // compressImage(options: {\n // path: string;\n // compressionRate: number;\n // resizingWidth: number;\n // resizingHeight: number;\n // }): Promise<{ path: string }>;\n}\n"],"mappings":""}
@@ -1,3 +1,3 @@
1
- const VERSION = '1.1.1';
1
+ const VERSION = '2.0.0-rc.0';
2
2
  export default VERSION;
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '1.1.1';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,OAAhB;AACA,eAAeA,OAAf"}
1
+ {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.0.0-rc.0';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,YAAhB;AACA,eAAeA,OAAf"}
@@ -1,7 +1,7 @@
1
- import type Sendbird from 'sendbird';
1
+ import type { OGMetaData } from '@sendbird/chat/message';
2
2
  import type { UserMessageProps } from './index';
3
3
  declare type Props = UserMessageProps & {
4
- ogMetaData: Sendbird.OGMetaData;
4
+ ogMetaData: OGMetaData;
5
5
  };
6
6
  declare const OpenGraphUserMessage: ({ message, variant, pressed, ogMetaData }: Props) => JSX.Element;
7
7
  export default OpenGraphUserMessage;
@@ -16,7 +16,7 @@ declare const _default: React.MemoExoticComponent<(props: {
16
16
  nextMessage?: SendbirdMessage | undefined;
17
17
  onPress?: (() => void) | undefined;
18
18
  onLongPress?: (() => void) | undefined;
19
- channel: import("sendbird").GroupChannel;
19
+ channel: import("@sendbird/chat/groupChannel").GroupChannel;
20
20
  currentUserId?: string | undefined;
21
21
  enableMessageGrouping: boolean;
22
22
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null>;
@@ -5,7 +5,7 @@ import type { StringSet } from '../localization/StringSet.type';
5
5
  import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface } from '../platform/types';
6
6
  import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
7
7
  export declare const SendbirdUIKit: Readonly<{
8
- VERSION: "1.1.1";
8
+ VERSION: "2.0.0-rc.0";
9
9
  PLATFORM: string;
10
10
  }>;
11
11
  export declare type SendbirdUIKitContainerProps = React.PropsWithChildren<{
@@ -11,7 +11,7 @@ declare type Context = {
11
11
  sdk: SendbirdChatSDK;
12
12
  currentUser?: SendbirdUser;
13
13
  setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
14
- updateCurrentUserInfo: (nickname: string, profile?: string | FileType) => Promise<SendbirdUser>;
14
+ updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;
15
15
  markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;
16
16
  features: {
17
17
  autoPushTokenRegistrationEnabled: boolean;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  declare const _default: React.MemoExoticComponent<(props: {
3
- channel: import("sendbird").GroupChannel;
3
+ channel: import("@sendbird/chat/groupChannel").GroupChannel;
4
4
  onSendFileMessage: (file: import("../../../..").FileType) => Promise<void>;
5
5
  onSendUserMessage: (text: string) => Promise<void>;
6
- onUpdateFileMessage: (editedFile: import("../../../..").FileType, message: import("sendbird").FileMessage) => Promise<void>;
7
- onUpdateUserMessage: (editedText: string, message: import("sendbird").UserMessage) => Promise<void>;
6
+ onUpdateFileMessage: (editedFile: import("../../../..").FileType, message: import("@sendbird/chat/message").FileMessage) => Promise<void>;
7
+ onUpdateUserMessage: (editedText: string, message: import("@sendbird/chat/message").UserMessage) => Promise<void>;
8
8
  }) => JSX.Element>;
9
9
  export default _default;
@@ -3,22 +3,22 @@ import type { SendbirdMessage } from '@sendbird/uikit-utils';
3
3
  declare const _default: React.MemoExoticComponent<({ currentUserId, channel, messages, renderMessage, nextMessages, newMessagesFromMembers, onBottomReached, onTopReached, renderNewMessagesButton, renderScrollToBottomButton, onResendFailedMessage, onDeleteMessage, onPressImageMessage, onPressMediaMessage, flatListProps, enableMessageGrouping, }: {
4
4
  enableMessageGrouping: boolean;
5
5
  currentUserId?: string | undefined;
6
- channel: import("sendbird").GroupChannel;
6
+ channel: import("@sendbird/chat/groupChannel").GroupChannel;
7
7
  messages: SendbirdMessage[];
8
8
  nextMessages: SendbirdMessage[];
9
9
  newMessagesFromMembers: SendbirdMessage[];
10
10
  onTopReached: () => void;
11
11
  onBottomReached: () => void;
12
- onResendFailedMessage: (failedMessage: import("sendbird").FileMessage | import("sendbird").UserMessage) => Promise<void>;
13
- onDeleteMessage: (message: import("sendbird").FileMessage | import("sendbird").UserMessage) => Promise<void>;
14
- onPressMediaMessage?: ((message: import("sendbird").FileMessage, deleteMessage: () => Promise<void>, uri: string) => void) | undefined;
12
+ onResendFailedMessage: (failedMessage: import("@sendbird/chat/message").FileMessage | import("@sendbird/chat/message").UserMessage) => Promise<void>;
13
+ onDeleteMessage: (message: import("@sendbird/chat/message").FileMessage | import("@sendbird/chat/message").UserMessage) => Promise<void>;
14
+ onPressMediaMessage?: ((message: import("@sendbird/chat/message").FileMessage, deleteMessage: () => Promise<void>, uri: string) => void) | undefined;
15
15
  renderMessage: (props: {
16
16
  message: SendbirdMessage;
17
17
  prevMessage?: SendbirdMessage | undefined;
18
18
  nextMessage?: SendbirdMessage | undefined;
19
19
  onPress?: (() => void) | undefined;
20
20
  onLongPress?: (() => void) | undefined;
21
- channel: import("sendbird").GroupChannel;
21
+ channel: import("@sendbird/chat/groupChannel").GroupChannel;
22
22
  currentUserId?: string | undefined;
23
23
  enableMessageGrouping: boolean;
24
24
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -32,6 +32,6 @@ declare const _default: React.MemoExoticComponent<({ currentUserId, channel, mes
32
32
  onPress: () => void;
33
33
  }> | null;
34
34
  flatListProps?: Omit<import("react-native").FlatListProps<SendbirdMessage>, "data" | "renderItem"> | undefined;
35
- onPressImageMessage?: ((message: import("sendbird").FileMessage, uri: string) => void) | undefined;
35
+ onPressImageMessage?: ((message: import("@sendbird/chat/message").FileMessage, uri: string) => void) | undefined;
36
36
  }) => JSX.Element>;
37
37
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { FlatListProps } from 'react-native';
3
3
  import type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';
4
- import type { SendbirdFileMessage, SendbirdFileMessageParams, SendbirdGroupChannel, SendbirdMessage, SendbirdUser, SendbirdUserMessage, SendbirdUserMessageParams } from '@sendbird/uikit-utils';
4
+ import type { SendbirdFileMessage, SendbirdFileMessageCreateParams, SendbirdGroupChannel, SendbirdMessage, SendbirdUser, SendbirdUserMessage, SendbirdUserMessageCreateParams } from '@sendbird/uikit-utils';
5
5
  import type { FileType } from '../../platform/types';
6
6
  import type { CommonComponent } from '../../types';
7
7
  export interface GroupChannelProps {
@@ -10,8 +10,8 @@ export interface GroupChannelProps {
10
10
  onChannelDeleted: () => void;
11
11
  onPressHeaderLeft: GroupChannelProps['Header']['onPressHeaderLeft'];
12
12
  onPressHeaderRight: GroupChannelProps['Header']['onPressHeaderRight'];
13
- onBeforeSendFileMessage?: (params: SendbirdFileMessageParams) => SendbirdFileMessageParams | Promise<SendbirdFileMessageParams>;
14
- onBeforeSendUserMessage?: (params: SendbirdUserMessageParams) => SendbirdUserMessageParams | Promise<SendbirdUserMessageParams>;
13
+ onBeforeSendFileMessage?: (params: SendbirdFileMessageCreateParams) => SendbirdFileMessageCreateParams | Promise<SendbirdFileMessageCreateParams>;
14
+ onBeforeSendUserMessage?: (params: SendbirdUserMessageCreateParams) => SendbirdUserMessageCreateParams | Promise<SendbirdUserMessageCreateParams>;
15
15
  onPressMediaMessage?: GroupChannelProps['MessageList']['onPressMediaMessage'];
16
16
  renderMessage?: GroupChannelProps['MessageList']['renderMessage'];
17
17
  renderNewMessagesButton?: GroupChannelProps['MessageList']['renderNewMessagesButton'];
@@ -1,5 +1,5 @@
1
1
  import type { UseUserListOptions } from '@sendbird/uikit-chat-hooks';
2
- import type { SendbirdGroupChannel, SendbirdGroupChannelParams } from '@sendbird/uikit-utils';
2
+ import type { SendbirdGroupChannel, SendbirdGroupChannelCreateParams } from '@sendbird/uikit-utils';
3
3
  import type { CommonComponent } from '../../types';
4
4
  import type { GroupChannelType } from '../groupChannelList/types';
5
5
  import type { UserListProps } from '../userList/types';
@@ -10,7 +10,7 @@ export interface GroupChannelCreateProps<User> {
10
10
  onCreateChannel: (channel: SendbirdGroupChannel) => void;
11
11
  channelType?: GroupChannelType;
12
12
  userIdsGenerator?: (users: User[]) => UserIds;
13
- onBeforeCreateChannel?: (params: SendbirdGroupChannelParams, users: User[]) => SendbirdGroupChannelParams | Promise<SendbirdGroupChannelParams>;
13
+ onBeforeCreateChannel?: (params: SendbirdGroupChannelCreateParams, users: User[]) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;
14
14
  sortComparator?: UseUserListOptions<User>['sortComparator'];
15
15
  queryCreator?: UseUserListOptions<User>['queryCreator'];
16
16
  renderUser?: UserListProps<User>['List']['renderUser'];
@@ -9,11 +9,11 @@ export declare const usePlatformService: () => {
9
9
  children?: import("react").ReactNode;
10
10
  };
11
11
  export declare const useSendbirdChat: () => {
12
- sdk: import("sendbird").SendBirdInstance;
13
- currentUser?: import("sendbird").User | undefined;
14
- setCurrentUser: import("react").Dispatch<import("react").SetStateAction<import("sendbird").User | undefined>>;
15
- updateCurrentUserInfo: (nickname: string, profile?: string | import("..").FileType | undefined) => Promise<import("sendbird").User>;
16
- markAsDeliveredWithChannel: (channel: import("sendbird").GroupChannel) => void;
12
+ sdk: import("packages/uikit-utils/lib/typescript/src").SendbirdChatSDK;
13
+ currentUser?: import("@sendbird/chat").User | undefined;
14
+ setCurrentUser: import("react").Dispatch<import("react").SetStateAction<import("@sendbird/chat").User | undefined>>;
15
+ updateCurrentUserInfo: (nickname?: string | undefined, profile?: string | import("..").FileType | undefined) => Promise<import("@sendbird/chat").User>;
16
+ markAsDeliveredWithChannel: (channel: import("@sendbird/chat/groupChannel").GroupChannel) => void;
17
17
  features: {
18
18
  autoPushTokenRegistrationEnabled: boolean;
19
19
  channelListTypingIndicatorEnabled: boolean;
@@ -50,4 +50,5 @@ export type { UserListProps, UserListModule, UserListContextsType } from './doma
50
50
  export * from './domain/groupChannelUserList/types';
51
51
  /** UIKit **/
52
52
  export { default as SendbirdUIKitContainer, SendbirdUIKit, SendbirdUIKitContainerProps, } from './containers/SendbirdUIKitContainer';
53
+ export { default as SBUError } from './libs/SBUError';
53
54
  export * from './types';
@@ -9,4 +9,6 @@ export default class InternalLocalCacheStorage implements LocalCacheStorage {
9
9
  multiGet(keys: string[]): Promise<readonly KeyValuePairGet[]>;
10
10
  multiRemove(keys: string[]): Promise<void>;
11
11
  multiSet(keyValuePairs: Array<KeyValuePairSet>): Promise<void>;
12
+ clear: () => Promise<undefined>;
13
+ flushGetRequests: () => Promise<undefined>;
12
14
  }
@@ -0,0 +1,14 @@
1
+ declare enum SBUErrorCode {
2
+ ERR_UNKNOWN = 90000000,
3
+ ERR_PERMISSIONS_DENIED = 91001000,
4
+ ERR_DEVICE_UNAVAILABLE = 91001001
5
+ }
6
+ export default class SBUError extends Error {
7
+ code: SBUErrorCode;
8
+ static CODE: typeof SBUErrorCode;
9
+ static get UNKNOWN(): SBUError;
10
+ static get PERMISSIONS_DENIED(): SBUError;
11
+ static get DEVICE_UNAVAILABLE(): SBUError;
12
+ constructor(code: SBUErrorCode, message?: string);
13
+ }
14
+ export {};
@@ -0,0 +1,3 @@
1
+ export default class SBUUtils {
2
+ static openSettings(): void;
3
+ }
@@ -125,6 +125,9 @@ export interface StringSet {
125
125
  };
126
126
  DIALOG: {
127
127
  ALERT_DEFAULT_OK: string;
128
+ ALERT_PERMISSIONS_TITLE: string;
129
+ ALERT_PERMISSIONS_MESSAGE: (permission: string, appName: string) => string;
130
+ ALERT_PERMISSIONS_OK: string;
128
131
  PROMPT_DEFAULT_OK: string;
129
132
  PROMPT_DEFAULT_CANCEL: string;
130
133
  PROMPT_DEFAULT_PLACEHOLDER: string;
@@ -1,3 +1,4 @@
1
+ import type SBUError from '../libs/SBUError';
1
2
  export declare type Unsubscribe = () => void | undefined;
2
3
  export declare type DownloadedPath = string;
3
4
  export declare type FilePickerResponse = FileType | null;
@@ -21,7 +22,7 @@ export interface ClipboardServiceInterface {
21
22
  export interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {
22
23
  }
23
24
  export interface OpenResultListener {
24
- onOpenFailureWithToastMessage?: () => void;
25
+ onOpenFailure?: (error: SBUError, originError?: unknown) => void;
25
26
  }
26
27
  export interface OpenMediaLibraryOptions extends OpenResultListener {
27
28
  selectionLimit?: number;
@@ -1,2 +1,2 @@
1
- declare const VERSION = "1.1.1";
1
+ declare const VERSION = "2.0.0-rc.0";
2
2
  export default VERSION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native",
3
- "version": "1.1.1",
3
+ "version": "2.0.0-rc.0",
4
4
  "description": "react-native-uikit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -41,9 +41,9 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@sendbird/uikit-chat-hooks": "1.1.1",
45
- "@sendbird/uikit-react-native-foundation": "1.1.1",
46
- "@sendbird/uikit-utils": "1.1.1"
44
+ "@sendbird/uikit-chat-hooks": "2.0.0-rc.0",
45
+ "@sendbird/uikit-react-native-foundation": "2.0.0-rc.0",
46
+ "@sendbird/uikit-utils": "2.0.0-rc.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@react-native-clipboard/clipboard": "^1.8.5",
@@ -67,7 +67,7 @@
67
67
  "inquirer": "^8.2.0",
68
68
  "js-convert-case": "^4.2.0",
69
69
  "react": "17.0.2",
70
- "react-native": "0.66.4",
70
+ "react-native": "0.67.4",
71
71
  "react-native-builder-bob": "^0.18.0",
72
72
  "react-native-create-thumbnail": "^1.5.1",
73
73
  "react-native-document-picker": "^8.0.0",
@@ -83,6 +83,7 @@
83
83
  "@react-native-community/cameraroll": ">=4.1.2",
84
84
  "@react-native-community/netinfo": ">=9.3.0",
85
85
  "@react-native-firebase/messaging": ">=14.4.0",
86
+ "@sendbird/chat": "^4.0.13",
86
87
  "date-fns": ">=2.28.0",
87
88
  "expo-av": ">=12.0.4",
88
89
  "expo-clipboard": ">=2.1.1",
@@ -99,8 +100,7 @@
99
100
  "react-native-image-picker": ">=4.7.1",
100
101
  "react-native-permissions": ">=3.6.0",
101
102
  "react-native-safe-area-context": ">=3.3.2",
102
- "react-native-video": ">=5.2.0",
103
- "sendbird": "^3.1.22"
103
+ "react-native-video": ">=5.2.0"
104
104
  },
105
105
  "peerDependenciesMeta": {
106
106
  "@react-native-clipboard/clipboard": {
@@ -159,5 +159,5 @@
159
159
  "readmeFile": "./README.md",
160
160
  "displayName": "@sendbird/uikit-react-native"
161
161
  },
162
- "gitHead": "7b0384ecf1025f70e8a19f0490231273893f3f56"
162
+ "gitHead": "394d5e3e259086c2226a24406462f119d4af9860"
163
163
  }
@@ -75,16 +75,17 @@ const ChatFlatList = forwardRef<ChatFlatListRef, Props>(function CustomFlatList(
75
75
 
76
76
  return (
77
77
  <FlatList
78
+ bounces={false}
79
+ removeClippedSubviews
80
+ keyboardDismissMode={'on-drag'}
81
+ keyboardShouldPersistTaps={'handled'}
82
+ indicatorStyle={select({ light: 'black', dark: 'white' })}
78
83
  {...props}
79
84
  // FIXME: inverted list of ListEmptyComponent is reversed {@link https://github.com/facebook/react-native/issues/21196#issuecomment-836937743}
80
85
  inverted={Boolean(props.data?.length)}
81
86
  // FIXME: maintainVisibleContentPosition is not working on Android {@link https://github.com/facebook/react-native/issues/25239}
82
87
  // maintainVisibleContentPosition={{ minIndexForVisible: 1, autoscrollToTopThreshold: AUTO_SCROLL_TO_TOP_THRESHOLD }}
83
88
  ref={scrollRef}
84
- bounces={false}
85
- keyboardShouldPersistTaps={'handled'}
86
- indicatorStyle={select({ light: 'black', dark: 'white' })}
87
- removeClippedSubviews
88
89
  onEndReachedThreshold={0.5}
89
90
  onEndReached={onTopReached}
90
91
  scrollEventThrottle={16}
@@ -14,7 +14,15 @@ import {
14
14
  useUIKitTheme,
15
15
  } from '@sendbird/uikit-react-native-foundation';
16
16
  import type { SendbirdFileMessage } from '@sendbird/uikit-utils';
17
- import { Logger, getFileExtension, getFileType, isMyMessage, toMegabyte, useIIFE } from '@sendbird/uikit-utils';
17
+ import {
18
+ Logger,
19
+ getFileExtension,
20
+ getFileType,
21
+ isMyMessage,
22
+ toMegabyte,
23
+ truncate,
24
+ useIIFE,
25
+ } from '@sendbird/uikit-utils';
18
26
 
19
27
  import { useLocalization, usePlatformService, useSendbirdChat } from '../hooks/useContext';
20
28
 
@@ -194,10 +202,10 @@ const FileViewerHeader = ({ topInset, onClose, subtitle, title }: HeaderProps) =
194
202
  <Icon icon={'close'} size={24} color={palette.onBackgroundDark01} />
195
203
  </TouchableOpacity>
196
204
  <View style={styles.barTitleContainer}>
197
- <Text h2 color={palette.onBackgroundDark01} style={styles.headerTitle}>
198
- {title}
205
+ <Text h2 color={palette.onBackgroundDark01} style={styles.headerTitle} numberOfLines={1}>
206
+ {truncate(title, { mode: 'mid', maxLen: 18 })}
199
207
  </Text>
200
- <Text caption2 color={palette.onBackgroundDark01}>
208
+ <Text caption2 color={palette.onBackgroundDark01} numberOfLines={1}>
201
209
  {subtitle}
202
210
  </Text>
203
211
  </View>
@@ -1,10 +1,39 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { Platform, StyleSheet, View } from 'react-native';
2
3
 
3
4
  import { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
4
- import { getAvailableUriFromFileMessage } from '@sendbird/uikit-utils';
5
+ import { getAvailableUriFromFileMessage, useForceUpdate } from '@sendbird/uikit-utils';
5
6
 
6
7
  import type { FileMessageProps } from './index';
7
8
 
9
+ const useRetry = (hasError: boolean, retryCount = 5) => {
10
+ if (Platform.OS === 'android') return '';
11
+
12
+ const forceUpdate = useForceUpdate();
13
+ const retryCountRef = useRef(1);
14
+ const retryTimeoutRef = useRef<NodeJS.Timeout>();
15
+
16
+ useEffect(() => {
17
+ if (hasError) {
18
+ const reloadReservation = () => {
19
+ if (retryCountRef.current < retryCount) {
20
+ retryTimeoutRef.current = setTimeout(() => {
21
+ retryCountRef.current++;
22
+ reloadReservation();
23
+ forceUpdate();
24
+ }, retryCountRef.current * 5000);
25
+ }
26
+ };
27
+
28
+ return reloadReservation();
29
+ } else {
30
+ return clearTimeout(retryTimeoutRef.current);
31
+ }
32
+ }, [hasError]);
33
+
34
+ return retryCountRef.current;
35
+ };
36
+
8
37
  const ImageFileMessage = ({ message }: FileMessageProps) => {
9
38
  const { colors } = useUIKitTheme();
10
39
  const [imageNotFound, setImageNotFound] = useState(false);
@@ -12,18 +41,28 @@ const ImageFileMessage = ({ message }: FileMessageProps) => {
12
41
  const fileUrl = getAvailableUriFromFileMessage(message);
13
42
  const style = [styles.image, { backgroundColor: colors.onBackground04 }];
14
43
 
15
- if (imageNotFound) {
16
- return <Icon containerStyle={style} icon={'thumbnail-none'} size={48} color={colors.onBackground02} />;
17
- }
44
+ const key = useRetry(imageNotFound);
18
45
 
19
46
  return (
20
- <Image
21
- source={{ uri: fileUrl }}
22
- style={style}
23
- resizeMode={'cover'}
24
- resizeMethod={'resize'}
25
- onError={() => setImageNotFound(true)}
26
- />
47
+ <View style={style}>
48
+ <Image
49
+ key={key}
50
+ source={{ uri: fileUrl }}
51
+ style={[StyleSheet.absoluteFill, imageNotFound && styles.hide]}
52
+ resizeMode={'cover'}
53
+ resizeMethod={'resize'}
54
+ onError={() => setImageNotFound(true)}
55
+ onLoad={() => setImageNotFound(false)}
56
+ />
57
+ {imageNotFound && (
58
+ <Icon
59
+ containerStyle={StyleSheet.absoluteFill}
60
+ icon={'thumbnail-none'}
61
+ size={48}
62
+ color={colors.onBackground02}
63
+ />
64
+ )}
65
+ </View>
27
66
  );
28
67
  };
29
68
 
@@ -33,6 +72,10 @@ const styles = createStyleSheet({
33
72
  maxWidth: 240,
34
73
  height: 160,
35
74
  borderRadius: 16,
75
+ overflow: 'hidden',
76
+ },
77
+ hide: {
78
+ display: 'none',
36
79
  },
37
80
  });
38
81