Comments (3)
I noticed now in the source code modificationTime is used, I'd think a better default would be creationTime, as the ios Photo library uses this sorting
from stream-chat-react-native.
Hey @VNDRN, this behaviour is customizable. You can register your own native handler as per the docs. Copy the snippet and just change the sortBy
param as per your requirement. We have kept it as modification time to keep it in parity with all SDKs so that's the default behaviour.
Here's the snippet:
import { registerNativeHandlers } from 'stream-chat-react-native';
registerNativeHandlers({
getPhotos: async ({
after,
first,
}: MediaLibrary.AssetsOptions): Promise<ReturnType> => {
try {
// NOTE:
// should always check first before requesting permission
// because always requesting permission will cause
// the app to go to background even if it was granted
const { accessPrivileges, status } = await MediaLibrary.getPermissionsAsync();
if (status !== 'granted') {
const { status: newStatus } = await MediaLibrary.requestPermissionsAsync();
if (newStatus !== 'granted') {
throw new Error('getPhotos Error');
}
}
const results = await MediaLibrary.getAssetsAsync({
after,
first,
mediaType: [MediaLibrary.MediaType.photo, MediaLibrary.MediaType.video],
sortBy: [MediaLibrary.SortBy.creationTime],
});
const assets = results.assets.map((asset) => ({
duration: asset.duration,
height: asset.height,
id: asset.id,
name: asset.filename,
source: 'picker' as const,
type: asset.mediaType,
uri: asset.uri,
width: asset.width,
}));
const hasNextPage = results.hasNextPage;
const endCursor = results.endCursor;
return { assets, endCursor, hasNextPage, iOSLimited: accessPrivileges === 'limited' };
} catch {
throw new Error('getPhotos Error');
}
};
});
from stream-chat-react-native.
Thanks! I had it changed with patch-package but this is a neater solution
from stream-chat-react-native.
Related Issues (20)
- groupStyles mislabels messages whose create time is sufficiently after the previous message and that follow "single" messages. Labelled "Bottom" when should be "top" or "single".
- Disable individual auto complete input HOT 1
- [🐛] Offline Mode Unread Count Out of Sync HOT 4
- [🐛] Unable to resolve PermissionsAndroid
- [🐛] Reply count is not updated after coming back from a Thread screen HOT 14
- [🐛] Thread messages have gone when a user start typing HOT 1
- [🐛] 🔥 Getting error and crashing while trying to upload a video. HOT 1
- [🐛] canceling giphy does not scroll messagelist to the last image HOT 1
- [🐛] The InputBox and SendButton goes wrong when users copy and paste multiple times in the textarea HOT 3
- [🐛] Unwanted channels are created with different multiple users HOT 6
- [🐛] Missing channelQueries table on fresh install HOT 2
- Allow for attaching custom attachments in message input
- [🐛] `EmptyStateIndicator` from `Channel` not hidden when new message is sent HOT 5
- [🐛] Export namespace should be first transformed by `@babel/plugin-transform-export-namespace-from`. HOT 3
- Customize background for MessageContent HOT 2
- [🐛] 🔥 Attachment picker sheet covers the entire chat when rendered inside a collapsed container HOT 4
- [🐛] Image upload in message input doesn't work on Android 14 (Pixel 5a) HOT 11
- Customise Chat Bubble for other user HOT 8
- Pasting images or files from clipboard into message input HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-chat-react-native.