Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]: How to render custom message ? #39

Closed
shamxeed opened this issue Dec 22, 2021 · 5 comments
Closed

[QUESTION]: How to render custom message ? #39

shamxeed opened this issue Dec 22, 2021 · 5 comments
Labels
question Further information is requested

Comments

@shamxeed
Copy link

I am not completely sure whether my codes follows good PRACTICE, that's why I'm here.

In a room chat, I want the current room members to be notified of newly joined member through rendering customMessage.

my code:

import { Dimensions } from 'react-native'
import { Chat, defaultTheme } from '@flyerhq/react-native-chat-ui';

//first off, let's get the screen width
const { width } = Dimensions.get('screen');

const ChatWindow = () => {
 return (
    <Chat
      ...
      renderCustomMessage={(message) => {
        if (message?.type !== 'custom') return;
        return (
          <View
            style={{
              width: width - 20,
              backgroundColor: background,
              paddingVertical: 10,
              alignItems: 'center',
            }}
          >
            <Paragraph>{message?.text}</Paragraph>
          </View>
        );
      }}
    />
 )
}

Please, if there's a better approach to archive this, let me know. And I think more examples are needed In the documentations, Thank you so much for this amazing Lib, words can't describe how amazing it was!!

PS: Screenshot provided below.

2021_12_22_12_06_IMG_2880

@shamxeed shamxeed added the question Further information is requested label Dec 22, 2021
@demchenkoalex
Copy link
Member

Hey @shamxeed sorry for the late response, had health issues. For now what you have is exactly how it can be done at the moment, but we will be soon working on a dedicated SystemMessage which will be used exactly for this purpose - notification.

@shamxeed
Copy link
Author

shamxeed commented Jan 17, 2022 via email

@shamxeed
Copy link
Author

shamxeed commented Jan 18, 2022 via email

@demchenkoalex
Copy link
Member

demchenkoalex commented Jan 18, 2022

not at the moment, no. To add a caption to the image we would need to create a custom image picker (to store selected image somewhere while adding the caption) and this might be the whole different big project to be honest :) so right now you can only send an image and then write a message.

@shamxeed
Copy link
Author

shamxeed commented Jan 18, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants