Files
react-native/docs/0.60/touchablewithoutfeedback.html
2021-03-13 08:44:52 +00:00

53 lines
45 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.70">
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="React Native Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="React Native Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-41298772-2","auto"),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41298772-2"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-41298772-2",{})</script>
<link rel="search" type="application/opensearchdescription+xml" title="React Native" href="/opensearch.xml">
<link rel="icon" href="/img/pwa/manifest-icon-512.png">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#20232a">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#20232a">
<link rel="apple-touch-icon" href="/img/pwa/manifest-icon-512.png">
<link rel="mask-icon" href="/img/pwa/manifest-icon-512.png" color="#06bcee">
<meta name="msapplication-TileImage" href="/img/pwa/manifest-icon-512.png">
<meta name="msapplication-TileColor" content="#20232a">
<script src="https://cdn.jsdelivr.net/npm/focus-visible@5.2.0/dist/focus-visible.min.js" defer="defer"></script>
<script src="https://snack.expo.io/embed.js" defer="defer"></script><title data-react-helmet="true">TouchableWithoutFeedback · React Native</title><meta data-react-helmet="true" name="twitter:image:alt" content="Image for React Native"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="0.60"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-0.60"><meta data-react-helmet="true" property="og:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" property="og:title" content="TouchableWithoutFeedback · React Native"><meta data-react-helmet="true" name="description" content="Do not use unless you have a very good reason. All elements that respond to press should have a visual feedback when touched."><meta data-react-helmet="true" property="og:description" content="Do not use unless you have a very good reason. All elements that respond to press should have a visual feedback when touched."><meta data-react-helmet="true" property="og:url" content="https://reactnative.dev/docs/0.60/touchablewithoutfeedback"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link data-react-helmet="true" rel="canonical" href="https://reactnative.dev/docs/0.60/touchablewithoutfeedback"><link rel="stylesheet" href="/styles.f56da522.css">
<link rel="stylesheet" href="/main.3de2b5ef.css">
<link rel="preload" href="/styles.9d29dd5a.js" as="script">
<link rel="preload" href="/runtime~main.b00a5634.js" as="script">
<link rel="preload" href="/main.4103a08e.js" as="script">
<link rel="preload" href="/1.7a6193e2.js" as="script">
<link rel="preload" href="/2.9b40dc51.js" as="script">
<link rel="preload" href="/1089.caa7a648.js" as="script">
<link rel="preload" href="/ae345423.7c9998ff.js" as="script">
<link rel="preload" href="/17896441.b54b3e3c.js" as="script">
<link rel="preload" href="/773809e7.7032ea64.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<nav aria-label="Skip navigation links"><button type="button" tabindex="0" class="skipToContent_3aLp">Skip to main content</button></nav><nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg aria-label="Menu" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a><div class="navbar__item dropdown dropdown--hoverable dropdown--left"><a class="navbar__item navbar__link" href="/docs/0.60/getting-started">0.60</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/next/touchablewithoutfeedback">Next</a></li><li><a class="dropdown__link" href="/docs/touchablewithoutfeedback">0.64</a></li><li><a class="dropdown__link" href="/docs/0.63/touchablewithoutfeedback">0.63</a></li><li><a class="dropdown__link" href="/docs/0.62/touchablewithoutfeedback">0.62</a></li><li><a class="dropdown__link" href="/docs/0.61/touchablewithoutfeedback">0.61</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/docs/0.60/touchablewithoutfeedback">0.60</a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/docs/0.60/getting-started">Docs</a><a class="navbar__item navbar__link navbar__link--active" href="/docs/0.60/components-and-apis">Components</a><a class="navbar__item navbar__link" href="/docs/0.60/accessibilityinfo">API</a><a class="navbar__item navbar__link" href="/help">Community</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar-github-link" aria-label="GitHub repository"></a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_Bh6k"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_1UDy">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_1UDy">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span></button></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link navbar__link--active" href="/docs/0.60/components-and-apis">Components</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/accessibilityinfo">API</a></li><li class="menu__list-item"><a class="menu__link" href="/help">Community</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a role="button" class="menu__link menu__link--sublist">Versions</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/next/touchablewithoutfeedback">Next</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/touchablewithoutfeedback">0.64</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.63/touchablewithoutfeedback">0.63</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.62/touchablewithoutfeedback">0.62</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.61/touchablewithoutfeedback">0.61</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/0.60/touchablewithoutfeedback">0.60</a></li><li class="menu__list-item"><a class="menu__link" href="/versions">All versions</a></li></ul></li><li class="menu__list-item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="menu__link navbar-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_1mVJ"><div class="docSidebarContainer_uPTz" role="complementary"><div class="sidebar_M-Lc"><div class="menu menu--responsive thin-scrollbar menu_tgpy"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_1e05" width="24" height="24" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">Components</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/components-and-apis">Components and APIs</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/activityindicator">ActivityIndicator</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/button">Button</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/datepickerios">DatePickerIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/drawerlayoutandroid">DrawerLayoutAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/flatlist">FlatList</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/image">Image</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/imagebackground">ImageBackground</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/inputaccessoryview">InputAccessoryView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/keyboardavoidingview">KeyboardAvoidingView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/maskedviewios">🚧 MaskedViewIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/modal">Modal</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/picker">Picker</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/pickerios">PickerIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/progressbarandroid">ProgressBarAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/progressviewios">ProgressViewIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/refreshcontrol">RefreshControl</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/safeareaview">SafeAreaView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/scrollview">ScrollView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/sectionlist">SectionList</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/segmentedcontrolios">SegmentedControlIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/slider">Slider</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/statusbar">StatusBar</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/switch">Switch</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/tabbarios">TabBarIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/tabbarios-item">TabBarIOS.Item</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/text">Text</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/textinput">TextInput</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/toolbarandroid">ToolbarAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/touchablehighlight">TouchableHighlight</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/touchablenativefeedback">TouchableNativeFeedback</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/touchableopacity">TouchableOpacity</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/0.60/touchablewithoutfeedback">TouchableWithoutFeedback</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/view">View</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/viewpagerandroid">🚧 ViewPagerAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/virtualizedlist">VirtualizedList</a></li></ul></li></ul></div></div></div><main class="docMainContainer_1zi2"><div class="container padding-vert--lg docItemWrapper_1hMI"><div class="row"><div class="col docItemCol_2AGf"><div class="alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for React Native <strong>0.60</strong>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <strong><a href="/docs/touchablewithoutfeedback">latest version</a></strong> (0.64).</div></div><div class="docItemContainer_1tAC"><article><div><span class="badge badge--secondary">Version: 0.60</span></div><header><h1 class="docTitle_cWlf">TouchableWithoutFeedback</h1></header><div class="markdown"><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><code>TouchableWithoutFeedback</code> supports only one child. If you wish to have several child components, wrap them in a View. Importantly, <code>TouchableWithoutFeedback</code> works by cloning its child and applying responder props to it. It is therefore required that any intermediary components pass through those props to the underlying React Native component.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="usage-example"></a>Usage Example<a class="hash-link" href="#usage-example" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-jsx codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token keyword" style="color:#c5a5c5">function</span><span class="token plain"> </span><span class="token function" style="color:#79b6f2">MyComponent</span><span class="token punctuation" style="color:#657b83">(</span><span class="token parameter">props</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">return</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">View</span><span class="token tag" style="color:#fc929e"> </span><span class="token tag spread punctuation" style="color:#657b83">{</span><span class="token tag spread punctuation" style="color:#657b83">...</span><span class="token tag spread attr-value" style="color:#8dc891">props</span><span class="token tag spread punctuation" style="color:#657b83">}</span><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">style</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript" style="color:#fc929e"> flex</span><span class="token tag script language-javascript operator" style="color:#fc929e">:</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript number" style="color:#5a9bcf">1</span><span class="token tag script language-javascript punctuation" style="color:#657b83">,</span><span class="token tag script language-javascript" style="color:#fc929e"> backgroundColor</span><span class="token tag script language-javascript operator" style="color:#fc929e">:</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript string" style="color:#8dc891">&#x27;#fff&#x27;</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">Text</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token plain">My Component</span><span class="token tag punctuation" style="color:#657b83">&lt;/</span><span class="token tag class-name" style="color:#fac863">Text</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;/</span><span class="token tag class-name" style="color:#fac863">View</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">TouchableWithoutFeedback</span><span class="token tag" style="color:#fc929e"> </span><span class="token tag attr-name" style="color:#c5a5c5">onPress</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:#657b83">=</span><span class="token tag script language-javascript punctuation" style="color:#657b83">{</span><span class="token tag script language-javascript punctuation" style="color:#657b83">(</span><span class="token tag script language-javascript punctuation" style="color:#657b83">)</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript operator" style="color:#fc929e">=&gt;</span><span class="token tag script language-javascript" style="color:#fc929e"> </span><span class="token tag script language-javascript function" style="color:#79b6f2">alert</span><span class="token tag script language-javascript punctuation" style="color:#657b83">(</span><span class="token tag script language-javascript string" style="color:#8dc891">&#x27;Pressed!&#x27;</span><span class="token tag script language-javascript punctuation" style="color:#657b83">)</span><span class="token tag script language-javascript punctuation" style="color:#657b83">}</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#657b83">&lt;</span><span class="token tag class-name" style="color:#fac863">MyComponent</span><span class="token tag" style="color:#fc929e"> </span><span class="token tag punctuation" style="color:#657b83">/&gt;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token tag punctuation" style="color:#657b83">&lt;/</span><span class="token tag class-name" style="color:#fac863">TouchableWithoutFeedback</span><span class="token tag punctuation" style="color:#657b83">&gt;</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><hr><h1><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="reference"></a>Reference<a class="hash-link" href="#reference" title="Direct link to heading">#</a></h1><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="props"></a>Props<a class="hash-link" href="#props" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilityignoresinvertcolors"></a><code>accessibilityIgnoresInvertColors</code><a class="hash-link" href="#accessibilityignoresinvertcolors" title="Direct link to heading">#</a></h3><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>Boolean</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessible"></a><code>accessible</code><a class="hash-link" href="#accessible" title="Direct link to heading">#</a></h3><p>When <code>true</code>, indicates that the view is an accessibility element. By default, all the touchable elements are accessible.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilitylabel"></a><code>accessibilityLabel</code><a class="hash-link" href="#accessibilitylabel" title="Direct link to heading">#</a></h3><p>Overrides the text that&#x27;s read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the <code>Text</code> nodes separated by space.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilityhint"></a><code>accessibilityHint</code><a class="hash-link" href="#accessibilityhint" title="Direct link to heading">#</a></h3><p>An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not clear from the accessibility label.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilityrole"></a><code>accessibilityRole</code><a class="hash-link" href="#accessibilityrole" title="Direct link to heading">#</a></h3><p><code>accessibilityRole</code> communicates the purpose of a component to the user of an assistive technology.</p><p><code>accessibilityRole</code> can be one of the following:</p><ul><li><code>&#x27;none&#x27;</code> - Used when the element has no role.</li><li><code>&#x27;button&#x27;</code> - Used when the element should be treated as a button.</li><li><code>&#x27;link&#x27;</code> - Used when the element should be treated as a link.</li><li><code>&#x27;search&#x27;</code> - Used when the text field element should also be treated as a search field.</li><li><code>&#x27;image&#x27;</code> - Used when the element should be treated as an image. Can be combined with button or link, for example.</li><li><code>&#x27;keyboardkey&#x27;</code> - Used when the element acts as a keyboard key.</li><li><code>&#x27;text&#x27;</code> - Used when the element should be treated as static text that cannot change.</li><li><code>&#x27;adjustable&#x27;</code> - Used when an element can be &quot;adjusted&quot; (e.g. a slider).</li><li><code>&#x27;imagebutton&#x27;</code> - Used when the element should be treated as a button and is also an image.</li><li><code>&#x27;header&#x27;</code> - Used when an element acts as a header for a content section (e.g. the title of a navigation bar).</li><li><code>&#x27;summary&#x27;</code> - Used when an element can be used to provide a quick summary of current conditions in the app when the app first launches.</li><li><code>&#x27;alert&#x27;</code> - Used when an element contains important text to be presented to the user.</li><li><code>&#x27;checkbox&#x27;</code> - Used when an element represents a checkbox which can be checked, unchecked, or have mixed checked state.</li><li><code>&#x27;combobox&#x27;</code> - Used when an element represents a combo box, which allows the user to select among several choices.</li><li><code>&#x27;menu&#x27;</code> - Used when the component is a menu of choices.</li><li><code>&#x27;menubar&#x27;</code> - Used when a component is a container of multiple menus.</li><li><code>&#x27;menuitem&#x27;</code> - Used to represent an item within a menu.</li><li><code>&#x27;progressbar&#x27;</code> - Used to represent a component which indicates progress of a task.</li><li><code>&#x27;radio&#x27;</code> - Used to represent a radio button.</li><li><code>&#x27;radiogroup&#x27;</code> - Used to represent a group of radio buttons.</li><li><code>&#x27;scrollbar&#x27;</code> - Used to represent a scroll bar.</li><li><code>&#x27;spinbutton&#x27;</code> - Used to represent a button which opens a list of choices.</li><li><code>&#x27;switch&#x27;</code> - Used to represent a switch which can be turned on and off.</li><li><code>&#x27;tab&#x27;</code> - Used to represent a tab.</li><li><code>&#x27;tablist&#x27;</code> - Used to represent a list of tabs.</li><li><code>&#x27;timer&#x27;</code> - Used to represent a timer.</li><li><code>&#x27;toolbar&#x27;</code> - Used to represent a tool bar (a container of action buttons or components).</li></ul><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilitystate"></a><code>accessibilityState</code><a class="hash-link" href="#accessibilitystate" title="Direct link to heading">#</a></h3><p>Describes the current state of a component to the user of an assistive technology.</p><p>See the <a href="/docs/0.60/accessibility#accessibilitystate-ios-android">Accessibility guide</a> for more information.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>object: {disabled: bool, selected: bool, checked: bool or &#x27;mixed&#x27;, busy: bool, expanded: bool}</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="accessibilityactions"></a><code>accessibilityActions</code><a class="hash-link" href="#accessibilityactions" title="Direct link to heading">#</a></h3><p>Accessibility actions allow an assistive technology to programmatically invoke the actions of a component. The <code>accessibilityActions</code> property should contain a list of action objects. Each action object should contain the field name and label.</p><p>See the <a href="/docs/0.60/accessibility#accessibility-actions">Accessibility guide</a> for more information.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>array</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onaccessibilityaction"></a><code>onAccessibilityAction</code><a class="hash-link" href="#onaccessibilityaction" title="Direct link to heading">#</a></h3><p>Invoked when the user performs the accessibility actions. The only argument to this function is an event containing the name of the action to perform.</p><p>See the <a href="/docs/0.60/accessibility#accessibility-actions">Accessibility guide</a> for more information.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="delaylongpress"></a><code>delayLongPress</code><a class="hash-link" href="#delaylongpress" title="Direct link to heading">#</a></h3><p>Delay in ms, from onPressIn, before onLongPress is called.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>number</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="delaypressin"></a><code>delayPressIn</code><a class="hash-link" href="#delaypressin" title="Direct link to heading">#</a></h3><p>Delay in ms, from the start of the touch, before onPressIn is called.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>number</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="delaypressout"></a><code>delayPressOut</code><a class="hash-link" href="#delaypressout" title="Direct link to heading">#</a></h3><p>Delay in ms, from the release of the touch, before onPressOut is called.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>number</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="disabled"></a><code>disabled</code><a class="hash-link" href="#disabled" title="Direct link to heading">#</a></h3><p>If true, disable all interactions for this component.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>bool</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="hitslop"></a><code>hitSlop</code><a class="hash-link" href="#hitslop" title="Direct link to heading">#</a></h3><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><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>object: {top: number, left: number, bottom: number, right: number}</td><td>No</td></tr></tbody></table><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onblur"></a><code>onBlur</code><a class="hash-link" href="#onblur" title="Direct link to heading">#</a></h3><p>Invoked when the item loses focus.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onfocus"></a><code>onFocus</code><a class="hash-link" href="#onfocus" title="Direct link to heading">#</a></h3><p>Invoked when the item receives focus.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onlayout"></a><code>onLayout</code><a class="hash-link" href="#onlayout" title="Direct link to heading">#</a></h3><p>Invoked on mount and layout changes with</p><p><code>{nativeEvent: {layout: {x, y, width, height}}}</code></p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onlongpress"></a><code>onLongPress</code><a class="hash-link" href="#onlongpress" title="Direct link to heading">#</a></h3><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onpress"></a><code>onPress</code><a class="hash-link" href="#onpress" title="Direct link to heading">#</a></h3><p>Called when the touch is released, but not if cancelled (e.g. by a scroll that steals the responder lock).</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onpressin"></a><code>onPressIn</code><a class="hash-link" href="#onpressin" title="Direct link to heading">#</a></h3><p>Called as soon as the touchable element is pressed and invoked even before onPress. This can be useful when making network requests.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="onpressout"></a><code>onPressOut</code><a class="hash-link" href="#onpressout" title="Direct link to heading">#</a></h3><p>Called as soon as the touch is released even before onPress.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>function</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="pressretentionoffset"></a><code>pressRetentionOffset</code><a class="hash-link" href="#pressretentionoffset" title="Direct link to heading">#</a></h3><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&#x27;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><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>object: {top: number, left: number, bottom: number, right: number}</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="nativeid"></a><code>nativeID</code><a class="hash-link" href="#nativeid" title="Direct link to heading">#</a></h3><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="testid"></a><code>testID</code><a class="hash-link" href="#testid" title="Direct link to heading">#</a></h3><p>Used to locate this view in end-to-end tests.</p><table><thead><tr><th>Type</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>No</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="touchsounddisabled"></a><code>touchSoundDisabled</code><a class="hash-link" href="#touchsounddisabled" title="Direct link to heading">#</a></h3><p>If true, doesn&#x27;t play a system sound on touch.</p><table><thead><tr><th>Type</th><th>Required</th><th>Platform</th></tr></thead><tbody><tr><td>Boolean</td><td>No</td><td>Android</td></tr></tbody></table><hr><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="type-definitions"></a>Type Definitions<a class="hash-link" href="#type-definitions" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="event"></a>Event<a class="hash-link" href="#event" title="Direct link to heading">#</a></h3><table><thead><tr><th>Type</th></tr></thead><tbody><tr><td>Object</td></tr></tbody></table></div></article><div class="docMetadata margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/facebook/react-native-website/blob/master/website/versioned_docs/version-0.60/touchablewithoutfeedback.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" role="img" viewBox="0 0 40 40" class="iconEdit_2Hwv"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col text--right"><em><small class="docMetadata-updated">Last updated on <time datetime="2020-10-29T04:19:29.000Z" class="docLastUpdatedAt_1gIo">10/29/2020</time></small></em></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/0.60/touchableopacity"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« TouchableOpacity</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/0.60/view"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">View »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_1zTD thin-scrollbar"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#usage-example" class="table-of-contents__link">Usage Example</a></li><li><a href="#props" class="table-of-contents__link">Props</a><ul><li><a href="#accessibilityignoresinvertcolors" class="table-of-contents__link"><code>accessibilityIgnoresInvertColors</code></a></li><li><a href="#accessible" class="table-of-contents__link"><code>accessible</code></a></li><li><a href="#accessibilitylabel" class="table-of-contents__link"><code>accessibilityLabel</code></a></li><li><a href="#accessibilityhint" class="table-of-contents__link"><code>accessibilityHint</code></a></li><li><a href="#accessibilityrole" class="table-of-contents__link"><code>accessibilityRole</code></a></li><li><a href="#accessibilitystate" class="table-of-contents__link"><code>accessibilityState</code></a></li><li><a href="#accessibilityactions" class="table-of-contents__link"><code>accessibilityActions</code></a></li><li><a href="#onaccessibilityaction" class="table-of-contents__link"><code>onAccessibilityAction</code></a></li><li><a href="#delaylongpress" class="table-of-contents__link"><code>delayLongPress</code></a></li><li><a href="#delaypressin" class="table-of-contents__link"><code>delayPressIn</code></a></li><li><a href="#delaypressout" class="table-of-contents__link"><code>delayPressOut</code></a></li><li><a href="#disabled" class="table-of-contents__link"><code>disabled</code></a></li><li><a href="#hitslop" class="table-of-contents__link"><code>hitSlop</code></a></li><li><a href="#onblur" class="table-of-contents__link"><code>onBlur</code></a></li><li><a href="#onfocus" class="table-of-contents__link"><code>onFocus</code></a></li><li><a href="#onlayout" class="table-of-contents__link"><code>onLayout</code></a></li><li><a href="#onlongpress" class="table-of-contents__link"><code>onLongPress</code></a></li><li><a href="#onpress" class="table-of-contents__link"><code>onPress</code></a></li><li><a href="#onpressin" class="table-of-contents__link"><code>onPressIn</code></a></li><li><a href="#onpressout" class="table-of-contents__link"><code>onPressOut</code></a></li><li><a href="#pressretentionoffset" class="table-of-contents__link"><code>pressRetentionOffset</code></a></li><li><a href="#nativeid" class="table-of-contents__link"><code>nativeID</code></a></li><li><a href="#testid" class="table-of-contents__link"><code>testID</code></a></li><li><a href="#touchsounddisabled" class="table-of-contents__link"><code>touchSoundDisabled</code></a></li></ul></li><li><a href="#type-definitions" class="table-of-contents__link">Type Definitions</a><ul><li><a href="#event" class="table-of-contents__link">Event</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/tutorial">Tutorial</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/components-and-apis">Components and APIs</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/more-resources">More Resources</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/help">The React Native Community</a></li><li class="footer__item"><a class="footer__link-item" href="/showcase">Who&#x27;s using React Native?</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">Ask Questions on Stack Overflow</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contributor Guide</a></li><li class="footer__item"><a href="https://dev.to/t/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">DEV Community</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Find us</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://twitter.com/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a href="https://reactjs.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">React</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy Policy</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms of Service</a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_3cAK"><img class="footer__logo" alt="Facebook Open Source Logo" src="/img/oss_logo.png"></a></div><div class="footer__copyright">Copyright © 2021 Facebook, Inc.</div></div></div></footer></div>
<script src="/styles.9d29dd5a.js"></script>
<script src="/runtime~main.b00a5634.js"></script>
<script src="/main.4103a08e.js"></script>
<script src="/1.7a6193e2.js"></script>
<script src="/2.9b40dc51.js"></script>
<script src="/1089.caa7a648.js"></script>
<script src="/ae345423.7c9998ff.js"></script>
<script src="/17896441.b54b3e3c.js"></script>
<script src="/773809e7.7032ea64.js"></script>
</body>
</html>