mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
19 lines
6.3 KiB
Markdown
19 lines
6.3 KiB
Markdown
---
|
|
id: version-0.50-touchablewithoutfeedback
|
|
title: touchablewithoutfeedback
|
|
original_id: touchablewithoutfeedback
|
|
---
|
|
<a id="content"></a><h1><a class="anchor" name="touchablewithoutfeedback"></a>TouchableWithoutFeedback <a class="hash-link" href="docs/touchablewithoutfeedback.html#touchablewithoutfeedback">#</a></h1><div><div><p>Do not use unless you have a very good reason. All elements that
|
|
respond to press should have a visual feedback when touched.</p><p>TouchableWithoutFeedback supports only one child.
|
|
If you wish to have several child components, wrap them in a View.</p></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/touchablewithoutfeedback.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="accessibilitycomponenttype"></a>accessibilityComponentType?: <span class="propType">AccessibilityComponentTypes</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#accessibilitycomponenttype">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="accessibilitytraits"></a>accessibilityTraits?: <span class="propType"><span><span>AccessibilityTraits, </span><span>[AccessibilityTraits]</span></span></span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#accessibilitytraits">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="accessible"></a>accessible?: <span class="propType">bool</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#accessible">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="delaylongpress"></a>delayLongPress?: <span class="propType">number</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#delaylongpress">#</a></h4><div><p>Delay in ms, from onPressIn, before onLongPress is called.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="delaypressin"></a>delayPressIn?: <span class="propType">number</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#delaypressin">#</a></h4><div><p>Delay in ms, from the start of the touch, before onPressIn is called.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="delaypressout"></a>delayPressOut?: <span class="propType">number</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#delaypressout">#</a></h4><div><p>Delay in ms, from the release of the touch, before onPressOut is called.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="disabled"></a>disabled?: <span class="propType">bool</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#disabled">#</a></h4><div><p>If true, disable all interactions for this component.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="hitslop"></a>hitSlop?: <span class="propType">{top: number, left: number, bottom: number, right: number}</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#hitslop">#</a></h4><div><p>This defines how far your touch can start away from the button. This is
|
|
added to <code>pressRetentionOffset</code> when moving off of the button.
|
|
<strong> NOTE </strong>
|
|
The touch area never extends past the parent view bounds and the Z-index
|
|
of sibling views always takes precedence if a touch hits two overlapping
|
|
views.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onlayout"></a>onLayout?: <span class="propType">function</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#onlayout">#</a></h4><div><p>Invoked on mount and layout changes with</p><p> <code>{nativeEvent: {layout: {x, y, width, height}}}</code></p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onlongpress"></a>onLongPress?: <span class="propType">function</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#onlongpress">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onpress"></a>onPress?: <span class="propType">function</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#onpress">#</a></h4><div><p>Called when the touch is released, but not if cancelled (e.g. by a scroll
|
|
that steals the responder lock).</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onpressin"></a>onPressIn?: <span class="propType">function</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#onpressin">#</a></h4><div><p>Called as soon as the touchable element is pressed and invoked even before onPress.
|
|
This can be useful when making network requests.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onpressout"></a>onPressOut?: <span class="propType">function</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#onpressout">#</a></h4><div><p>Called as soon as the touch is released even before onPress.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="pressretentionoffset"></a>pressRetentionOffset?: <span class="propType">{top: number, left: number, bottom: number, right: number}</span> <a class="hash-link" href="docs/touchablewithoutfeedback.html#pressretentionoffset">#</a></h4><div><p>When the scroll view is disabled, this defines how far your touch may
|
|
move off of the button, before deactivating the button. Once deactivated,
|
|
try moving it back and you'll see that the button is once again
|
|
reactivated! Move it back and forth several times while the scroll view
|
|
is disabled. Ensure you pass in a constant to reduce memory allocations.</p></div></div></div><span><h3><a class="anchor" name="type-definitions"></a>Type Definitions <a class="hash-link" href="docs/touchablewithoutfeedback.html#type-definitions">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="event"></a>Event <a class="hash-link" href="docs/touchablewithoutfeedback.html#event">#</a></h4><strong>Type:</strong><br>Object</div></div></span></div><p class="edit-page-block"><a target="_blank" href="https://github.com/facebook/react-native/blob/master/Libraries/Components/Touchable/TouchableWithoutFeedback.js">Improve this page</a> by sending a pull request!</p><div class="docs-prevnext"><a class="docs-prev" href="docs/touchableopacity.html#content">← Prev</a><a class="docs-next" href="docs/view.html#content">Next →</a></div> |