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.

Animation on message display

See original GitHub issue

Sorry, this is not a bug report

Any one has using telegram or whatsapp chat, we can see animation on message display, it’s smoothly. So i would like to consult any idea for this animation.

As we know, gifted-chat force render from bottom by use transform: [ { scaleY: -1 }, ] this is nice trick, but using this, message has been displayed immediately when data prop change. I tried to run animation to change message’s height from 0 to fixed height at message’s componentDidMount but it doesn’t work as expected; cause ListView still render a blank row for new message. Another test, i remove all transform trick, then using: scrollToEnd({animation:true}) to run animation scroll on message income, it’s smoothly. But we have to scroll to bottom when access to list chat, it’s a bad ux.

So, any one has any idea to help me ?

Thanks all !!!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
vgortecommented, Oct 5, 2017

Hello @redwind, I don’t know if I understood your problem. So you want to animate new messages right? Why don’t you just animate the bubble component in renderBubble() instead of the messages ?

I use a framework called animatable to animate my messages but you can create your own animations just as easy. In my case it could look something like this:

  renderBubble(props) {
    return (
      <Animatable.View animation={bounceInLeft} duration={400}>
        <Bubble {...props}
              wrapperStyle={{
                 left: {
                 backgroundColor: '#f0f0f0',
             }
        />
      </Animatable.View>
    );
}

So every bubble component gets created and is encapsulated in a view that slides in from left to right, so the whole component will be animated that way.

I hope this was helpful. If not, please correct my misunderstanding of your question.

7reactions
Stefan28BUcommented, Apr 12, 2021

Any updates? This kind of animation is the gold standart for all popular apps with chats (Instagram, Tinder, etc.)

RPReplay_Final1611869692.mov

Pasted my code here for your reference ` const CustomMessage = React.memo((props: any) => {

  const messageHeight = useSharedValue<undefined | number>(undefined);

  const [heightState, setHeightState] = useState(0);

  const [done, setDone] = useState(false);

  const themeColors: ThemeColorTypes = useSelector(
      (state: RootState) => state.setThemeColorsReducer
  );

  const transitionStyle = useAnimatedStyle(() => {
      return {
          height: messageHeight.value,
      };
  }, []);

  const onLayout = (e: LayoutChangeEvent) => {
      const tempHeight = e.nativeEvent.layout.height;

      if (!done) {
          messageHeight.value = 0;

          setHeightState(tempHeight);
      }
  };

  useEffect(() => {
      if (heightState !== 0) {
          setDone(true);
          messageHeight.value = withSpring(heightState, springConfig);
      }
  }, [heightState]);

  return (
      <Reanimated.View
          onLayout={onLayout}
          style={[
              {
                  position: heightState !== 0 ? undefined : 'absolute',
                  overflow: 'hidden',
              },
              transitionStyle,
          ]}
      >
          <Message {...props} />
      </Reanimated.View>
  );

});

`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animate messages on iPhone - Apple Support
In the Messages app , you can animate a single message with a bubble effect or fill the entire message screen with a...
Read more >
Text Message Animation - HitFilm Tutorial - YouTube
... videos:https://kit.com/DigitalBlast/youtube-video-creationStart-to-finish HitFilm tutorial covering how I made the on- screen text mess.
Read more >
Send animated effects in messages on iPhone; here is how ...
1. You can use full-screen effects to animate the message screen. 2. In a new or existing conversation, type a message or insert...
Read more >
Special Effects: Animate Your Text Bubbles | iOS 15 Guide
If you're sending an iMessage, you can spice things up by animating your text. You can animate the message bubble itself, as well...
Read more >
How to Add Cool Animated Effects to Your iMessages
And in this article, we'll show you how to unlock their colorful potential. About iMessage Effects. You can't add effects to every message...
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