testshallpass / react-native-dropdownalert

An alert to notify users about an error or something else
MIT License
1.85k stars 252 forks source link

Performance renderImage #190

Closed RWOverdijk closed 5 years ago

RWOverdijk commented 5 years ago

Short Description

When using renderImage CPU goes insane. Upon further inspection I found that renderImage gets called more than 100 times per notification. It gets so bad that all my other animations halt for 2 seconds.

Steps to Reproduce / Code Snippets / Usage

Just use the plugin. Snippet:

<DropdownAlert
  renderImage={(props, message) => {
    return (
      <CircleIcon
        containerStyle={props.imageStyle}
        icon={'check'}
      />
    );
  }}
  infoColor={Colors.Info}
  warnColor={Colors.Warn}
  errorColor={Colors.Error}
  successColor={Colors.Success}
  onClose={environment.notification.onClose}
  ref={(ref: DropdownAlert) => environment.notification.setDropdown(ref)}
  useNativeDriver
/>

Note: useNativeDriver makes no difference in performance.

Expected Results

Not calling thee callbacks more than a hundred times.

Additional Information

testshallpass commented 5 years ago

Hi @RWOverdijk, please retest on 4.0.0.

RWOverdijk commented 5 years ago

I'm not using this anymore. Feel free to close it.