diff --git a/README.md b/README.md index b42278100f..8a31481367 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native) [![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions) [![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative) -![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-291%20KB-blue) +![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-292%20KB-blue) diff --git a/examples/SampleApp/package.json b/examples/SampleApp/package.json index 3f71a2523a..cd15171e5e 100644 --- a/examples/SampleApp/package.json +++ b/examples/SampleApp/package.json @@ -63,7 +63,7 @@ "devDependencies": { "@babel/core": "^7.27.4", "@babel/runtime": "^7.27.6", - "@react-native-community/cli": "19.1.1", + "@react-native-community/cli": "19.1.2", "@react-native-community/cli-platform-android": "19.1.1", "@react-native-community/cli-platform-ios": "19.1.1", "@react-native/babel-preset": "0.80.2", diff --git a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx index 4e7c9a925f..911353cd9a 100644 --- a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx +++ b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { FlatList, Keyboard, SafeAreaView, StyleSheet, Text, View, ViewStyle } from 'react-native'; +import { FlatList, Keyboard, StyleSheet, Text, View, ViewStyle } from 'react-native'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; import { Gesture, GestureDetector, Pressable } from 'react-native-gesture-handler'; @@ -30,6 +30,7 @@ import { useChannelInfoOverlayContext } from '../context/ChannelInfoOverlayConte import { Archive } from '../icons/Archive'; import { Pin } from '../icons/Pin'; import { useChannelInfoOverlayActions } from '../hooks/useChannelInfoOverlayActions'; +import { SafeAreaView } from 'react-native-safe-area-context'; dayjs.extend(relativeTime); @@ -274,7 +275,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => { - + {channel && ( <> diff --git a/examples/SampleApp/src/components/MenuDrawer.tsx b/examples/SampleApp/src/components/MenuDrawer.tsx index ab27232a1a..940e9fa7bf 100644 --- a/examples/SampleApp/src/components/MenuDrawer.tsx +++ b/examples/SampleApp/src/components/MenuDrawer.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import { Image, - SafeAreaView, StyleSheet, Text, TouchableOpacity, @@ -14,6 +13,7 @@ import { useAppContext } from '../context/AppContext'; import { SecretMenu } from './SecretMenu.tsx'; import type { DrawerContentComponentProps } from '@react-navigation/drawer'; +import { SafeAreaView } from 'react-native-safe-area-context'; export const styles = StyleSheet.create({ avatar: { diff --git a/examples/SampleApp/src/components/UserInfoOverlay.tsx b/examples/SampleApp/src/components/UserInfoOverlay.tsx index 950407471e..1d487b8abb 100644 --- a/examples/SampleApp/src/components/UserInfoOverlay.tsx +++ b/examples/SampleApp/src/components/UserInfoOverlay.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { Keyboard, SafeAreaView, StyleSheet, Text, View, ViewStyle } from 'react-native'; +import { Keyboard, StyleSheet, Text, View, ViewStyle } from 'react-native'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; import { Gesture, GestureDetector, Pressable } from 'react-native-gesture-handler'; @@ -31,6 +31,7 @@ import { useUserInfoOverlayContext } from '../context/UserInfoOverlayContext'; import { useAppContext } from '../context/AppContext'; import { UserResponse } from 'stream-chat'; import { useUserInfoOverlayActions } from '../hooks/useUserInfoOverlayActions'; +import { SafeAreaView } from 'react-native-safe-area-context'; dayjs.extend(relativeTime); @@ -255,7 +256,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => { - + {channel && ( <> diff --git a/examples/SampleApp/src/screens/OneOnOneChannelDetailScreen.tsx b/examples/SampleApp/src/screens/OneOnOneChannelDetailScreen.tsx index 2ac1be0d2a..d492bc795b 100644 --- a/examples/SampleApp/src/screens/OneOnOneChannelDetailScreen.tsx +++ b/examples/SampleApp/src/screens/OneOnOneChannelDetailScreen.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import { Image, - SafeAreaView, ScrollView, StyleSheet, Switch, @@ -28,6 +27,7 @@ import type { RouteProp } from '@react-navigation/native'; import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; import type { StackNavigatorParamList } from '../types'; +import { SafeAreaView } from 'react-native-safe-area-context'; const styles = StyleSheet.create({ actionContainer: { diff --git a/examples/SampleApp/yarn.lock b/examples/SampleApp/yarn.lock index 10b8d177e4..ee947e320f 100644 --- a/examples/SampleApp/yarn.lock +++ b/examples/SampleApp/yarn.lock @@ -2163,12 +2163,12 @@ resolved "https://registry.yarnpkg.com/@react-native-camera-roll/camera-roll/-/camera-roll-7.10.0.tgz#5e9518d78a9cd87ddc8e68d03e31a608df5033ab" integrity sha512-Zm1yHxxTQS2APsnnxUFoLnK+DMMTPqmIQ2z2pGtNyHRXAG40Nt4MLVB3tDJTWnuJLAG87BpTCEvpz49+u0YkUw== -"@react-native-community/cli-clean@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-19.1.1.tgz#574ada0956ac506431a84e45b5fa36f22b9a510d" - integrity sha512-pP7SmK+PNw5B1Aa2c6y06FBNc9iGah/leFFM2uewpyZRJQ4zycX6Zz1UANpq9YZfp65n7NZKV9Gct2uaVRuP/Q== +"@react-native-community/cli-clean@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-19.1.2.tgz#10be56a6ab966c141090176e54937cb7b7618a9b" + integrity sha512-LI/bTLtosbDyHtIs+HxlmHp+5Nbjz+IIEEqrBO2tUeA+ENX01YEnIgGIv4z7giNWkHSiqywjdOyYNqg27ydy2g== dependencies: - "@react-native-community/cli-tools" "19.1.1" + "@react-native-community/cli-tools" "19.1.2" chalk "^4.1.2" execa "^5.0.0" fast-glob "^3.3.2" @@ -2183,6 +2183,16 @@ fast-glob "^3.3.2" fast-xml-parser "^4.4.1" +"@react-native-community/cli-config-android@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-config-android/-/cli-config-android-19.1.2.tgz#f8a03a0a49cd89a4e6bffed46396b3a2ea7690df" + integrity sha512-IIhzhDUmT53RT45Qrxc/OfvkTD4U7IrfkfoIdKmBT6O0X0QaoegK4OE6aAuc86D2GXlD5rbVcPMSuN4TY8Hmlw== + dependencies: + "@react-native-community/cli-tools" "19.1.2" + chalk "^4.1.2" + fast-glob "^3.3.2" + fast-xml-parser "^4.4.1" + "@react-native-community/cli-config-apple@19.1.1": version "19.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-config-apple/-/cli-config-apple-19.1.1.tgz#f805588235f1504546ab26dfeb708e20d4e144b0" @@ -2193,28 +2203,38 @@ execa "^5.0.0" fast-glob "^3.3.2" -"@react-native-community/cli-config@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-19.1.1.tgz#566fab3438a8d90ec8976927b7030f3a1f1d3d8a" - integrity sha512-qGLYCFf3whCa/we3iKd5BY4RlcAUhSykwGpnJpjseXLaI5iJzIn/IMd70EBG8QvhV/KQxM7VFMQj6KgGcoNKYg== +"@react-native-community/cli-config-apple@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-config-apple/-/cli-config-apple-19.1.2.tgz#d251fc18043f2e202d681a8ac911b8b1688409f4" + integrity sha512-91upuYMLgEtJE6foWQFgGDpT3ZDTc5bX6rMY5cJMqiAE5svgh1q0kbbpRuv/ptBYzcxLplL7wZWpA77TlJdm9A== dependencies: - "@react-native-community/cli-tools" "19.1.1" + "@react-native-community/cli-tools" "19.1.2" + chalk "^4.1.2" + execa "^5.0.0" + fast-glob "^3.3.2" + +"@react-native-community/cli-config@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-19.1.2.tgz#d6432c3100d2a7cb1e92d47b39bf3688fd712970" + integrity sha512-o0cc6R6r9nY9MiLFeLIN797fBLWwKW9cee/NCm6nBBzPk/paro6HEbcXE02xnVzMb+nhQPrbPOzp3qE7WhtwRA== + dependencies: + "@react-native-community/cli-tools" "19.1.2" chalk "^4.1.2" cosmiconfig "^9.0.0" deepmerge "^4.3.0" fast-glob "^3.3.2" joi "^17.2.1" -"@react-native-community/cli-doctor@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-19.1.1.tgz#e09749815f0baea17e4fc04b9897051829149f42" - integrity sha512-P6JgTpa8fn6SfGiotyRhiCqBlRlKx8MUUdMESPGyPzvMb8omz+Jv0ibdNg9CVT11/0x5oRsoGv07os/o+Eg0zQ== +"@react-native-community/cli-doctor@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-19.1.2.tgz#b318d000a12d029d65f829aba5e6f14f5c6132b8" + integrity sha512-uUV/1QrWA1Cx7dqkTCcarqfya/7gBmKXd9BzVCEl6bzAn1jd1Q5UaZ+DmZgAoLVKlbAjpPTJTfqjD44aqUdjyA== dependencies: - "@react-native-community/cli-config" "19.1.1" - "@react-native-community/cli-platform-android" "19.1.1" - "@react-native-community/cli-platform-apple" "19.1.1" - "@react-native-community/cli-platform-ios" "19.1.1" - "@react-native-community/cli-tools" "19.1.1" + "@react-native-community/cli-config" "19.1.2" + "@react-native-community/cli-platform-android" "19.1.2" + "@react-native-community/cli-platform-apple" "19.1.2" + "@react-native-community/cli-platform-ios" "19.1.2" + "@react-native-community/cli-tools" "19.1.2" chalk "^4.1.2" command-exists "^1.2.8" deepmerge "^4.3.0" @@ -2237,6 +2257,17 @@ execa "^5.0.0" logkitty "^0.7.1" +"@react-native-community/cli-platform-android@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-19.1.2.tgz#72d3dd69730a18373c4185f1f17e65c49fbc2b39" + integrity sha512-eMryTlSSTl3JK/tZTaMaMgHec9qu+eQj+3A15qmBdj2ac3p/hiauwAe4q35rz5XABw1cJCuyn+s469YsdTllaw== + dependencies: + "@react-native-community/cli-config-android" "19.1.2" + "@react-native-community/cli-tools" "19.1.2" + chalk "^4.1.2" + execa "^5.0.0" + logkitty "^0.7.1" + "@react-native-community/cli-platform-apple@19.1.1": version "19.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-apple/-/cli-platform-apple-19.1.1.tgz#931c85425e53ea67627adcace06a6bbc676f0448" @@ -2248,6 +2279,17 @@ execa "^5.0.0" fast-xml-parser "^4.4.1" +"@react-native-community/cli-platform-apple@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-apple/-/cli-platform-apple-19.1.2.tgz#42f8eb69e870f132ffa1383930c53c93b4949783" + integrity sha512-TtaF8Pyrs4dnIH3LTvuPnPjGDsSVaZLu+8s4y5bngzZIf9r7M/HJTlpnhm8+bQPsahxNhNQZBGUBrQJqfmg7Ww== + dependencies: + "@react-native-community/cli-config-apple" "19.1.2" + "@react-native-community/cli-tools" "19.1.2" + chalk "^4.1.2" + execa "^5.0.0" + fast-xml-parser "^4.4.1" + "@react-native-community/cli-platform-ios@19.1.1": version "19.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-19.1.1.tgz#c3e8eb512530469fc6d48881f5265af3f0c2c63f" @@ -2255,12 +2297,19 @@ dependencies: "@react-native-community/cli-platform-apple" "19.1.1" -"@react-native-community/cli-server-api@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-19.1.1.tgz#24f4a7b4c4a527e850ed6bb3fc959a9fd0fa4f4c" - integrity sha512-p0FFm82uPrtLZBWTD3bZ43mMBIV5mXwvGFYMcsfGiuMoS9SNbw4ImEFTG2IutVpr7Qb6NMjx6SbgYYMnTdZXmw== +"@react-native-community/cli-platform-ios@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-19.1.2.tgz#2925279acbfa22dc6e05f189f8908cb0c6427f6e" + integrity sha512-rmLZjwpI+mV3bbd6FgR6yM/ekFNr4QM/Dgzmatkh8k94B5uGtw5Me4EKlY+MrqR3lIyjzqWtLoefcJxA1c9d2w== dependencies: - "@react-native-community/cli-tools" "19.1.1" + "@react-native-community/cli-platform-apple" "19.1.2" + +"@react-native-community/cli-server-api@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-19.1.2.tgz#adc5353314d40c50d1bfddbc1b85a29e3650ce03" + integrity sha512-K6UIvtw6VtcKxCX+rJ5mKQYiqcSSRKODPQ2nbIeIxjjO5nDjDriGkFC/ypHHk38oZuJYOLbOySqnnCNkdEI4uQ== + dependencies: + "@react-native-community/cli-tools" "19.1.2" body-parser "^1.20.3" compression "^1.7.1" connect "^3.6.5" @@ -2287,24 +2336,40 @@ prompts "^2.4.2" semver "^7.5.2" -"@react-native-community/cli-types@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-19.1.1.tgz#b48aa60d9dbc16f3bc4ccd5405504d80efce0835" - integrity sha512-rOGiYjeDM9tkYBEuK6TJrnxpMhmaId1Un8pjQJswz7W9w2Vb6+nnLfWja7X7VmDIvqIK5GhVobRHsmKCKIdDEA== +"@react-native-community/cli-tools@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-19.1.2.tgz#970e952d373432b2a9cc109ba3f99f8c7d812700" + integrity sha512-AsDuZu/7R/QX+vGpJIRK97v24X+zqkmwA9/uLRguLTHM175nUxb/byXmAKWuZylG2FAikVvf7EqV8MFGbwM7Wg== dependencies: - joi "^17.2.1" + "@vscode/sudo-prompt" "^9.0.0" + appdirsjs "^1.2.4" + chalk "^4.1.2" + execa "^5.0.0" + find-up "^5.0.0" + launch-editor "^2.9.1" + mime "^2.4.1" + ora "^5.4.1" + prompts "^2.4.2" + semver "^7.5.2" -"@react-native-community/cli@19.1.1": - version "19.1.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-19.1.1.tgz#d1bd8c477b0c878682b34b9bfc45bb62ab40db7c" - integrity sha512-H17sV83KPg2H2GCNuUSMM1ZM2sy6msVSmxrhJSycH8ua3i9Iixja8DeYtGIcJUzjdU/4U2eSDs6PjOSZUVn8CQ== +"@react-native-community/cli-types@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-19.1.2.tgz#a59911cac2fb2043c70b093e0e61ebc0ac105619" + integrity sha512-Ze6fi6jE+JPvMlISWbZ/eCPOkRuuEs1SX4rJGWOXPcDzEVF6gs1ePsAjdzQ3RJYRMqQ49vo6iGiOZs//z5kuVw== dependencies: - "@react-native-community/cli-clean" "19.1.1" - "@react-native-community/cli-config" "19.1.1" - "@react-native-community/cli-doctor" "19.1.1" - "@react-native-community/cli-server-api" "19.1.1" - "@react-native-community/cli-tools" "19.1.1" - "@react-native-community/cli-types" "19.1.1" + joi "^17.2.1" + +"@react-native-community/cli@19.1.2": + version "19.1.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-19.1.2.tgz#f83bbecb2c1217a07270afdd9173d74453b3ec49" + integrity sha512-b28TLqODMgQRx6f4gbHoHYpnKyFbWzJkIk3+Ggpad/at493KfGQ+WvKg1sts/st8mxzmbk0T6lCc/9A3QoFKkQ== + dependencies: + "@react-native-community/cli-clean" "19.1.2" + "@react-native-community/cli-config" "19.1.2" + "@react-native-community/cli-doctor" "19.1.2" + "@react-native-community/cli-server-api" "19.1.2" + "@react-native-community/cli-tools" "19.1.2" + "@react-native-community/cli-types" "19.1.2" chalk "^4.1.2" commander "^9.4.1" deepmerge "^4.3.0" @@ -7914,7 +7979,7 @@ scheduler@0.26.0, scheduler@^0.26.0: resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.26.0.tgz#4ce8a8c2a2095f13ea11bf9a445be50c555d6337" integrity sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA== -semver@7.7.2, semver@^7.7.2: +semver@7.7.2, semver@^7.1.3, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.7.2: version "7.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== @@ -7924,11 +7989,6 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.1.3, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0: - version "7.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" - integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== - send@0.19.0: version "0.19.0" resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" @@ -8200,12 +8260,29 @@ stream-chat-react-native-core@8.1.0: use-sync-external-store "^1.5.0" "stream-chat-react-native-core@link:../../package": - version "0.0.0" - uid "" + version "8.1.0" + dependencies: + "@gorhom/bottom-sheet" "^5.1.8" + "@ungap/structured-clone" "^1.3.0" + dayjs "1.11.13" + emoji-regex "^10.4.0" + i18next "^25.2.1" + intl-pluralrules "^2.0.1" + linkifyjs "^4.3.1" + lodash-es "4.17.21" + mime-types "^2.1.35" + path "0.12.7" + react-native-markdown-package "1.8.2" + react-native-url-polyfill "^2.0.0" + stream-chat "^9.23.0" + use-sync-external-store "^1.5.0" "stream-chat-react-native@link:../../package/native-package": - version "0.0.0" - uid "" + version "8.1.0" + dependencies: + es6-symbol "^3.1.3" + mime "^4.0.7" + stream-chat-react-native-core "8.1.0" stream-chat@^9.23.0: version "9.23.0" diff --git a/examples/TypeScriptMessaging/App.tsx b/examples/TypeScriptMessaging/App.tsx index 7bedb376f0..4eeb980f14 100644 --- a/examples/TypeScriptMessaging/App.tsx +++ b/examples/TypeScriptMessaging/App.tsx @@ -4,14 +4,13 @@ import { I18nManager, LogBox, Platform, - SafeAreaView, useColorScheme, View, } from 'react-native'; import { DarkTheme, DefaultTheme, NavigationContainer, RouteProp } from '@react-navigation/native'; import { createStackNavigator, StackNavigationProp } from '@react-navigation/stack'; import { useHeaderHeight } from '@react-navigation/elements'; -import { SafeAreaProvider } from 'react-native-safe-area-context'; +import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'; import { Channel as ChannelType, ChannelSort } from 'stream-chat'; import { Channel, @@ -118,7 +117,7 @@ const ChannelScreen: React.FC = ({ navigation }) => { } return ( - + = ({ navigation }) => { } return ( - + { visible={showPollCreationDialog} > - + - + diff --git a/package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx b/package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx index c80dc565df..b06c71309a 100644 --- a/package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx +++ b/package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx @@ -41,7 +41,7 @@ export const AudioAttachmentUploadPreview = ({ const finalAttachment = useMemo( () => ({ ...attachment, - asset_url: (attachment.localMetadata.file as FileReference).uri, + asset_url: attachment.asset_url ?? (attachment.localMetadata.file as FileReference).uri, id: attachment.localMetadata.id, ...audioAttachmentConfig, }), diff --git a/package/src/components/Poll/components/PollButtons.tsx b/package/src/components/Poll/components/PollButtons.tsx index b2de5f083f..be1903b966 100644 --- a/package/src/components/Poll/components/PollButtons.tsx +++ b/package/src/components/Poll/components/PollButtons.tsx @@ -1,9 +1,5 @@ -import React, { PropsWithChildren, useCallback, useState } from 'react'; -import { Modal, SafeAreaView as RNSafeAreaView, ViewStyle } from 'react-native'; -import { - SafeAreaProvider, - SafeAreaView as SafeAreaViewOriginal, -} from 'react-native-safe-area-context'; +import React, { useCallback, useState } from 'react'; +import { Modal } from 'react-native'; import { GenericPollButton, PollButtonProps } from './Button'; import { PollAnswersList } from './PollAnswersList'; @@ -13,22 +9,9 @@ import { PollAllOptions } from './PollOption'; import { PollResults } from './PollResults'; import { useChatContext, usePollContext, useTheme, useTranslationContext } from '../../../contexts'; +import { SafeAreaViewWrapper } from '../../UIComponents/SafeAreaViewWrapper'; import { usePollState } from '../hooks/usePollState'; -// This is a workaround to support SafeAreaView on React Native 0.81.0+ -const SafeAreaViewWrapper = ({ children, style }: PropsWithChildren<{ style: ViewStyle }>) => { - if (SafeAreaViewOriginal) { - return ( - - - {children} - - - ); - } - return {children}; -}; - export const ViewResultsButton = (props: PollButtonProps) => { const { t } = useTranslationContext(); const { message, poll } = usePollContext(); @@ -59,12 +42,10 @@ export const ViewResultsButton = (props: PollButtonProps) => { {showResults ? ( - - - - - - + + + + ) : null} @@ -107,12 +88,10 @@ export const ShowAllOptionsButton = (props: PollButtonProps) => { ) : null} {showAllOptions ? ( - - - - - - + + + + ) : null} @@ -155,12 +134,10 @@ export const ShowAllCommentsButton = (props: PollButtonProps) => { ) : null} {showAnswers ? ( - - - - - - + + + + ) : null} diff --git a/package/src/components/Poll/components/PollResults/PollResultItem.tsx b/package/src/components/Poll/components/PollResults/PollResultItem.tsx index 722878905d..63827928d6 100644 --- a/package/src/components/Poll/components/PollResults/PollResultItem.tsx +++ b/package/src/components/Poll/components/PollResults/PollResultItem.tsx @@ -1,17 +1,5 @@ -import React, { PropsWithChildren, useCallback, useState } from 'react'; -import { - Modal, - SafeAreaView as RNSafeAreaView, - StyleSheet, - Text, - View, - ViewStyle, -} from 'react-native'; - -import { - SafeAreaProvider, - SafeAreaView as SafeAreaViewOriginal, -} from 'react-native-safe-area-context'; +import React, { useCallback, useState } from 'react'; +import { Modal, StyleSheet, Text, View } from 'react-native'; import { LocalMessage, Poll, PollOption, PollVote as PollVoteClass } from 'stream-chat'; @@ -25,24 +13,11 @@ import { useTranslationContext, } from '../../../../contexts'; +import { SafeAreaViewWrapper } from '../../../UIComponents/SafeAreaViewWrapper'; import { usePollState } from '../../hooks/usePollState'; import { GenericPollButton } from '../Button'; import { PollModalHeader } from '../PollModalHeader'; -// This is a workaround to support SafeAreaView on React Native 0.81.0+ -const SafeAreaViewWrapper = ({ children, style }: PropsWithChildren<{ style: ViewStyle }>) => { - if (SafeAreaViewOriginal) { - return ( - - - {children} - - - ); - } - return {children}; -}; - export type ShowAllVotesButtonProps = { option: PollOption; onPress?: ({ diff --git a/package/src/components/UIComponents/SafeAreaViewWrapper.tsx b/package/src/components/UIComponents/SafeAreaViewWrapper.tsx new file mode 100644 index 0000000000..ea8ccbc4b2 --- /dev/null +++ b/package/src/components/UIComponents/SafeAreaViewWrapper.tsx @@ -0,0 +1,23 @@ +import React, { PropsWithChildren } from 'react'; +import { SafeAreaView as RNFSafeAreaView, ViewStyle } from 'react-native'; +import { + SafeAreaProvider, + SafeAreaView as SafeAreaViewOriginal, + SafeAreaViewProps, +} from 'react-native-safe-area-context'; + +export const SafeAreaView = SafeAreaViewOriginal ?? RNFSafeAreaView; + +export const SafeAreaViewWrapper = ({ + children, + style, + ...restProps +}: PropsWithChildren<{ style: ViewStyle }> & SafeAreaViewProps) => { + return ( + + + {children} + + + ); +};