mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-28 12:24:51 +08:00
Minor tweaks
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user