question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline images in message?

See original GitHub issue

Issue Description

Trying to get inline images in messages to work. Adding a separate pattern and renderText function. But they end up in the same line as the text. I would like them to be on separate lines and split the text.

It also never replaces all occurrences of my pattern, just the first one?

image

Steps to Reproduce / Code Snippets

renderImage = (matchingString, matches) => (
  <View
    style={{
      paddingVertical: 10,
    }}
  >
    <MessageImage currentMessage={{ image: matches[1] }} />
  </View>
);

render() {
  return (
    <SafeAreaView style={styles.screen}>
      <GiftedChat
        parsePatterns={() => [
          {
            pattern: /\[IMG:(.+?)\]/gi,
            style: {},
            onPress: () => {},
            renderText: this.renderImage,
          },
        ]}
      />
    </SafeAreaView>
  );
}

Additional Information

  • Nodejs version: v8.9.4
  • React version: 16.3.1
  • React Native version: 0.55.4
  • react-native-gifted-chat version: ^0.4.3
  • Platform(s) (iOS, Android, or both?): iOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
AkAyushcommented, Jun 11, 2018

Hi, I am using react-native-gifted-chat and i wanted to know, how to restrict the user to input any phone number or email address in chat ??

In My second scenario, I want to replace my chated phone number or email with ********* so that the end user cant see the shared number or email for the privacy reason.

PLEASE HELP I AM NEW WITH THIS LIBRARY

1reaction
AkAyushcommented, Jun 11, 2018

Thank You so much @emilkarl, it’s working 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Insert an Inline Image in an Outlook Message
Follow these steps to add an inline image to your email: Start a New Email. Your message will need to be in HTML...
Read more >
Inline images are no longer showing, it only has text saying ...
If I compose a message in gmail with an inline image either by upload or copy/paste, it will appear to be inlined in...
Read more >
How to Embed Images in Your Emails (CID, Inline & More)
3 ways to embed images in emails. 1. CID embedded images (inline images). To me, CID (or Content-ID) feels old, and something very...
Read more >
How do I get back inline image display in email? | Thunderbird ...
Now you have a menu with a View option, you can use it to display attachments inline, and also to view messages in...
Read more >
How to Embed Photos in Email Messages
How to Embed Photos in Email Messages. Embedding images in an email message involves adding the message into the text, much as they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found