Skip to content

Commit

Permalink
fix: add Flatlist mvcp as optional package and peer deps versions (#2720
Browse files Browse the repository at this point in the history
)

* fix: add Flatlist mvcp as optional package and peer deps versions

* fix: add Flatlist mvcp as optional package and peer deps versions

* docs: fix native handler docs

* docs: fix vale issues

* docs: remove native handler docs

* fix: lint issues
  • Loading branch information
khushal87 authored Oct 24, 2024
1 parent f087ee5 commit ac8157f
Show file tree
Hide file tree
Showing 19 changed files with 303 additions and 2,019 deletions.
22 changes: 7 additions & 15 deletions docusaurus/docs/reactnative/basics/migrating-from-5.x-to-6.x.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Migration from 5.x to 6.x
---

:::note
v6.0 is supported on React native version **0.72** and above.
If you are using new architecture or the new FlatList with [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition) feat, v6.0 would require you to be in React native version **0.72** and above.
:::

## Dependency changes
Expand Down Expand Up @@ -57,26 +57,18 @@ yarn remove react-native-quick-sqlite
yarn add op-sqlite
```

#### Remove the usage of `@stream-io/flat-list-mvcp`
#### Made `@stream-io/flat-list-mvcp` optional

The dependency on `@stream-io/flat-list-mvcp` package has been removed in favour of React Native's [`FlatList`](https://reactnative.dev/docs/flatlist) component supporting [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition) from React Native version `>=0.72`. You can replace it by using the `FlatList` component directly.
The dependency on `@stream-io/flat-list-mvcp` package has been made optional in favour of React Native's [`FlatList`](https://reactnative.dev/docs/flatlist) component supporting [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition) from React Native version `>=0.72`. If the package is installed it takes up the package or the default React Native [`FlatList`](https://reactnative.dev/docs/flatlist).

:::info
If you are on or above version **0.72** of React Native, please remove it.

```bash
yarn remove @stream-io/flat-list-mvcp
```

```tsx
// removed-line
import { FlatList } from '@stream-io/flat-list-mvcp';
import { registerNativeHandlers } from 'stream-chat-react-native';

registerNativeHandlers({
// removed-line
FlatList: FlatList,
});
```

This also involves not passing the `FlatList` component as a handler to [`registerNativeHandlers`](../customization/native-handlers.mdx#overriding-handlers) anymore.
:::

## SDK changes

Expand Down
4 changes: 0 additions & 4 deletions docusaurus/docs/reactnative/guides/custom-message-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,6 @@ Please note that these intercepts will neither change the standard functions nor
:::
- `handleBan`
<<<<<<< HEAD
=======
- `handleBlock`(deprecated)
> > > > > > > 50d6467ce4ff02ba01398b858985547a0b490beb
- `handleCopy`
- `handleDelete`
- `handleEdit`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is coming up soon.
2 changes: 1 addition & 1 deletion examples/SampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1626,4 +1626,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 35eaf6ce44604be195e8eb15532275b5a777ac32

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
6 changes: 6 additions & 0 deletions examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,9 @@
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -844,6 +847,9 @@
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
10 changes: 5 additions & 5 deletions examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ PODS:
- React-Core
- RNCClipboard (1.13.2):
- React-Core
- RNGestureHandler (2.15.0):
- RNGestureHandler (2.20.1):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand All @@ -1160,7 +1160,7 @@ PODS:
- React-RCTImage
- RNShare (10.2.1):
- React-Core
- RNSVG (15.6.0):
- RNSVG (15.8.0):
- React-Core
- SocketRocket (0.6.1)
- Yoga (1.14.0)
Expand Down Expand Up @@ -1473,15 +1473,15 @@ SPEC CHECKSUMS:
ReactCommon: 3dc453f427d2f3d7f2c71499d191b456f83c59bd
RNAudioRecorderPlayer: f790fc1afb118552ae6285d60adde52ee6b5d9ef
RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d
RNGestureHandler: 67fb54b3e6ca338a8044e85cd6f340265aa41091
RNGestureHandler: 7ff7793b53454ed4a2faf52fb3fcd7804d0b494c
RNReactNativeHapticFeedback: ec56a5f81c3941206fd85625fa669ffc7b4545f9
RNReanimated: 15a855719335a6b655a214531e86d806edfd49da
RNScreens: e842cdccb23c0a084bd6307f6fa83fd1c1738029
RNShare: 0fad69ae2d71de9d1f7b9a43acf876886a6cb99c
RNSVG: 5da7a24f31968ec74f0b091e3440080f347e279b
RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 57d2ffe418d024d56f8b0047f335c677e4c4d9ac

PODFILE CHECKSUM: 90406e1e85c82b37484f5d746afa45c0637bb4b3

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
75 changes: 44 additions & 31 deletions examples/TypeScriptMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3628,13 +3628,13 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b"
integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==

d@1, d@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a"
integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==
d@1, d@^1.0.1, d@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/d/-/d-1.0.2.tgz#2aefd554b81981e7dccf72d6842ae725cb17e5de"
integrity sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==
dependencies:
es5-ext "^0.10.50"
type "^1.0.1"
es5-ext "^0.10.64"
type "^2.7.2"

[email protected]:
version "1.10.5"
Expand Down Expand Up @@ -3944,13 +3944,14 @@ es-to-primitive@^1.2.1:
is-date-object "^1.0.1"
is-symbol "^1.0.2"

es5-ext@^0.10.35, es5-ext@^0.10.50:
version "0.10.62"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5"
integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==
es5-ext@^0.10.35, es5-ext@^0.10.62, es5-ext@^0.10.64, es5-ext@~0.10.14:
version "0.10.64"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714"
integrity sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==
dependencies:
es6-iterator "^2.0.3"
es6-symbol "^3.1.3"
esniff "^2.0.1"
next-tick "^1.1.0"

es6-iterator@^2.0.3:
Expand All @@ -3963,12 +3964,12 @@ es6-iterator@^2.0.3:
es6-symbol "^3.1.1"

es6-symbol@^3.1.1, es6-symbol@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18"
integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==
version "3.1.4"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.4.tgz#f4e7d28013770b4208ecbf3e0bf14d3bcb557b8c"
integrity sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==
dependencies:
d "^1.0.1"
ext "^1.1.2"
d "^1.0.2"
ext "^1.7.0"

escalade@^3.1.1:
version "3.1.1"
Expand Down Expand Up @@ -4144,6 +4145,16 @@ eslint@^8.19.0:
strip-ansi "^6.0.1"
text-table "^0.2.0"

esniff@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308"
integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==
dependencies:
d "^1.0.1"
es5-ext "^0.10.62"
event-emitter "^0.3.5"
type "^2.7.2"

espree@^9.6.0, espree@^9.6.1:
version "9.6.1"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"
Expand Down Expand Up @@ -4192,6 +4203,14 @@ etag@~1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==

event-emitter@^0.3.5:
version "0.3.5"
resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39"
integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==
dependencies:
d "1"
es5-ext "~0.10.14"

event-target-shim@^5.0.0, event-target-shim@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
Expand Down Expand Up @@ -4228,7 +4247,7 @@ expect@^29.7.0:
jest-message-util "^29.7.0"
jest-util "^29.7.0"

ext@^1.1.2:
ext@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f"
integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==
Expand Down Expand Up @@ -6571,14 +6590,13 @@ react-native-document-picker@^9.3.0:
invariant "^2.2.4"

react-native-gesture-handler@^2.14.0:
version "2.15.0"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.15.0.tgz#f8e6c0451a7bdf065edb7b9be605480db402baa0"
integrity sha512-cmMGW8k86o/xgVTBZZOPohvR5re4Vh65PUxH4HbBBJAYTog4aN4wTVTUlnoky01HuSN8/X4h3tI/K3XLPoDnsg==
version "2.20.1"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.20.1.tgz#04743f7064d6ad7d0f66ec0d71c35eeee8c89a97"
integrity sha512-Oqq5A606F6iV1eQ3FExEH6V4zE2uatNdrwQU1qMy7szHgm0SewQexeyLY3Zaaeo7luOknVq2xvZjNN/LvULGPw==
dependencies:
"@egjs/hammerjs" "^2.0.17"
hoist-non-react-statics "^3.3.0"
invariant "^2.2.4"
lodash "^4.17.21"
prop-types "^15.7.2"

react-native-haptic-feedback@^2.2.0:
Expand Down Expand Up @@ -6636,9 +6654,9 @@ react-native-share@^10.2.1:
integrity sha512-Z2LWGYWH7raM4H6Oauttv1tEhaB43XSWJAN8iS6oaSG9CnyrUBeYFF4QpU1AH5RgNeylXQdN8CtbizCHHt6coQ==

react-native-svg@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-15.6.0.tgz#13b2af53b1701597df301122b869b61918e1e9a5"
integrity sha512-TUtR+h+yi1ODsd8FHdom1TpjfWOmnaK5pri5rnSBXnMqpzq8o2zZfonHTjPX+nS3wb/Pu2XsoARgYaHNjVWXhQ==
version "15.8.0"
resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-15.8.0.tgz#9b5fd4f5cf5675197b3f4cbfcc77c215de2b9502"
integrity sha512-KHJzKpgOjwj1qeZzsBjxNdoIgv2zNCO9fVcoq2TEhTRsVV5DGTZ9JzUZwybd7q4giT/H3RdtqC3u44dWdO0Ffw==
dependencies:
css-select "^5.1.0"
css-tree "^1.1.3"
Expand Down Expand Up @@ -7540,15 +7558,10 @@ type-fest@^0.7.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48"
integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==

type@^1.0.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0"
integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==

type@^2.7.2:
version "2.7.2"
resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0"
integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==
version "2.7.3"
resolved "https://registry.yarnpkg.com/type/-/type-2.7.3.tgz#436981652129285cc3ba94f392886c2637ea0486"
integrity sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==

typed-array-length@^1.0.4:
version "1.0.4"
Expand Down
2 changes: 1 addition & 1 deletion package/expo-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"stream-chat-react-native-core": "5.39.4"
},
"peerDependencies": {
"expo": "^51.0.0",
"expo": ">=51.0.0",
"expo-av": "*",
"expo-clipboard": "*",
"expo-document-picker": "*",
Expand Down
3 changes: 2 additions & 1 deletion package/jest-setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global require */
import { View } from 'react-native';
import { FlatList, View } from 'react-native';

import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock.js';

Expand All @@ -18,6 +18,7 @@ registerNativeHandlers({
},
compressImage: () => null,
deleteFile: () => null,
FlatList,
getLocalAssetUri: () => null,
getPhotos: () => null,
oniOS14GalleryLibrarySelectionChange: () => ({
Expand Down
8 changes: 6 additions & 2 deletions package/native-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"@bam.tech/react-native-image-resizer": ">=3.0.10",
"@react-native-camera-roll/camera-roll": ">=7.8.0",
"@react-native-clipboard/clipboard": ">=1.14.1",
"react-native": ">=0.73.6",
"@stream-io/flat-list-mvcp": ">=0.10.3",
"react-native": ">=0.67.0",
"react-native-audio-recorder-player": ">=3.6.4",
"react-native-blob-util": ">=0.19.9",
"react-native-document-picker": ">=9.3.0",
Expand All @@ -33,6 +34,9 @@
"@react-native-clipboard/clipboard": {
"optional": true
},
"@stream-io/flat-list-mvcp": {
"optional": true
},
"react-native-share": {
"optional": true
},
Expand Down Expand Up @@ -61,6 +65,6 @@
},
"devDependencies": {
"@bam.tech/react-native-image-resizer": ">=3.0.10",
"react-native": ">=0.73.6"
"react-native": ">=0.67.0"
}
}
2 changes: 2 additions & 0 deletions package/native-package/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { compressImage } from './handlers';
import {
Audio,
deleteFile,
FlatList,
getLocalAssetUri,
getPhotos,
iOS14RefreshGallerySelection,
Expand All @@ -26,6 +27,7 @@ registerNativeHandlers({
Audio,
compressImage,
deleteFile,
FlatList,
getLocalAssetUri,
getPhotos,
iOS14RefreshGallerySelection,
Expand Down
7 changes: 7 additions & 0 deletions package/native-package/src/optionalDependencies/FlatList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let FlatList;

try {
FlatList = require('@stream-io/flat-list-mvcp').FlatList;
} catch (e) {
console.log("@stream-io/flat-list-mvcp not found, using react-native's FlatList");
}
1 change: 1 addition & 0 deletions package/native-package/src/optionalDependencies/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './Audio';
export * from './deleteFile';
export * from './FlatList';
export * from './getLocalAssetUri';
export * from './getPhotos';
export * from './iOS14RefreshGallerySelection';
Expand Down
Loading

0 comments on commit ac8157f

Please sign in to comment.