stream-chat-expo 3.10.2-next.1 → 4.0.0-beta.3

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 (2) hide show
  1. package/package.json +2 -3
  2. package/src/index.js +31 -8
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": "3.10.2-next.1",
4
+ "version": "4.0.0-beta.3",
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": "3.10.2-next.1"
13
+ "stream-chat-react-native-core": "4.0.0-beta.3"
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),
@@ -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
  }