Bubble message text color does not dynamically change
See original GitHub issueIssue Description
MessageText color does not dynamically change when changing the color property on the Bubble component.
Steps to Reproduce / Code Snippets
const renderBubble = (props) => {
// theme is a hook that updates the colors based on the device's colorScheme value ('light' or 'dark').
const { theme } = useTheme();
return (
<Bubble
{...props}
wrapperStyle={{
left: { backgroundColor: theme.colors.bubble }, // Changes dynamically
right: { backgroundColor: theme.colors.bubble }, // Changes dynamically
}}
renderMessageText={(props) => {
return (
<MessageText
{...props}
textStyle={{
left: { color: theme.colors.white }, // Does not change dynamically
right: { color: theme.colors.white },
}}
/>
);
}}
/>
);
};
Expected Results
The text should change its color (re-render the component). For example, theme.colors.white
is white when the colorScheme is ‘light’ and black when the colorScheme is ‘dark’.
Testing this with the background color property for the Bubble component and it works fine if we provide shouldUpdateMessage={() => true}
. However, no matter what we tried (e.g. adding theme
property to extraData
prop) the color property of MessageText does not change.
Additional Information
- Nodejs version: v15.14.0
- React version: 16.13.1
- React Native version: Expo’s latest for SDK 41
- react-native-gifted-chat version: 0.16.3
- Platform(s) (iOS, Android, or both?): both
- TypeScript version: N/A
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Change the background color of a single chat bubble ...
I'm trying to dynamically change the chat bubble background. After doing a lot of researching I thought this was the correct approach but...
Read more >Messages now has dynamic colors in the conversation bubbles
Messages bubble colors in iOS 15, any way to change hues slightly without jailbreaking? (the green for SMS is blinding to me).
Read more >Changing color dynamically in the HTML not working - Database
I want each thing shown in the Repeating Group, to show a different (or same color) depending on things in the database. Therefore...
Read more >Problem with text alignment in a chat bubble layout
What I need to achieve is that message text is aligned to the left (in case of left-to-right languages) but since message TextView...
Read more >How to change color dynamically from front end in Bubble.io ...
Hi, Welcome to Bubble.io tutorialIn this bubble.io tutorial , You will learn how to create an app without coding, how to build a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved this issue by implementing our own MessageText component as a hook. The problem seems to be with the
componentShouldUpdate
function does not get executed whenshouldUpdateMessage
returns true. It only propagates down to the Bubble component.We prefer that this is fixed in the library so we don’t have to maintain our own custom component.
hi can u provide some codes?