stream-chat-expo 5.20.0-beta.4 → 5.20.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/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": "5.20.0-beta.4",
4
+ "version": "5.20.0",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -10,7 +10,7 @@
10
10
  "main": "src/index.js",
11
11
  "types": "types/index.d.ts",
12
12
  "dependencies": {
13
- "stream-chat-react-native-core": "5.20.0-beta.4"
13
+ "stream-chat-react-native-core": "5.20.0"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@react-native-community/netinfo": ">=6.0.0",
@@ -12,9 +12,16 @@ export const getPhotos = async ({
12
12
  first,
13
13
  }: MediaLibrary.AssetsOptions): Promise<ReturnType> => {
14
14
  try {
15
- const { status } = await MediaLibrary.requestPermissionsAsync();
15
+ // NOTE:
16
+ // should always check first before requesting permission
17
+ // because always requesting permission will cause
18
+ // the app to go to background even if it was granted
19
+ const { status } = await MediaLibrary.getPermissionsAsync();
16
20
  if (status !== 'granted') {
17
- throw new Error('getPhotos Error');
21
+ const { status: newStatus } = await MediaLibrary.requestPermissionsAsync();
22
+ if (newStatus !== 'granted') {
23
+ throw new Error('getPhotos Error');
24
+ }
18
25
  }
19
26
  const results = await MediaLibrary.getAssetsAsync({
20
27
  after,