stream-chat-react-native 6.0.0-rc.8 → 6.0.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.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
11
11
  [![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
12
12
  [![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
13
- ![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-451%20KB-blue)
13
+ ![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-453%20KB-blue)
14
14
 
15
15
  <img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
16
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native",
3
3
  "description": "The official React Native SDK for Stream Chat, a service for building chat applications",
4
- "version": "6.0.0-rc.8",
4
+ "version": "6.0.0",
5
5
  "homepage": "https://www.npmjs.com/package/stream-chat-react-native",
6
6
  "author": {
7
7
  "company": "Stream.io Inc",
@@ -20,7 +20,7 @@
20
20
  "types": "types/index.d.ts",
21
21
  "dependencies": {
22
22
  "es6-symbol": "^3.1.3",
23
- "stream-chat-react-native-core": "6.0.0-rc.8"
23
+ "stream-chat-react-native-core": "6.0.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@react-native-camera-roll/camera-roll": ">=7.8.0",
@@ -1,3 +1,5 @@
1
+ import { Platform } from 'react-native';
2
+
1
3
  let CameraRollDependency;
2
4
 
3
5
  try {
@@ -12,8 +14,11 @@ try {
12
14
  export const getLocalAssetUri = CameraRollDependency
13
15
  ? async (remoteUri: string) => {
14
16
  try {
15
- const localUri = await CameraRollDependency.CameraRoll.save(remoteUri);
16
- return localUri;
17
+ if (Platform.OS === 'ios') {
18
+ const imageData = await CameraRollDependency.CameraRoll.iosGetImageDataById(remoteUri);
19
+ return imageData?.node?.image?.filepath;
20
+ }
21
+ return remoteUri;
17
22
  } catch {
18
23
  throw new Error('getLocalAssetUri Error');
19
24
  }
@@ -13,6 +13,8 @@ try {
13
13
 
14
14
  import type { Asset } from 'stream-chat-react-native-core';
15
15
 
16
+ import { getLocalAssetUri } from './getLocalAssetUri';
17
+
16
18
  type ReturnType = {
17
19
  assets: Array<Omit<Asset, 'source'> & { source: 'picker' }>;
18
20
  endCursor: string | undefined;
@@ -82,15 +84,23 @@ export const getPhotos = CameraRollDependency
82
84
  first,
83
85
  include: ['fileSize', 'filename', 'imageSize', 'playableDuration'],
84
86
  });
85
- const assets = results.edges.map((edge) => ({
86
- ...edge.node.image,
87
- duration: edge.node.image.playableDuration * 1000,
88
- // since we include filename, fileSize in the query, we can safely assume it will be defined
89
- name: edge.node.image.filename as string,
90
- size: edge.node.image.fileSize as number,
91
- source: 'picker' as const,
92
- type: edge.node.type,
93
- }));
87
+ const assets = await Promise.all(
88
+ results.edges.map(async (edge) => {
89
+ const originalUri = edge.node?.image?.uri;
90
+ const uri = getLocalAssetUri ? await getLocalAssetUri(originalUri) : originalUri;
91
+ return {
92
+ ...edge.node.image,
93
+ duration: edge.node.image.playableDuration * 1000,
94
+ // since we include filename, fileSize in the query, we can safely assume it will be defined
95
+ name: edge.node.image.filename as string,
96
+ originalUri,
97
+ size: edge.node.image.fileSize as number,
98
+ source: 'picker' as const,
99
+ type: edge.node.type,
100
+ uri,
101
+ };
102
+ }),
103
+ );
94
104
  const hasNextPage = results.page_info.has_next_page;
95
105
  const endCursor = results.page_info.end_cursor;
96
106
  return { assets, endCursor, hasNextPage, iOSLimited: !!results.limited };
@@ -35,6 +35,7 @@ export const pickImage = ImagePicker
35
35
  }
36
36
  } catch (error) {
37
37
  console.log('Error picking image: ', error);
38
+ return { cancelled: true };
38
39
  }
39
40
  }
40
41
  : null;