From 37f2d78f34efbd1a0c3b4a9a355a0baf35c70b9d Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Thu, 7 Jul 2016 22:22:37 -0700 Subject: [PATCH] Minor tweaks --- src/components/Touchable/TouchableOpacity.js | 2 +- src/components/View/index.js | 5 +++-- src/modules/createReactDOMComponent/index.js | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Touchable/TouchableOpacity.js b/src/components/Touchable/TouchableOpacity.js index 2f6c6d91..30c787ba 100644 --- a/src/components/Touchable/TouchableOpacity.js +++ b/src/components/Touchable/TouchableOpacity.js @@ -23,7 +23,7 @@ var Touchable = require('./Touchable'); var TouchableWithoutFeedback = require('./TouchableWithoutFeedback'); var ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); -var flattenStyle = require('../../apis/StyleSheet/flattenStyle'); +var flattenStyle = StyleSheet.flatten type Event = Object; diff --git a/src/components/View/index.js b/src/components/View/index.js index d17e497e..b060baa5 100644 --- a/src/components/View/index.js +++ b/src/components/View/index.js @@ -57,6 +57,8 @@ class View extends Component { const flattenedStyle = StyleSheet.flatten(style) const pointerEventsStyle = pointerEvents && { pointerEvents } + // 'View' needs to set 'flexShrink:0' only when there is no 'flex' or 'flexShrink' style provided + const needsFlexReset = flattenedStyle.flex == null && flattenedStyle.flexShrink == null const props = { ...other, @@ -73,8 +75,7 @@ class View extends Component { style: [ styles.initial, style, - // 'View' needs to use 'flexShrink' in its reset when there is no 'flex' style provided - (flattenedStyle.flex == null && flattenedStyle.flexShrink == null) && styles.flexReset, + needsFlexReset && styles.flexReset, pointerEventsStyle ] } diff --git a/src/modules/createReactDOMComponent/index.js b/src/modules/createReactDOMComponent/index.js index 1cdc98de..68a373e1 100644 --- a/src/modules/createReactDOMComponent/index.js +++ b/src/modules/createReactDOMComponent/index.js @@ -27,7 +27,8 @@ const createReactDOMComponent = ({ type, ...other }) => { - const Component = accessibilityRole && roleComponents[accessibilityRole] ? roleComponents[accessibilityRole] : component + const role = accessibilityRole + const Component = role && roleComponents[role] ? roleComponents[role] : component return ( ) }