removed flex: 1 from SwipeableRow styles to make compatible with 0.39 changes

Summary:
React Native 0.39 introduced a breaking change through a new C-based implementation of css-layout. Developers were encouraged to remove unnecessary flex: 1 styles where no longer required to address any resulting layout issues.

The SwipeableListView has not yet been updated to reflect this change. Specifically, SwipeableRow still sets flex: 1 even though it shouldn't.

This was resulting in a rendering issue for folks when they upgraded to React Native 0.39 and used SwipeableListView that caused significant initial flickering when rendering a SwipeableListView. The solution was simply to remove flex: 1 from the SwipeableRow implementation.

This small change removes flex: 1 to resolve this issue.

Suggested reviewer (initial SwipeableListView contributor): fred2028

See this issue for more details: https://github.com/facebook/react-native/issues/11441
Closes https://github.com/facebook/react-native/pull/11521

Differential Revision: D4532562

Pulled By: lacker

fbshipit-source-id: 5c2907186d00481a731bd81794947a019465a031
This commit is contained in:
Sachin Rekhi 2017-02-08 15:54:51 -08:00 committed by Facebook Github Bot
parent c3b25c9059
commit 2fa7c93c1c
1 changed files with 1 additions and 9 deletions

View File

@ -189,12 +189,7 @@ const SwipeableRow = React.createClass({
const swipeableView = ( const swipeableView = (
<Animated.View <Animated.View
onLayout={this._onSwipeableViewLayout} onLayout={this._onSwipeableViewLayout}
style={[ style={{transform: [{translateX: this.state.currentLeft}]}}>
styles.swipeableContainer,
{
transform: [{translateX: this.state.currentLeft}],
},
]}>
{this.props.children} {this.props.children}
</Animated.View> </Animated.View>
); );
@ -394,9 +389,6 @@ const styles = StyleSheet.create({
right: 0, right: 0,
top: 0, top: 0,
}, },
swipeableContainer: {
flex: 1,
},
}); });
module.exports = SwipeableRow; module.exports = SwipeableRow;