react-native-live-markdown icon indicating copy to clipboard operation
react-native-live-markdown copied to clipboard

`markdownStyle` updates to `emoji.fontSize` aren't applied right away on iOS

Open VickyStash opened this issue 1 year ago • 1 comments

Problem

The markdownStyles-> emoji -> fontSize update doesn't re-render the input on iOS. So any time new value is passed as emoji fontSize it's not applied right away, it works only after the input value is updated (something new got entered).

Steps to reproduce

  1. Update App.tsx example with the next updates:
// Specify default markdownStyle value
const [markdownStyle, setMarkdownStyle] = React.useState({emoji: {fontSize: 19}});

// Display markdownStyles to see how it's updated
<Text>Markdown style: {JSON.stringify(markdownStyle)}</Text>

...

// Add two buttons to update emoji font size
<Button
  title="Update emoji font size to 27"
  onPress={() =>
    setMarkdownStyle({
      emoji: {
        fontSize: 27,
      },
    })
  }
/>
<Button
  title="Update emoji font size to 19"
  onPress={() =>
    setMarkdownStyle({
      emoji: {
        fontSize: 19,
      },
    })
  }
/>
  1. Enter a couple of emojis and some text in the input
  2. Tap on buttons to update the emoji font size. See that the value inside markdownStyles is updated but it has no effect on the input. Enter a new chart to the input, the updated styles will be applied now.

https://github.com/user-attachments/assets/3b549332-cf14-40ce-9d65-8c3e302f8bbc

Platform

iOS

VickyStash avatar Aug 01 '24 15:08 VickyStash

^^ @parasharrajat

VickyStash avatar Aug 01 '24 15:08 VickyStash

@tomekzaw Hi, I see you were working on the markdownStyles feature. Do you have the capacity to take a look at the issue or maybe you can at least share some thoughts to start with? This bug affects the enlarged emojis implementation.

VickyStash avatar Sep 02 '24 16:09 VickyStash

@tomekzaw @parasharrajat I've created a Draft PR with a fix for this issue. I'm going to test it over the E/App tomorrow and if everything is ok open the PR for the review.

I've noticed the fix also exists in this PR, but for some reason it wasn't progressed since May. @tomekzaw is there any reason for it?

VickyStash avatar Sep 09 '24 16:09 VickyStash

Fixed in https://github.com/Expensify/react-native-live-markdown/pull/475

tomekzaw avatar Sep 17 '24 10:09 tomekzaw