From bbb6a0754ce4173e24d3c0b46a5350ff2a8690d3 Mon Sep 17 00:00:00 2001 From: Julius Lundang Date: Mon, 8 Oct 2018 23:19:24 -0700 Subject: [PATCH] =?UTF-8?q?=EF=BF=BD=20Improve=20Button=20component=20styl?= =?UTF-8?q?esheet;=20removed=20duplicate=20styles=20(#21535)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Updated Button component inspiration. Refactored code takes advantage of Platform Specific Code, as we want to re-use as much code as possible. 1. Import Button component 2. Button should work the same https://github.com/facebook/react-native/pull/19752 [GENERAL] [ENHANCEMENT] [Button] - Uses spread operator for platform specific code in creating styles Pull Request resolved: https://github.com/facebook/react-native/pull/21535 Differential Revision: D10248048 Pulled By: TheSavior fbshipit-source-id: 7260fa56f15b70b7c9499c8da418db7b2214b0dd --- Libraries/Components/Button.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index 2466bda61..93ee79035 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -150,21 +150,21 @@ const styles = StyleSheet.create({ borderRadius: 2, }, }), - text: Platform.select({ - ios: { - // iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/ - color: '#007AFF', - textAlign: 'center', - padding: 8, - fontSize: 18, - }, - android: { - color: 'white', - textAlign: 'center', - padding: 8, - fontWeight: '500', - }, - }), + text: { + textAlign: 'center', + padding: 8, + ...Platform.select({ + ios: { + // iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/ + color: '#007AFF', + fontSize: 18, + }, + android: { + color: 'white', + fontWeight: '500', + }, + }), + }, buttonDisabled: Platform.select({ ios: {}, android: {