Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3248,4 +3248,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 6b7a4b74915b42bfe4ffddaf67cbf5e7a2bfeab3

COCOAPODS: 1.16.2
COCOAPODS: 1.14.3
6 changes: 3 additions & 3 deletions examples/TypeScriptMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7329,9 +7329,9 @@ stream-chat-react-native-core@8.1.0:
uid ""

stream-chat@^9.23.0:
version "9.23.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.23.0.tgz#e7e5cf729861597e7198907c1cab22a57d68a2fc"
integrity sha512-UW112HYsLnYb4RMIXBtAouNQCCe0weVzNivjezsw+JKK1b/TX0JLBi+wK25mBUEO+coOGKfXiye6IB3gao8ipw==
version "9.24.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.24.0.tgz#e6af5d4b0eb396e24e0ab7f852719581c39f18bc"
integrity sha512-zLtguYRqxeEc/Cjw8Zp00u/wTrqFg4gFPKdj3mvl/Jq1Pt95mY9nMc38KW0GOu/2quIAAar0NNMq8fsXl4jupQ==
dependencies:
"@types/jsonwebtoken" "^9.0.8"
"@types/ws" "^8.5.14"
Expand Down
4 changes: 3 additions & 1 deletion package/expo-package/src/optionalDependencies/pickImage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Platform } from 'react-native';
import { PickImageOptions } from 'stream-chat-react-native-core';
let ImagePicker;

try {
Expand All @@ -14,7 +15,7 @@ if (!ImagePicker) {
}

export const pickImage = ImagePicker
? async () => {
? async ({ maxNumberOfFiles }: PickImageOptions = {}) => {
try {
let permissionGranted = true;
if (Platform.OS === 'ios') {
Expand All @@ -35,6 +36,7 @@ export const pickImage = ImagePicker
allowsMultipleSelection: true,
mediaTypes: ['images', 'videos'],
preferredAssetRepresentationMode: 'current',
selectionLimit: maxNumberOfFiles,
});

const canceled = result.canceled;
Expand Down
4 changes: 3 additions & 1 deletion package/native-package/src/optionalDependencies/pickImage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Platform } from 'react-native';
import { PickImageOptions } from 'stream-chat-react-native-core';
let ImagePicker;

try {
Expand All @@ -8,11 +9,12 @@ try {
}

export const pickImage = ImagePicker
? async () => {
? async ({ maxNumberOfFiles }: PickImageOptions = {}) => {
try {
const result = await ImagePicker.launchImageLibrary({
assetRepresentationMode: 'current',
mediaType: 'mixed',
selectionLimit: maxNumberOfFiles,
});
const canceled = result.didCancel;
const errorCode = result.errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export const MessageInputProvider = ({
return;
}

const result = await NativeHandlers.pickImage();
const result = await NativeHandlers.pickImage({ maxNumberOfFiles: availableUploadSlots });
if (result.askToOpenSettings) {
Alert.alert(
t('Allow access to your Gallery'),
Expand Down
6 changes: 5 additions & 1 deletion package/src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ type PickImageAssetType = {
cancelled?: boolean;
};

type PickImage = () => Promise<PickImageAssetType> | never;
export type PickImageOptions = {
maxNumberOfFiles?: number;
};

type PickImage = (options?: PickImageOptions) => Promise<PickImageAssetType> | never;

type SaveFileOptions = {
fileName: string;
Expand Down
Loading