Skip to content

Commit 1ad78ca

Browse files
Merge pull request #102 from GetStream/vishal/expo-36-support
Expo 36 support and some more stuff
2 parents 5084fc7 + 88425ce commit 1ad78ca

25 files changed

+1088
-683
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## [0.5.0] 2019-12-23
4+
5+
#### stream-chat-expo (Expo package)
6+
7+
- Changes to add compatibility for Expo 36. Adding [netinfo](https://github.com/react-native-community/react-native-netinfo) as peer dependency - https://github.com/GetStream/stream-chat-react-native/issues/97
8+
- Disabling the longpress on image viewer (in Attachment) - https://github.com/GetStream/stream-chat-react-native/issues/100 to avoid freezing of UI.
9+
- Fixing broken threads issue
10+
- Support for `additionalFlatListProps` prop in `MessageList` and `ChannelList` component
11+
- Changing proptype for component type props to `elementType` instead of `func`
12+
13+
#### stream-chat-react-native (Native package)
14+
15+
- Disabling the longpress on image viewer (in Attachment) - https://github.com/GetStream/stream-chat-react-native/issues/100 to avoid freezing of UI.
16+
- Fixing broken threads issue
17+
- Support for `additionalFlatListProps` prop in `MessageList` and `ChannelList` component
18+
- Changing proptype for component type props to `elementType` instead of `func`
19+
320
## [0.4.0] 2019-12-16
421

522
- Adding support for customizing markdown styles - https://github.com/GetStream/stream-chat-react-native/pull/99/files#diff-ede54911d9164ea37e65e92f2e18cb91R56

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.PHONY: example-build example-deps
33

44
EXAMPLES_PATH = examples
5-
EXAMPLES = one two
5+
EXAMPLES = ExpoMessaging NativeMessaging
66
EXAMPLES_APPS = $(addprefix $(EXAMPLES_PATH)/,$(EXAMPLES))
77
EXAMPLES_APPS_DEPS = $(addsuffix /node_modules/installed_dependencies,$(EXAMPLES_APPS))
88

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,20 @@ yarn global add expo-cli
103103
# * >=12.0.0 (Current Release)
104104
expo init StreamChatExpoExample
105105
cd StreamChatExpoExample
106+
107+
# Add chat expo package
106108
yarn add stream-chat-expo
109+
110+
# If you are using stream-chat-expo <= 0.4.0 and expo <= 34, then you don't need to add @react-native-community/netinfo as dependency. Since previously we used use NetInfo from react-native package.
111+
yarn add @react-native-community/netinfo
107112
```
108113

109-
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/one/App.js) to see usage of the components.
114+
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/ExpoMessaging/App.js) to see usage of the components.
110115

111-
OR you can swap [this file](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/one/App.js) for your `App.js` in the root folder with additional following steps:
116+
OR you can swap [this file](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/ExpoMessaging/App.js) for your `App.js` in the root folder with additional following steps:
112117

113118
```bash
114-
yarn add react-navigation
119+
yarn add react-navigation@3.2.1 react-native-gesture-handler react-native-reanimated
115120
```
116121

117122
and finally
@@ -146,7 +151,7 @@ react-native link react-native-document-picker
146151

147152
```
148153

149-
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/two/App.js) to see usage of components.
154+
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/NativeMessaging/App.js) to see usage of components.
150155

151156
OR you can swap this file for your `App.js` in root folder with additional following steps:
152157

@@ -184,7 +189,7 @@ Just to be sure, please verify you are using appropriate version of following pa
184189

185190
- react-native-image-picker : https://github.com/react-native-community/react-native-image-picker#react-native-compatibility
186191

187-
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/two/App.js) to see usage of components.
192+
Please check [Example](https://github.com/GetStream/stream-chat-react-native/blob/master/examples/NativeMessaging/App.js) to see usage of components.
188193

189194
OR you can swap this file for your `App.js` in root folder with additional following steps:
190195

@@ -248,7 +253,7 @@ In current context, dependencies such as `react-native-document-picker` and (if
248253
1. When you execute `react-native run-ios` for the first time, it starts a metro bundler in parallel. It can result into some errors, since build process isn't complete yet. Try the following to fix this:
249254
1. Close/stop the metro bundler process.
250255
2. Let the build process finish completely, it can take usually around 2-3 minutes for the first time.
251-
3. Start the metro bundler manually by executing `yarn start` inside `stream-chat-react-native/examples/two` directory.
256+
3. Start the metro bundler manually by executing `yarn start` inside `stream-chat-react-native/examples/NativeMessaging` directory.
252257
2. When you execute `react-native run-android`, you may (not necessarily) run into following error:
253258
254259
```ERROR
@@ -277,9 +282,9 @@ In current context, dependencies such as `react-native-document-picker` and (if
277282

278283
To resolve this, do the following
279284

280-
1. Craete a file named `local.properties` inside `stream-chat-react-native/examples/two/android` directory
285+
1. Craete a file named `local.properties` inside `stream-chat-react-native/examples/NativeMessaging/android` directory
281286
2. Put the this line in that file. Make sure sdk path is correctly mentioned as per your system:
282287
```
283288
sdk.dir=/Users/{user_name}/Library/Android/sdk/
284289
```
285-
3. Rerun `react-native run-android` in `stream-chat-react-native/examples/two` directory
290+
3. Rerun `react-native run-android` in `stream-chat-react-native/examples/NativeMessaging` directory

examples/ExpoMessaging/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const theme = {
4040
`,
4141
},
4242
};
43-
43+
4444

4545
const filters = { type: 'messaging' };
4646
const sort = { last_message_at: -1 };

expo-package/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"stream-chat-react-native-core": "v0.4.0"
6464
},
6565
"peerDependencies": {
66-
"expo": "^32.0.0"
66+
"expo": "^32.0.0",
67+
"@react-native-community/netinfo": ">=2.0.7"
6768
}
6869
}

expo-package/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const normalBundle = {
4040
'expo-document-picker',
4141
'expo-permissions',
4242
'react-native-unimodules',
43+
'@react-native-community/netinfo',
4344
],
4445
plugins: [
4546
replace({

expo-package/src/index.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* And they have been removed from Expo package. But these packages don't work with Expo 32 sdk (because of linking issue).
44
*/
55
import { registerNativeHandlers } from 'stream-chat-react-native-core';
6-
import { NetInfo } from 'react-native';
6+
import NetInfo from '@react-native-community/netinfo';
77
import { Constants } from 'react-native-unimodules';
88
import * as Expo from 'expo';
99

@@ -30,18 +30,38 @@ if (manifest.sdkVersion.split('.')[0] >= 33) {
3030
registerNativeHandlers({
3131
NetInfo: {
3232
addEventListener(listener) {
33-
const unsubscribe = NetInfo.addEventListener('connectionChange', () => {
34-
NetInfo.isConnected.fetch().then((isConnected) => {
33+
let unsubscribe;
34+
// For NetInfo >= 3.x.x
35+
if (NetInfo.fetch && typeof NetInfo.fetch === 'function') {
36+
unsubscribe = NetInfo.addEventListener(({ isConnected }) => {
3537
listener(isConnected);
3638
});
37-
});
38-
return unsubscribe.remove;
39+
return unsubscribe;
40+
} else {
41+
// For NetInfo < 3.x.x
42+
unsubscribe = NetInfo.addEventListener('connectionChange', () => {
43+
NetInfo.isConnected.fetch().then((isConnected) => {
44+
listener(isConnected);
45+
});
46+
});
47+
48+
return unsubscribe.remove;
49+
}
3950
},
51+
4052
fetch() {
4153
return new Promise((resolve, reject) => {
42-
NetInfo.isConnected.fetch().then((isConnected) => {
43-
resolve(isConnected);
44-
}, reject);
54+
// For NetInfo >= 3.x.x
55+
if (NetInfo.fetch && typeof NetInfo.fetch === 'function') {
56+
NetInfo.fetch().then(({ isConnected }) => {
57+
resolve(isConnected);
58+
}, reject);
59+
} else {
60+
// For NetInfo < 3.x.x
61+
NetInfo.isConnected.fetch().then((isConnected) => {
62+
resolve(isConnected);
63+
}, reject);
64+
}
4565
});
4666
},
4767
},

0 commit comments

Comments
 (0)