From 10d80b8a78c8f11788e1d861d83fbda2b7e25729 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Fri, 5 Jul 2019 02:34:53 -0700 Subject: [PATCH] Move inline static styles at VirtualizedList to StyleSheet.create (#25501) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: I know StyleSheet.create doesn’t do anything special on react-native yet but it does on react-native-web and possibly other targets. This small change is mainly so react-native-web don’t need to keep making this change on their code base when updating the rn version. ## Changelog [Internal] [Changed] - Move inline static styles at VirtualizedList to StyleSheet.create Pull Request resolved: https://github.com/facebook/react-native/pull/25501 Test Plan: It’s basically the same code, just moved. Also it’s the same change that it’s on react-native-web project: https://github.com/necolas/react-native-web/blob/45f94eb43daa3cb3d7fae0295877345a176c04c4/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js#L1650-L1654 Differential Revision: D16130700 Pulled By: cpojer fbshipit-source-id: 20639e2e1a795ff4819c16af15569bf12759a62c --- Libraries/Lists/VirtualizedList.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 534e10783df..2abbfe27cda 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -1849,10 +1849,10 @@ class CellRenderer extends React.Component< ); const cellStyle = inversionStyle ? horizontal - ? [{flexDirection: 'row-reverse'}, inversionStyle] - : [{flexDirection: 'column-reverse'}, inversionStyle] + ? [styles.rowReverse, inversionStyle] + : [styles.columnReverse, inversionStyle] : horizontal - ? [{flexDirection: 'row'}, inversionStyle] + ? [styles.row, inversionStyle] : inversionStyle; if (!CellRendererComponent) { return ( @@ -1907,6 +1907,15 @@ const styles = StyleSheet.create({ horizontallyInverted: { transform: [{scaleX: -1}], }, + row: { + flexDirection: 'row', + }, + rowReverse: { + flexDirection: 'row-reverse', + }, + columnReverse: { + flexDirection: 'column-reverse', + }, debug: { flex: 1, },