Files
react-native/website/versioned_docs/0.32/touchablewithoutfeedback.md
T
2017-10-27 11:51:58 -07:00

18 lines
5.8 KiB
Markdown

---
id: version-0.32-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 the elements that
respond to press should have a visual feedback when touched. This is
one of the primary reason a "web" app doesn't feel "native".</p><blockquote><p><strong>NOTE</strong>: TouchableWithoutFeedback supports only one child</p><p>If you wish to have several child components, wrap them in a View.</p></blockquote></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">View.AccessibilityComponentType</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">View.AccessibilityTraits, [object Object]</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><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><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></div><p class="edit-page-block">You can <a target="_blank" href="https://github.com/facebook/react-native/blob/master/Libraries/Components/Touchable/TouchableWithoutFeedback.js">edit the content above on GitHub</a> and send us 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>