From bd4bf8ca39c187c7aaadcaf5d27d411a68e60a6f Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 18 Jan 2016 13:56:19 -0800 Subject: [PATCH] Fix a crash in ViewPagerAndroid when passing a null child Summary: Fixes #5195 Closes https://github.com/facebook/react-native/pull/5236 Reviewed By: svcscm Differential Revision: D2819197 Pulled By: androidtrunkagent fb-gh-sync-id: cea451802c659512f64c1e90905647b8fbe4490b --- Libraries/Components/ViewPager/ViewPagerAndroid.android.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js index e5708d5eb..360f847a8 100644 --- a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js +++ b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js @@ -112,6 +112,9 @@ var ViewPagerAndroid = React.createClass({ // will handle positioning of elements, so it's not important to offset // them correctly. return React.Children.map(this.props.children, function(child) { + if (!child) { + return null; + } var newProps = { ...child.props, style: [child.props.style, {