Minor tweaks

This commit is contained in:
Nicolas Gallagher
2016-07-07 22:22:37 -07:00
parent 1dc769bfb1
commit 37f2d78f34
3 changed files with 8 additions and 6 deletions

View File

@@ -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;

View File

@@ -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
]
}

View File

@@ -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 (
<Component
@@ -37,8 +38,8 @@ const createReactDOMComponent = ({
aria-label={accessibilityLabel}
aria-live={accessibilityLiveRegion}
data-testid={testID}
role={accessibilityRole}
type={accessibilityRole === 'button' ? 'button' : type}
role={role}
type={role === 'button' ? 'button' : type}
/>
)
}