React-native-gifted-chat: Unable to style time stamp of chat bubbles

Created on 21 Feb 2020  路  8Comments  路  Source: FaridSafi/react-native-gifted-chat

Issue Description

Unable to change the timestamp styling displayed in chat bubbles

Steps to Reproduce / Code Snippets

  renderBubble (props) {
    return (
      <Bubble
        {...props}

        textStyle={{
          right: {
            color: 'black',
            fontWeight:'400'
          },
          left:{
            color:'black',
            fontWeight:'400'

          }
        }}
        wrapperStyle={{
          right: {
            backgroundColor: '#ffd633'
          },
          left:{
            backgroundColor:'#fff0b3'
          }
        }}
      />
    )
  }

Simulator Screen Shot - iPhone 8 - 2020-02-22 at 00 38 10

Expected Results

Styling for time stamps just like the message text in the bubble

Additional Information

  • React version: 16.8.3
  • React Native version: 0.59.10
  • react-native-gifted-chat version: 0.13.0
  • Platform(s) (iOS, Android, or both?): Yes
wontfix

Most helpful comment

Just use timeTextStyle={{ left: { color: 'black' },right: { color:'black'} }} props at GiftedChat tag

All 8 comments

This issue can be marked as duplicate, but the thing is i found a thread with a guide to style the chatbubbles - but not the timestamps.

Have you tried using renderTime?

Below is what I do

```import { Time } from 'react-native-gifted-chat';
import Colors from '../../../constants/Colors';

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'flex-end'
},
chat: {
color: Colors.grey,
textAlign: 'right'
}
});

const ChatTime = ({ currentMessage, timeFormat }) => {
return (
currentMessage={currentMessage}
timeFormat={timeFormat}
containerStyle={{
left: styles.container,
right: styles.container
}}
timeTextStyle={{
right: styles.chat,
left: styles.chat
}}
/>
);
};

@sichiu do you just pass that ChatTime as a props to renderTime?

I don't think styling looks right, because I tried that and date overflows from the bubble.

Just use timeTextStyle={{ left: { color: 'black' },right: { color:'black'} }} props at GiftedChat tag

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I used

timeTextStyle={ left:{ ... }, right: { ... } }

prop at Bubble Component.

Is there no way to get more granular than "left" and "right"? If there's a multi-user chat with multiple different background colors going on on the left side, I want to be sure the timestamp is readable. If I'm limited to "left", then that can't happen. Yikes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cassioseffrin picture cassioseffrin  路  3Comments

inceptivetech picture inceptivetech  路  3Comments

arayaryoma picture arayaryoma  路  3Comments

jasonwcfan picture jasonwcfan  路  3Comments

radvc picture radvc  路  3Comments