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

removeClippedSubviews: Use at your own risk

Open aleclarson opened this issue 11 years ago • 11 comments

In the docs here, it says Use at your own risk.

Can someone elaborate on the possible risks of using removeClippedSubviews?

aleclarson avatar Nov 07 '15 22:11 aleclarson

I guess because it's experimental.

An experimental performance optimization for improving scroll perf of large lists, used in conjunction with overflow: 'hidden' on the row containers. Use at your own risk.

but I tend to think this is outdated and not anymore experimental, because it is now the default starting from RN 0.14:

https://github.com/facebook/react-native/releases/tag/v0.14.0-rc or maybe it is still experimental? --> " If you see any issues please report them. "

gre avatar Nov 09 '15 09:11 gre

I don't think it should default to true, I found that setting it to true at least in RN 0.13 caused the following issue: If you navigate from a listView with this set true and update the contents of that list view e.g. if the original list view is subscribed to changes, then the listview goes blank if you navigate back to it i.e. all views get clipped. @ide, is this a known issue?

mattds avatar Nov 11 '15 18:11 mattds

Yes there's an issue with clipping. Not sure what the fix is though.

ide avatar Nov 12 '15 04:11 ide

Hey @ide is there any update on a fix for the clipping? I see significant memory improvements when removeClippedSubviews is enabled, but with this clipping issue, can't really use it anywhere. I could probably implement a hackish workaround for my apps, but it's not wise or optimal.

deanmcpherson avatar Jan 12 '16 02:01 deanmcpherson

No updates, but not using it is untenable too.

ide avatar Jan 12 '16 03:01 ide

cc @nicklockwood :angel:

brentvatne avatar Feb 02 '16 05:02 brentvatne

+1

IlyasM avatar Jun 05 '16 13:06 IlyasM

https://facebook.github.io/react-native/docs/view.html#removeclippedsubviews has no explicit warning on it, now. (Perhaps it used to?)

Furthermore, it still has at least one additional bug: When dragging a child Animated.View from a parent view with this set on it out of, and back into the parent, the child vanishes, but continues responding to the gesture. The child then doesn't reappear until the parent is re-rendered. Removing this prop from the parent restores the expected functionality.

riggs avatar Jun 08 '16 00:06 riggs

Am I right in this only effecting RN on iOS? I'm playing with setting shouldRasterizeIOS to true only when a view is inactive (e.g. lower in the nav stack or on another tab) and it looks like it is working ok at the moment.

Something like:

shouldComponentUpdate(props) {
    let navDepth = this.props.navigator.getCurrentRoutes().length;
    if (navDepth !== this._navDepth) {
      this._navDepth = navDepth;
      return true;
    }
    return this.props.selected !== props.selected;
  }

render() {
return  <View style={{flex: 1}} shouldRasterizeIOS={this.props.selected || this._navDepth > 1}>
...
}

Still testing, will let you know if it breaks. Has anyone else worked around this yet?

deanmcpherson avatar Jun 17 '16 06:06 deanmcpherson

update doesn't work

deanmcpherson avatar Jun 20 '16 04:06 deanmcpherson

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/removeclippedsubviews-use-at-your-own-risk

Product Pains has been very useful in highlighting the top bugs and feature requests: https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

mkonicek avatar Oct 27 '16 21:10 mkonicek