Cookbook - additions/improvements
We recently added a cookbook to this react-native sdk, to help users of this library easily get sample codes or examples or rough answers to generic "How to implement x with y component?" questions.
Please check current version here (screenshots coming soon) - https://github.com/GetStream/stream-chat-react-native/blob/master/docs/cookbook.md
Here are some more things that I will add soon:
- [ ] How to use
react-devtoolsto customise styles? - [x] How to add send button or attach button outside input box?
- [x] How to customise underlying FlatList component of
MessageListorChannelList? - [x] How do I disable file picker or image picker functionality?
- [ ] How do I enable/disable certain message actions (edit, delete, reaction, reply) for messages?
- [x] How do I override edit, delete, reaction, reply, sendMessage calls? e.g. to track analytics
- [ ] When some channel in ChannelList receives a new message, it moves by default to top of the list. Is there any way to avoid that?
- [ ] How can I customise the behaviour of ChannelList when events are received?
- [x] How do I build this project locally, to be able to change some source code?
- [ ] How can I create multiple tabs structure using channel list?
- [ ] How to implement draft message functionality with
MessageInput?
If you have more suggestions or use cases of your product, please feel free to add comments. I will try my best to include them in coming releases. Thanks :)
Hello. My issue refers to the groupStyles on messages with attachments. Currently, if a message is in the top/middle/bottom of a message group and it has attachments, it will be considered a 'single' message and thus adding a margin-bottom which I do not want. From what I've seen here, it checks if there are attachments and pushes directly as single message.
Is there any workarounds to keep the layout the same for messages with attachments? (the spacing and the corner radius).
Hey @losetchi currently doesn't look like there is NO easy way to do this. But we shall ponder and come-up with some clean way to achieve this
Hi guys, In my project I'm developing a channel info screen. On that screen like in all other messengers I want to display shared content (attachments): links, files, images. Is there any way how can I grab that data? I see that a workaround could be to loop though all the messages but this is inefficient.
Thanks.
Hi @vishalnarkhede Thank for your services
I am looking for the solution to move the avatar to the top of the messages? Could you give me some suggestions
How can I reduce the distance between the two messages? Sorry, we just change the SDK, I am starting to read the document.
@manhncse02926 Currently you can do it following way:
import { MessageSimple, MessageAvatar, MessageList } from 'stream-chat-react-native';
const CustomAvatar = (props) => {
return (
<MessageAvatar
{...props}
showAvatar={props.groupStyles[0] === 'single' || props.groupStyles[0] === 'top'}
/>
)
}
const CustomMessage = props => {
return (
<MessageSimple
{....props}
MessageAvatar={CustomAvatar}
)
}
// Use this component in MessageList
<MessageList
Message={CustomMessage}
// and other props here
/>
I will soon (next week) add an explicit prop to put avatar at top message instead of bottom message. It seems like a common usecase!!
Hello I have problems with the Cookbook's PushNotification examples The problem others are facing are described here https://github.com/GetStream/stream-chat-js/issues/100
I've tried both of them and can't get it to update the UI after _setupConnection() I can still send messages but no more UI updates are triggered using AppState with wsConnection.disconnect() when it's in the background and _setupConnection() when it gets into foreground.
It disconnects and then reconnects but it never updates the UI. Do I have to force refresh the UI and make it appear and disappear? that is Channel and ChannelList
Thank you for your reply. I wanna change the position of the avatar to the top of a bubble. Your example seems like only show the avatar of the first message.
I have found the solution on the example already
'message.avatarWrapper.container': 'align-self: flex-start',
Thank you
- I am facing a new problem, I add a header for channel chat then press on the input component, when keyboard dismisses, suddenly my input component also disappear. It happens on my project ( React-native 0.62.2, I phone 11). I tried to copy source code from slack-clone-example but got same the error. Do you know this problem? https://media.giphy.com/media/d8QPefEuvpVfIG9FXU/source.mov I resolved the above problem already. Thank
- Currently, I'm still hit the warning
backend.js:32 Animated: useNativeDriverwas not specified. This is a required option and must be explicitly set totrueorfalse`
When I click upload image or long-press on the message on react-native 0.62.x
Hello I have problems with the Cookbook's PushNotification examples The problem others are facing are described here https://github.com/GetStream/stream-chat-js/issues/100
I've tried both of them and can't get it to update the UI after _setupConnection() I can still send messages but no more UI updates are triggered using AppState with wsConnection.disconnect() when it's in the background and _setupConnection() when it gets into foreground.
It disconnects and then reconnects but it never updates the UI. Do I have to force refresh the UI and make it appear and disappear? that is Channel and ChannelList
@DobritoiuBogdan747 I will need more details regarding this. Maybe use logger and send me logs during the app state transition to [email protected]
Fixed by doing client.queryChannels(). When I do this after reconnect it will update the UI. It appears it needs another request to unblock itself.
I am building dark mode for my application. How can I config for typing text (TypingIndicator)
@manhncse02926
I am building dark mode for my application. How can I config for typing text (TypingIndicator)
You can style the following keys:
typingIndicator.text
typingIndicator.container
Hey guys any chance to get some steps how to pass a custom Attach/Send button ? Basically i'm looking for changing the icons. Do i need to do something like that ? And then pass it to AttachButton property to MessageInput?
import React from 'react';
import styled from '@stream-io/styled-components';
import * as constants from '../../constants/Constants'
const Container = styled.TouchableOpacity`
margin-right: 8;
${({ theme }) => theme.messageInput.attachButton.css}
`;
const AttachButtonIcon = styled.Image`
width: 20;
height: 20;
${({ theme }) => theme.messageInput.attachButtonIcon.css}
`;
export const CustomAttachButton = (props) => {
return (
<Container onPress={props.handleOnPress} disabled={props.disabled}>
<AttachButtonIcon source={MY_CUSTOM_IMAGE_RESOURCE} />
</Container>
);
}
I am going to close this issue. We created this with the intention of crowdsourcing ideas for cookbook material. But its being used to raise issues and kinda getting hard to keep track of. So please raise the separate tickets for your questions and we will take it from there :)
cc @plotic @manhncse02926