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.

is onPress memoized?

See original GitHub issue

Is the onPress prop memoized? Because if it is, there is an issue since I am using state in onPress and it using the wrong state.

Using Expo SDK 46

It seems like onPressIn works because it is directly being passed into the component, but ideally I would like to use onPress as it is significantly better UX.

Here is a reproducible demo: https://snack.expo.dev/@anshnanda/awesomebutton-not-working

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14

github_iconTop GitHub Comments

2reactions
MonchiLincommented, Nov 4, 2022

Same issue.

0reactions
eeshankenicommented, Dec 5, 2022

@ansh damn this package seems more trouble than its worth. Which is unfortunate cause its really rather good

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing a memoized function to onPress of a component issue
Try removing the true argument as it isn't specified in the docs throttle(500, (x)=>{console.log("help please").
Read more >
Memoize!!! - a react (native) performance guide - gists · GitHub
Memoization in React. It's important to memoize heavy computations as well as arrays and object creations so that they don't get re-created on...
Read more >
React Hooks: Memoization - Medium
React.memo is a performance optimization tool, a higher order component. It's similar to React.PureComponent but for function components instead ...
Read more >
4 tips for improving the performance of your React Native ...
One of the most important steps in improving the performance of a React Native application is to memoize the components that you're using....
Read more >
How do you cache FlatList.renderItem? Is ... - Andrei Calazans
You might be asking yourself: how do I properly memoize FlatList's renderItem when its onPress needs to know the ID of the item?...
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