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.

Context menu flickering(may be it re-render) after modify message data

See original GitHub issue

Hi, i just found this problem. it’s REALLY HARD TO KNOW.

you can see the video here, as I just add a reaction to view:

https://user-images.githubusercontent.com/8202437/174272591-80fdb8cc-c6eb-4c04-baa2-15015bcbfee8.mov

Here is the main layout for view:

<ContextMenuView>
   <Bubble/>
  <ReactionView/>
</ContextMenuView>

Inside onPressMenuItem, i just update message:

const message = props.currentMessage
                            const reactions = message.reactions
                            reactions.push({
                                'id': '1',
                                'type': 200,
                                'date': new Date().getTime(),
                                'by': currentUser.id
                            })
                            message.reactions = reactions
                            handleChoosenMessageReaction(message)

const handleChoosenMessageReaction = React.useCallback((message) => {
        const newMessages = [...messages]
        const index = newMessages.findIndex(mes => mes._id === message._id)
        console.log('index', index)
        if(index > -1){
            newMessages[index].reactions = [...message.reactions]
            console.log('handleChoosenMessageReaction', message.reactions)
            setMessage(newMessages)
        }
    })

I tried to use https://github.com/mpiannucci/react-native-context-menu-view but it’s does not make problem, But I want to use your lib because it’s better

Please helppp

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dominicstopcommented, Jun 17, 2022

Hey, this has been fixed in version 1.8.1

I also added shouldWaitForMenuToHideBeforeFiringOnPressMenuItem prop to ContextMenuView if you want onPressMenu to fire ASAP.

Here’s an excerpt from the docs:

🔤 shouldWaitForMenuToHideBeforeFiringOnPressMenuItem ⚛️ boolean ✳️ Default: true
If set to true, the onPressMenuItem event will be triggered after the context menu has been hidden (i.e. after onMenuDidHide event is triggered).
Set this to false if you want onPressMenuItem to trigger as soon as an item has been pressed in the context menu.
📝 Note: Layout updates while the context menu is transitioning from it’s open to hidden state might cause layout bugs (e.g. https://github.com/dominicstop/react-native-ios-context-menu/issues/43).


Thanks for filing an issue 😌

1reaction
dominicstopcommented, Jun 17, 2022

@fukemy Hey, I’ve added Test02Screen to reproduce your bug.

https://user-images.githubusercontent.com/18517029/174292418-a660a28a-86a9-43a3-b33a-51f35ef43160.mov


As a temp. solution, I’m going to update onPressMenuItem so that it fires after the context menu is hidden first

Once i finish releasing the patch, I’ll close this issue 😌

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context menu flickers on and off under Fedora : r/firefox - Reddit
It happens under a new profle, with no extensions. It pops up, but then when you mouse over it starts flickering. any idea...
Read more >
How to fix screen flickering in Windows PCs/laptops
Select the arrow to expand Display adapters. Under Display Adapters, right-click the adapter, then select Update driver; Note: You may need to ...
Read more >
android - RecyclerView blinking after notifyDatasetChanged()
Problem is when we have refresh in the recyclerView, it is blincking for a very short while in the beginning which looks strange....
Read more >
When does React re-render components? - Felix Gerschau
Why doesn't my React component update when its props change? ... three-dot menu on the right -> More tools -> Rendering -> Paint...
Read more >
Screen Flashes, Flickers and Form Refreshes
We are working on a complex database, based on continuous forms that seems to have issues with screen flickers and form refreshs when...
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