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.

Toolbar slows down entire app

See original GitHub issue

Hello, I am using the Toolbar component in conjunction with react-navigation but I notice that doing so slows down visibly (even in production) the whole app. The animations become choppy and the app overall seems less responsive.

My code:

const CustomHeader = (props) => {

  const {getScreenDetails, scene, navigation} = props;
  const details = getScreenDetails(scene);
  const showBackButton = (navigation.state.routes.length > 1) ? true : false;
  const {title, searchable, ...other} = details.options;

  return (
    <Toolbar
      leftElement={showBackButton ? 'arrow-back' : 'menu'}
      onLeftElementPress={() => showBackButton ? navigation.goBack(null) : props.navigation.navigate('DrawerOpen')}
      centerElement={details.options.title}
      searchable={searchable}
      {...other}
    />
  )
};

const PrimaryNav = StackNavigator({
// ## My nav ...
}, {
// ## Other options
contentComponent: CustomDrawerContentComponent
})

I have noticed that this happens only with the toolbar component, as other components of this library do not have this effect. What could be causing this? How to remedy it?

TL;DR: I’m dropping frames like nobody’s business

Thank you.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Mukeyiicommented, Feb 19, 2018

@Unforgiven-wanda I was using react-native-router-flux and whenever I switched between scenes or updated my redux store, all the other “invisible” scenes got updated and rerendered too. For this reason, the interactions and navigation became extremely slow and choppy. Now I don’t allow invisible scenes to update if they’re not the current one and my application is super fast and materialistic 😃

0reactions
xotahalcommented, Feb 19, 2018

It is nothing to do with this library. But anyway, it’s not the best fix what you can do. It is workaround how to quick fix your code. You should rather make your redux store immutable (you can use for example immutable.js - or of course, you can approach immutability also without the immutable.js) and than you should ensure that your components are re-rendered only if thay have to be re-rendered - and they should be re-rendered only if the data, which are shown on particular component, is changed …

You can also check RN’s runAfterInteractions

Read more comments on GitHub >

github_iconTop Results From Across the Web

Faulty taskbar, computer running slow - Microsoft Community
Right-click the taskbar and select “Task Manager” or press Ctrl+Shift+Escape to launch it. Click over to the Startup tab and disable startup ...
Read more >
Django-debug-toolbar extremely slowing down loading page
I've installed django-debug-toolbar . The problem is that it is extremely slowing down page loading. Moreover, couple minutes ago it was ...
Read more >
Two Innocent-Looking Apps Are Slowing Down Your Windows ...
The report begins by covering an article on Ars Technica, claiming that getting rid of the Chat (called "Teams" in the article) and...
Read more >
How To Remove Yahoo Toolbar And Speed Up Your Computer
So the fastest, and easiest way to remove the Yahoo Toolbar from your computer, and thus from all of your web browsers, is...
Read more >
Does it slow down your computer if you have many icons in ...
It is possible that having a lot of icons can cause a spike in usage and slow down your system, but not on...
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