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
11 changes: 9 additions & 2 deletions package/expo-package/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
Video,
} from './optionalDependencies';

registerNativeHandlers({
/**
* The default native handlers this package registers with the core SDK.
*/
export const defaultNativeHandlers = {
Audio,
compressImage,
deleteFile,
Expand All @@ -39,13 +42,17 @@ registerNativeHandlers({
pickDocument,
pickImage,
saveFile,
SDK: 'stream-chat-expo',
setClipboardString,
shareImage,
Sound,
takePhoto,
triggerHaptic,
Video,
};

registerNativeHandlers({
...defaultNativeHandlers,
SDK: 'stream-chat-expo',
});

export * from 'stream-chat-react-native-core';
29 changes: 29 additions & 0 deletions package/expo-package/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
import { registerNativeHandlers } from 'stream-chat-react-native-core';

export * from 'stream-chat-react-native-core';

/**
* The default native handlers this package registers with the core SDK.
*
* Exposed so integrators can compose or wrap a single handler (for example to
* force `takePhoto` to capture images only) without reimplementing it or
* reaching into internal module paths. Register your override *after* importing
* this package so it takes precedence.
*
* Example:
*
* ```ts
* import { registerNativeHandlers, defaultNativeHandlers } from 'stream-chat-expo';
*
* const localTakePhoto = defaultNativeHandlers.takePhoto;
*
* registerNativeHandlers({
* takePhoto: localTakePhoto
* ? (options) => {
* console.log('[#3379 demo] wrapped takePhoto — forcing mediaType "image"', options);
* return localTakePhoto({ ...options, mediaType: 'image' });
* }
* : undefined,
* });
* ```
*/
export declare const defaultNativeHandlers: Parameters<typeof registerNativeHandlers>[0];
11 changes: 9 additions & 2 deletions package/native-package/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import {
Video,
} from './optionalDependencies';

registerNativeHandlers({
/**
* The default native handlers this package registers with the core SDK.
*/
export const defaultNativeHandlers = {
Audio,
compressImage,
deleteFile,
Expand All @@ -40,13 +43,17 @@ registerNativeHandlers({
pickDocument,
pickImage,
saveFile,
SDK: 'stream-chat-react-native',
setClipboardString,
shareImage,
Sound,
takePhoto,
triggerHaptic,
Video,
};

registerNativeHandlers({
...defaultNativeHandlers,
SDK: 'stream-chat-react-native',
});

if (Platform.OS === 'android') {
Expand Down
29 changes: 29 additions & 0 deletions package/native-package/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
import { registerNativeHandlers } from 'stream-chat-react-native-core';

export * from 'stream-chat-react-native-core';

/**
* The default native handlers this package registers with the core SDK.
*
* Exposed so integrators can compose or wrap a single handler (for example to
* force `takePhoto` to capture images only) without reimplementing it or
* reaching into internal module paths. Register your override *after* importing
* this package so it takes precedence.
*
* Example:
*
* ```ts
* import { registerNativeHandlers, defaultNativeHandlers } from 'stream-chat-expo';
*
* const localTakePhoto = defaultNativeHandlers.takePhoto;
*
* registerNativeHandlers({
* takePhoto: localTakePhoto
* ? (options) => {
* console.log('[#3379 demo] wrapped takePhoto — forcing mediaType "image"', options);
* return localTakePhoto({ ...options, mediaType: 'image' });
* }
* : undefined,
* });
* ```
*/
export declare const defaultNativeHandlers: Parameters<typeof registerNativeHandlers>[0];