mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-02 10:35:54 +00:00
Minor edits to View docs
This commit is contained in:
@@ -87,45 +87,80 @@ const ViewScreen = () =>
|
|||||||
<DocItem
|
<DocItem
|
||||||
name="hitSlop"
|
name="hitSlop"
|
||||||
typeInfo="?object"
|
typeInfo="?object"
|
||||||
description={
|
description={[
|
||||||
'This defines how far a touch event can start away from the view (in pixels). Typical interface guidelines recommend touch targets that are at least 30 - 40 points/density-independent pixels.\n\nFor example, if a touchable view has a height of `20` the touchable height can be extended to `40` with hitSlop.'
|
<AppText>
|
||||||
}
|
This defines how far a touch event can start away from the view (in pixels). Typical
|
||||||
|
interface guidelines recommend touch targets that are at least 30 - 40
|
||||||
|
points/density-independent pixels.
|
||||||
|
</AppText>,
|
||||||
|
<AppText>
|
||||||
|
For example, if a touchable view has a height of <Code>20</Code> the touchable height
|
||||||
|
can be extended to <Code>40</Code> with hitSlop.
|
||||||
|
</AppText>
|
||||||
|
]}
|
||||||
example={{
|
example={{
|
||||||
code: '<View hitSlop={{top: 10, bottom: 10, left: 0, right: 0}} />',
|
code: '<View hitSlop={{top: 10, bottom: 10, left: 0, right: 0}} />'
|
||||||
render: () => null
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="importantForAccessibility"
|
name="importantForAccessibility"
|
||||||
typeInfo="?enum('auto', 'no', 'no-hide-descendants', 'yes')"
|
typeInfo="?enum('auto', 'no', 'no-hide-descendants', 'yes')"
|
||||||
description={
|
description={[
|
||||||
'A value of `no` will remove the element from the tab flow.\n\nA value of `no-hide-descendants` will hide the element and its children from assistive technologies. (This is implemented using `aria-hidden`.)'
|
<AppText>
|
||||||
}
|
A value of <Code>no</Code> will remove the element from the tab flow.
|
||||||
|
</AppText>,
|
||||||
|
<AppText>
|
||||||
|
A value of <Code>no-hide-descendants</Code> will hide the element and its children from
|
||||||
|
assistive technologies. (This is implemented using 'aria-hidden'.)
|
||||||
|
</AppText>
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="onLayout"
|
name="onLayout"
|
||||||
typeInfo="?function"
|
typeInfo="?function"
|
||||||
description="Invoked on mount and layout changes with `{ nativeEvent: { layout: { x, y, width, height } } }`, where `x` and `y` are the offsets from the parent node."
|
description={
|
||||||
|
<AppText>
|
||||||
|
Invoked on mount and layout changes with{' '}
|
||||||
|
<Code>{'{ nativeEvent: { layout: { x, y, width, height } } }'}</Code>, where{' '}
|
||||||
|
<Code>x</Code> and <Code>y</Code> are the offsets from the parent node.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="onMoveShouldSetResponder"
|
name="onMoveShouldSetResponder"
|
||||||
typeInfo="?function => boolean"
|
typeInfo="?function => boolean"
|
||||||
description="Does this view want to "claim" touch responsiveness? This is called for every touch move on the `View` when it is not the responder."
|
description={
|
||||||
|
<AppText>
|
||||||
|
Does this view want to "claim" touch responsiveness? This is called for every touch move
|
||||||
|
on the <Code>View</Code> when it is not the responder.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="onMoveShouldSetResponderCapture"
|
name="onMoveShouldSetResponderCapture"
|
||||||
typeInfo="?function => boolean"
|
typeInfo="?function => boolean"
|
||||||
description="If a parent `View` wants to prevent a child `View` from becoming responder on a move, it should have this handler return `true`."
|
description={
|
||||||
|
<AppText>
|
||||||
|
If a parent <Code>View</Code> wants to prevent a child <Code>View</Code> from becoming
|
||||||
|
responder on a move, it should have this handler return <Code>true</Code>.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="onResponderGrant"
|
name="onResponderGrant"
|
||||||
typeInfo="?function"
|
typeInfo="?function"
|
||||||
description="The `View` is now responding to touch events. This is the time to highlight and show the user what is happening. For most touch interactions, you'll simply want to wrap your component in `TouchableHighlight` or `TouchableOpacity`."
|
description={
|
||||||
|
<AppText>
|
||||||
|
The <Code>View</Code> is now responding to touch events. This is the time to highlight
|
||||||
|
and show the user what is happening. For most touch interactions, you'll simply want to
|
||||||
|
wrap your component in <Code>TouchableHighlight</Code> or <Code>TouchableOpacity</Code>.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
@@ -137,7 +172,12 @@ const ViewScreen = () =>
|
|||||||
<DocItem
|
<DocItem
|
||||||
name="onResponderReject"
|
name="onResponderReject"
|
||||||
typeInfo="?function"
|
typeInfo="?function"
|
||||||
description="Another responder is already active and will not release it to the `View` asking to be the responder."
|
description={
|
||||||
|
<AppText>
|
||||||
|
Another responder is already active and will not release it to the <Code>View</Code>{' '}
|
||||||
|
asking to be the responder.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
@@ -149,13 +189,23 @@ const ViewScreen = () =>
|
|||||||
<DocItem
|
<DocItem
|
||||||
name="onResponderTerminate"
|
name="onResponderTerminate"
|
||||||
typeInfo="?function"
|
typeInfo="?function"
|
||||||
description="The responder has been taken from the `View`."
|
description={
|
||||||
|
<AppText>
|
||||||
|
The responder has been taken from the <Code>View</Code>.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="onResponderTerminationRequest"
|
name="onResponderTerminationRequest"
|
||||||
typeInfo="?function"
|
typeInfo="?function"
|
||||||
description="Some other `View` wants to become responder and is asking this `View` to release its responder. Returning `true` allows its release."
|
description={
|
||||||
|
<AppText>
|
||||||
|
Some other <Code>View</Code> wants to become responder and is asking this{' '}
|
||||||
|
<Code>View</Code> to release its responder. Returning <Code>true</Code> allows its
|
||||||
|
release.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
@@ -167,13 +217,26 @@ const ViewScreen = () =>
|
|||||||
<DocItem
|
<DocItem
|
||||||
name="onStartShouldSetResponderCapture"
|
name="onStartShouldSetResponderCapture"
|
||||||
typeInfo="?function => boolean"
|
typeInfo="?function => boolean"
|
||||||
description="If a parent `View` wants to prevent a child `View` from becoming the responder on a touch start, it should have this handler return `true`."
|
description={
|
||||||
|
<AppText>
|
||||||
|
If a parent <Code>View</Code> wants to prevent a child <Code>View</Code> from becoming
|
||||||
|
the responder on a touch start, it should have this handler return <Code>true</Code>.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
name="pointerEvents"
|
name="pointerEvents"
|
||||||
typeInfo="?enum('auto', 'box-only', 'box-none', 'none') = 'auto'"
|
typeInfo="?enum('auto', 'box-only', 'box-none', 'none') = 'auto'"
|
||||||
description="Controls whether the View can be the target of touch events. The enhanced `pointerEvents` modes provided are not part of the CSS spec, therefore, `pointerEvents` is excluded from `style`. `box-none` preserves pointer events on the element's children; `box-only` disables pointer events on the element's children"
|
description={
|
||||||
|
<AppText>
|
||||||
|
Controls whether the View can be the target of touch events. The enhanced{' '}
|
||||||
|
<Code>pointerEvents</Code> modes provided are not part of the CSS spec, therefore,{' '}
|
||||||
|
<Code>pointerEvents</Code> is excluded from <Code>style</Code>.
|
||||||
|
<Code>box-none</Code> preserves pointer events on the element's children;{' '}
|
||||||
|
<Code>box-only</Code> disables pointer events on the element's children.
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
example={{
|
example={{
|
||||||
render: () => <PropPointerEvents />
|
render: () => <PropPointerEvents />
|
||||||
}}
|
}}
|
||||||
@@ -188,21 +251,29 @@ const ViewScreen = () =>
|
|||||||
<DocItem
|
<DocItem
|
||||||
name="testID"
|
name="testID"
|
||||||
typeInfo="?string"
|
typeInfo="?string"
|
||||||
description="Used to locate this view in end-to-end tests. The test ID is rendered to a `data-testid` DOM attribute"
|
description="Used to locate this view in end-to-end tests. The test ID is rendered to a 'data-testid' DOM attribute"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
label="compat"
|
label="compat"
|
||||||
name="accessibilityComponentType"
|
name="accessibilityComponentType"
|
||||||
typeInfo="?enum(roles)"
|
typeInfo="?enum(roles)"
|
||||||
description="(For compatibility with React Native. Equivalent to "accessibilityRole".)"
|
description={
|
||||||
|
<AppText>
|
||||||
|
(For compatibility with React Native. Equivalent to <Code>accessibilityRole</Code>.)
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DocItem
|
<DocItem
|
||||||
label="compat"
|
label="compat"
|
||||||
name="accessibilityTraits"
|
name="accessibilityTraits"
|
||||||
typeInfo="?enum(roles) | Array<role>"
|
typeInfo="?enum(roles) | Array<role>"
|
||||||
description="(For compatibility with React Native. Equivalent to "accessibilityRole".)"
|
description={
|
||||||
|
<AppText>
|
||||||
|
(For compatibility with React Native. Equivalent to <Code>accessibilityRole</Code>.)
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,7 @@ const DocItem = ({ description, example = {}, name, typeInfo, label }) =>
|
|||||||
</AppText>}
|
</AppText>}
|
||||||
{description &&
|
{description &&
|
||||||
<View style={styles.description}>
|
<View style={styles.description}>
|
||||||
{Array.isArray(description)
|
{insertBetween(() => <Divider key={Math.random()} />, React.Children.toArray(description))}
|
||||||
? insertBetween(() => <Divider key={Math.random()} />, description)
|
|
||||||
: <AppText>
|
|
||||||
{description}
|
|
||||||
</AppText>}
|
|
||||||
</View>}
|
</View>}
|
||||||
{(example.render || example.code) &&
|
{(example.render || example.code) &&
|
||||||
<View style={styles.renderBox}>
|
<View style={styles.renderBox}>
|
||||||
|
|||||||
Reference in New Issue
Block a user