From ffd7195543d883c7447de61ebbd8afb494576f63 Mon Sep 17 00:00:00 2001 From: Victor Calvello Date: Mon, 5 Nov 2018 13:55:46 -0800 Subject: [PATCH] Remove unused styles (#22083) Summary: Removes unused styles. NOTE: Lint rule `react-native/no-unused-styles` not added because of custom lint rule internally at Facebook that does this. Pull Request resolved: https://github.com/facebook/react-native/pull/22083 Differential Revision: D12929443 Pulled By: TheSavior fbshipit-source-id: d42b0be3db745e445447e65df3b78b61f53e4229 --- Libraries/Inspector/BoxInspector.js | 6 -- Libraries/Inspector/StyleInspector.js | 5 -- RNTester/js/AssetScaledImageExample.js | 4 -- RNTester/js/CameraRollView.js | 7 -- RNTester/js/ImageCapInsetsExample.js | 6 -- RNTester/js/LayoutAnimationExample.js | 3 - RNTester/js/LinkingExample.js | 6 -- RNTester/js/ListViewPagingExample.js | 7 -- .../js/PermissionsExampleAndroid.android.js | 4 -- RNTester/js/PointerEventsExample.js | 3 - RNTester/js/RNTesterBlock.js | 10 --- RNTester/js/SliderExample.js | 4 -- RNTester/js/StatusBarExample.js | 5 -- RNTester/js/TextInputExample.ios.js | 10 --- RNTester/js/TouchableExample.js | 4 -- RNTester/js/WebViewExample.js | 4 -- .../js/SubviewsClippingTestModule.js | 71 ++++++++++++------- .../src/androidTest/js/UIManagerTestModule.js | 7 -- 18 files changed, 44 insertions(+), 122 deletions(-) diff --git a/Libraries/Inspector/BoxInspector.js b/Libraries/Inspector/BoxInspector.js index 05b0580c635b2a..6097402a91c0c2 100644 --- a/Libraries/Inspector/BoxInspector.js +++ b/Libraries/Inspector/BoxInspector.js @@ -87,12 +87,6 @@ const styles = StyleSheet.create({ textAlign: 'left', top: -3, }, - buffer: { - fontSize: 10, - color: 'yellow', - flex: 1, - textAlign: 'center', - }, innerText: { color: 'yellow', fontSize: 12, diff --git a/Libraries/Inspector/StyleInspector.js b/Libraries/Inspector/StyleInspector.js index c902c9d3805f07..bb9f9abf6e2e10 100644 --- a/Libraries/Inspector/StyleInspector.js +++ b/Libraries/Inspector/StyleInspector.js @@ -53,11 +53,6 @@ const styles = StyleSheet.create({ container: { flexDirection: 'row', }, - row: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-around', - }, attr: { fontSize: 10, color: '#ccc', diff --git a/RNTester/js/AssetScaledImageExample.js b/RNTester/js/AssetScaledImageExample.js index 8a70b61c62f978..fb50653a1de54f 100644 --- a/RNTester/js/AssetScaledImageExample.js +++ b/RNTester/js/AssetScaledImageExample.js @@ -57,10 +57,6 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignSelf: 'center', }, - textColumn: { - flex: 1, - flexDirection: 'column', - }, imageWide: { borderWidth: 1, borderColor: 'black', diff --git a/RNTester/js/CameraRollView.js b/RNTester/js/CameraRollView.js index 42480ee292c342..159edb7d8e992b 100644 --- a/RNTester/js/CameraRollView.js +++ b/RNTester/js/CameraRollView.js @@ -259,16 +259,9 @@ const styles = StyleSheet.create({ flexDirection: 'row', flex: 1, }, - url: { - fontSize: 9, - marginBottom: 14, - }, image: { margin: 4, }, - info: { - flex: 1, - }, container: { flex: 1, }, diff --git a/RNTester/js/ImageCapInsetsExample.js b/RNTester/js/ImageCapInsetsExample.js index ae122fe0271c20..546c639577da8f 100644 --- a/RNTester/js/ImageCapInsetsExample.js +++ b/RNTester/js/ImageCapInsetsExample.js @@ -57,17 +57,11 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', }, - horizontal: { - flexDirection: 'row', - }, storyBackground: { width: 250, height: 150, borderWidth: 1, }, - text: { - fontSize: 13.5, - }, }); module.exports = ImageCapInsetsExample; diff --git a/RNTester/js/LayoutAnimationExample.js b/RNTester/js/LayoutAnimationExample.js index 6b8c0272e63bba..184c3d5b29cfaa 100644 --- a/RNTester/js/LayoutAnimationExample.js +++ b/RNTester/js/LayoutAnimationExample.js @@ -156,9 +156,6 @@ const styles = StyleSheet.create({ padding: 10, marginBottom: 10, }, - buttonText: { - fontSize: 16, - }, viewContainer: { flex: 1, flexDirection: 'row', diff --git a/RNTester/js/LinkingExample.js b/RNTester/js/LinkingExample.js index 89ac48ca8320e5..318341fbe6d425 100644 --- a/RNTester/js/LinkingExample.js +++ b/RNTester/js/LinkingExample.js @@ -65,12 +65,6 @@ class IntentAndroidExample extends React.Component { } const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: 'white', - padding: 10, - paddingTop: 30, - }, button: { padding: 10, backgroundColor: '#3B5998', diff --git a/RNTester/js/ListViewPagingExample.js b/RNTester/js/ListViewPagingExample.js index a19e3afd040f66..8c81d62cb9ee14 100644 --- a/RNTester/js/ListViewPagingExample.js +++ b/RNTester/js/ListViewPagingExample.js @@ -223,13 +223,6 @@ const styles = StyleSheet.create({ color: 'white', paddingHorizontal: 8, }, - rowText: { - color: '#888888', - }, - thumbText: { - fontSize: 20, - color: '#888888', - }, buttonContents: { flexDirection: 'row', justifyContent: 'center', diff --git a/RNTester/js/PermissionsExampleAndroid.android.js b/RNTester/js/PermissionsExampleAndroid.android.js index 285b2827f31fdd..b624514114c728 100644 --- a/RNTester/js/PermissionsExampleAndroid.android.js +++ b/RNTester/js/PermissionsExampleAndroid.android.js @@ -119,10 +119,6 @@ const styles = StyleSheet.create({ flex: 1, backgroundColor: 'white', }, - singleLine: { - fontSize: 16, - padding: 4, - }, text: { margin: 10, }, diff --git a/RNTester/js/PointerEventsExample.js b/RNTester/js/PointerEventsExample.js index 73552838d1527d..4c9d8fa15c9394 100644 --- a/RNTester/js/PointerEventsExample.js +++ b/RNTester/js/PointerEventsExample.js @@ -230,9 +230,6 @@ const styles = StyleSheet.create({ borderColor: '#f0f0f0', backgroundColor: '#f9f9f9', }, - bottomSpacer: { - marginBottom: 100, - }, }); exports.framework = 'React'; diff --git a/RNTester/js/RNTesterBlock.js b/RNTester/js/RNTesterBlock.js index 483d1b68da24a1..6999668e6ac78b 100644 --- a/RNTester/js/RNTesterBlock.js +++ b/RNTester/js/RNTesterBlock.js @@ -69,16 +69,6 @@ const styles = StyleSheet.create({ descriptionText: { fontSize: 14, }, - disclosure: { - position: 'absolute', - top: 0, - right: 0, - padding: 10, - }, - disclosureIcon: { - width: 12, - height: 8, - }, children: { margin: 10, }, diff --git a/RNTester/js/SliderExample.js b/RNTester/js/SliderExample.js index 22f0da2f02f36a..e4cb899d810f7b 100644 --- a/RNTester/js/SliderExample.js +++ b/RNTester/js/SliderExample.js @@ -69,10 +69,6 @@ class SlidingCompleteExample extends React.Component< } const styles = StyleSheet.create({ - slider: { - height: 10, - margin: 10, - }, text: { fontSize: 14, textAlign: 'center', diff --git a/RNTester/js/StatusBarExample.js b/RNTester/js/StatusBarExample.js index 58b87ab53f372e..dece8e23fa2ed6 100644 --- a/RNTester/js/StatusBarExample.js +++ b/RNTester/js/StatusBarExample.js @@ -518,11 +518,6 @@ const styles = StyleSheet.create({ backgroundColor: '#eeeeee', padding: 10, }, - title: { - marginTop: 16, - marginBottom: 8, - fontWeight: 'bold', - }, modalButton: { marginTop: 10, }, diff --git a/RNTester/js/TextInputExample.ios.js b/RNTester/js/TextInputExample.ios.js index 4de3908ea906d6..1240ba2d2893fa 100644 --- a/RNTester/js/TextInputExample.ios.js +++ b/RNTester/js/TextInputExample.ios.js @@ -490,9 +490,6 @@ class AutogrowingTextInputExample extends React.Component< } const styles = StyleSheet.create({ - page: { - paddingBottom: 300, - }, default: { borderWidth: StyleSheet.hairlineWidth, borderColor: '#0f0f0f', @@ -520,13 +517,6 @@ const styles = StyleSheet.create({ fontFamily: 'Cochin', height: 60, }, - multilineChild: { - width: 50, - height: 40, - position: 'absolute', - right: 5, - backgroundColor: 'red', - }, eventLabel: { margin: 3, fontSize: 12, diff --git a/RNTester/js/TouchableExample.js b/RNTester/js/TouchableExample.js index fe6aad74dcc046..34ddd72dec55fc 100644 --- a/RNTester/js/TouchableExample.js +++ b/RNTester/js/TouchableExample.js @@ -467,10 +467,6 @@ const styles = StyleSheet.create({ justifyContent: 'center', flexDirection: 'row', }, - icon: { - width: 24, - height: 24, - }, image: { width: 50, height: 50, diff --git a/RNTester/js/WebViewExample.js b/RNTester/js/WebViewExample.js index aee3a2adf2fb31..f973d816210ff2 100644 --- a/RNTester/js/WebViewExample.js +++ b/RNTester/js/WebViewExample.js @@ -362,10 +362,6 @@ const styles = StyleSheet.create({ color: 'white', fontSize: 13, }, - spinner: { - width: 20, - marginRight: 6, - }, buttons: { flexDirection: 'row', height: 30, diff --git a/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js b/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js index 2a1f56d3808284..307c0addb3eb4c 100644 --- a/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js +++ b/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js @@ -21,32 +21,31 @@ const ClippableView = requireNativeComponent('ClippableView'); class ClippingSample1 extends React.Component { render() { - const styles = sample1Styles; return ( @@ -90,32 +89,31 @@ const sample1Styles = StyleSheet.create({ class ClippingSample2 extends React.Component { render() { - const styles = sample2Styles; return ( @@ -164,17 +162,21 @@ const sample2Styles = StyleSheet.create({ class UpdatingSample1 extends React.Component { render() { - const styles = updating1Styles; const inner1Styles = [ - styles.inner1, + updating1Styles.inner1, {height: this.props.update1 ? 200 : 100}, ]; - const inner2Styles = [styles.inner2, {top: this.props.update2 ? 200 : 50}]; + + const inner2Styles = [ + updating1Styles.inner2, + {top: this.props.update2 ? 200 : 50}, + ]; + return ( @@ -210,15 +212,21 @@ const updating1Styles = StyleSheet.create({ class UpdatingSample2 extends React.Component { render() { - const styles = updating2Styles; - const outerStyles = [styles.outer, {height: this.props.update ? 200 : 100}]; + const outerStyles = [ + updating2Styles.outer, + {height: this.props.update ? 200 : 100}, + ]; + return ( - + ); @@ -242,11 +250,14 @@ const updating2Styles = StyleSheet.create({ class ScrollViewTest extends React.Component { render() { - const styles = scrollTestStyles; const children = []; for (let i = 0; i < 4; i++) { children[i] = ( - + ); } for (let i = 4; i < 6; i++) { @@ -254,11 +265,17 @@ class ScrollViewTest extends React.Component { children[i] = ( - - + + ); } @@ -266,7 +283,7 @@ class ScrollViewTest extends React.Component { return ( {children} diff --git a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js index 9690f6fce16e1c..5e0613c0d49e4f 100644 --- a/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +++ b/ReactAndroid/src/androidTest/js/UIManagerTestModule.js @@ -48,13 +48,6 @@ const FlexTestAppStyles = StyleSheet.create({ child: { flex: 1, }, - absolute: { - position: 'absolute', - top: 15, - left: 10, - width: 50, - height: 60, - }, bgRed: { backgroundColor: '#ff0000', },