stream-chat-expo 4.0.1-next.1 → 4.1.1-beta.1

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 (3) hide show
  1. package/README.md +1 -13
  2. package/package.json +2 -3
  3. package/src/index.js +32 -9
package/README.md CHANGED
@@ -31,18 +31,6 @@
31
31
  - [Keep in mind](#-keep-in-mind)
32
32
  - [Contributing](#-contributing)
33
33
 
34
- ## 🔐 React Native Compatibility
35
-
36
- To use this library you need to ensure you match up with the correct version of React Native you are using.
37
-
38
- | `stream-chat-react-native` version | React Native Version | `stream-chat` Version |
39
- | ---------------------------------- | --------------------- | --------------------- |
40
- | `3.2.0` | `>= 0.60` | `>= 3.5.1` |
41
- | `3.0.0` | `>= 0.60` | `>= 3.0.0` |
42
- | `2.x.x` | `>= 0.60` | `< 3.0.0` |
43
- | `1.x.x` | `>= 0.59` | `< 3.0.0` |
44
- | `0.x.x` | `*` | `< 3.0.0` |
45
-
46
34
  ## 📖 React Native Chat Tutorial
47
35
 
48
36
  The best place to start is the [React Native Chat Tutorial](https://github.com/GetStream/stream-chat-react-native/wiki/Tutorial-v3.0). It teaches you how to use this SDK and also shows how to make frequently required changes.
@@ -58,7 +46,7 @@ This repo includes 4 example apps. One made with Expo, one Native JavaScript cod
58
46
 
59
47
  - [Expo example](./examples/ExpoMessaging)
60
48
  - [Native example](./examples/NativeMessaging)
61
- - [Typescript example](./examples/TypescriptMessaging)
49
+ - [Typescript example](./examples/TypeScriptMessaging)
62
50
  - [Fully featured messaging application](./examples/SampleApp)
63
51
 
64
52
  Besides, our team maintains a dedicated repository for fully-fledged sample applications and demos at [GetStream/react-native-samples](https://github.com/GetStream/react-native-samples). Please consider checking following sample applications:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-expo",
3
3
  "description": "The official Expo SDK for Stream Chat, a service for building chat applications",
4
- "version": "4.0.1-next.1",
4
+ "version": "4.1.1-beta.1",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -10,12 +10,11 @@
10
10
  "main": "src/index.js",
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
- "stream-chat-react-native-core": "4.0.1-next.1"
13
+ "stream-chat-react-native-core": "4.1.1-beta.1"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": "^6.0.0",
17
17
  "expo": "^41.0.1",
18
- "expo-blur": "^9.0.3",
19
18
  "expo-document-picker": "^9.1.2",
20
19
  "expo-file-system": "^11.0.2",
21
20
  "expo-haptics": "^10.0.0",
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { FlatList } from 'react-native';
2
+ import { FlatList, Image, Platform } from 'react-native';
3
+
3
4
  import NetInfo from '@react-native-community/netinfo';
4
- import { BlurView as ExpoBlurView } from 'expo-blur';
5
5
  import * as DocumentPicker from 'expo-document-picker';
6
6
  import * as FileSystem from 'expo-file-system';
7
7
  import * as Haptics from 'expo-haptics';
@@ -12,10 +12,6 @@ import * as Sharing from 'expo-sharing';
12
12
  import { registerNativeHandlers } from 'stream-chat-react-native-core';
13
13
 
14
14
  registerNativeHandlers({
15
- // eslint-disable-next-line react/display-name
16
- BlurView: ({ blurAmount = 100, blurType = 'dark', style }) => (
17
- <ExpoBlurView intensity={blurAmount} style={style} tint={blurType} />
18
- ),
19
15
  compressImage: async ({ compressImageQuality = 1, uri }) => {
20
16
  const { uri: compressedUri } = await ImageManipulator.manipulateAsync(uri, [], {
21
17
  compress: Math.min(Math.max(0, compressImageQuality), 1),
@@ -123,7 +119,7 @@ registerNativeHandlers({
123
119
  },
124
120
  saveFile: async ({ fileName, fromUrl }) => {
125
121
  try {
126
- const path = FileSystem.documentDirectory + fileName;
122
+ const path = FileSystem.cacheDirectory + encodeURIComponent(fileName);
127
123
  const downloadedImage = await FileSystem.downloadAsync(fromUrl, path);
128
124
  return downloadedImage.uri;
129
125
  } catch (error) {
@@ -152,12 +148,39 @@ registerNativeHandlers({
152
148
  quality: Math.min(Math.max(0, compressImageQuality), 1),
153
149
  });
154
150
  if (photo.height && photo.width && photo.uri) {
151
+ let size = {};
152
+ if (Platform.OS === 'android') {
153
+ // Height and width returned by ImagePicker are incorrect on Android.
154
+ // The issue is described in following github issue:
155
+ // https://github.com/ivpusic/react-native-image-crop-picker/issues/901
156
+ // This we can't rely on them as it is, and we need to use Image.getSize
157
+ // to get accurate size.
158
+ const getSize = () => new Promise((resolve) => {
159
+ Image.getSize(photo.uri, (width, height) => {
160
+ resolve({height, width});
161
+ });
162
+ });
163
+
164
+ try {
165
+ const { height, width } = await getSize();
166
+ size.height = height;
167
+ size.width = width;
168
+ } catch (e) {
169
+ // do nothing
170
+ console.warning('Error get image size of picture caputred from camera ', e);
171
+ }
172
+ } else {
173
+ size = {
174
+ height: photo.height,
175
+ width: photo.width,
176
+ };
177
+ }
178
+
155
179
  return {
156
180
  cancelled: false,
157
- height: photo.height,
158
181
  source: 'camera',
159
182
  uri: photo.uri,
160
- width: photo.width,
183
+ ...size
161
184
  };
162
185
  }
163
186
  }