From 25cd2c5d7b3ead4c6aebc4a9b7a7147b7f332d47 Mon Sep 17 00:00:00 2001 From: tychota Date: Fri, 16 Dec 2016 12:21:44 -0800 Subject: [PATCH] Deprecate RecyclerViewBackedScrollView Summary: cc brentvatne potential reviewers mkonicek and kmagiera **Motivation for making this change.** The previous PR was closed : #11095 but the followup actions was never done I reopened a really similar one so it get merged RecyclerView is no more used at Facebook (according to previous PR) According to brentvatne, their were two motivations for RecyclerView: * ListView with ScrollView component used to bounce back on row insert, but this is now fixed * This made possible to implement certain performance improvements, but the maintenance cost was not worth the risk With RN 0.37, the actual code in React Native make the app crash: - see #10560 I spend one hour investigating this and did also require brent time at exponent slack. I think other people are struggling too. **Test plan** screen shot 2016-12-13 at 23 42 22 **Code formatting** The Closes https://github.com/facebook/react-native/pull/11445 Differential Revision: D4340640 Pulled By: mkonicek fbshipit-source-id: 64c5cf060f2eb035d4d6199b30f0e73afc520180 --- .../RecyclerViewBackedScrollView.android.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/ScrollView/RecyclerViewBackedScrollView.android.js b/Libraries/Components/ScrollView/RecyclerViewBackedScrollView.android.js index cc7246daf..b86a82f90 100644 --- a/Libraries/Components/ScrollView/RecyclerViewBackedScrollView.android.js +++ b/Libraries/Components/ScrollView/RecyclerViewBackedScrollView.android.js @@ -16,7 +16,13 @@ var requireNativeComponent = require('requireNativeComponent'); var INNERVIEW = 'InnerView'; /** - * Wrapper around android native recycler view. + * RecyclerViewBackedScrollView is DEPRECATED and will be removed from + * React Native. + * Please use a `ListView` which has `removeClippedSubviews` enabled by + * default so that rows that are out of sight are automatically + * detached from the view hierarchy. + * + * Wrapper around Android native recycler view. * * It simply renders rows passed as children in a separate recycler view cells * similarly to how `ScrollView` is doing it. Thanks to the fact that it uses @@ -58,6 +64,13 @@ var RecyclerViewBackedScrollView = React.createClass({ mixins: [ScrollResponder.Mixin], + componentWillMount: function() { + console.warn( + 'RecyclerViewBackedScrollView is DEPRECATED and will be removed from React Native. ' + + 'Please use a ListView which has removeClippedSubviews enabled by default so that ' + + 'rows that are out of sight are automatically detached from the view hierarchy.') + }, + getInitialState: function() { return this.scrollResponderMixinGetInitialState(); },