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

8 lines
2.5 KiB
Markdown

---
id: version-0.18-switch
title: switch
original_id: switch
---
<a id="content"></a><h1>Switch</h1><div><div><p>Universal two-state toggle component.</p></div><h3><a class="anchor" name="props"></a><a class="edit-github" href="https://github.com/facebook/react-native/blob/master/Libraries/Components/Switch/Switch.js">Edit on GitHub</a>Props <a class="hash-link" href="#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="view"></a><a href="view.html#props">View props...</a> <a class="hash-link" href="#view">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="disabled"></a>disabled <span class="propType">bool</span> <a class="hash-link" href="#disabled">#</a></h4><div><p>If true the user won't be able to toggle the switch.
Default value is false.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onvaluechange"></a>onValueChange <span class="propType">function</span> <a class="hash-link" href="#onvaluechange">#</a></h4><div><p>Invoked with the new value when the value changes.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="testid"></a>testID <span class="propType">string</span> <a class="hash-link" href="#testid">#</a></h4><div><p>Used to locate this view in end-to-end tests.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="value"></a>value <span class="propType">bool</span> <a class="hash-link" href="#value">#</a></h4><div><p>The value of the switch. If true the switch will be turned on.
Default value is false.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="ontintcolor"></a><span class="platform">ios</span>onTintColor <span class="propType">ColorPropType</span> <a class="hash-link" href="#ontintcolor">#</a></h4><div><p>Background color when the switch is turned on.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="thumbtintcolor"></a><span class="platform">ios</span>thumbTintColor <span class="propType">ColorPropType</span> <a class="hash-link" href="#thumbtintcolor">#</a></h4><div><p>Color of the foreground switch grip.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="tintcolor"></a><span class="platform">ios</span>tintColor <span class="propType">ColorPropType</span> <a class="hash-link" href="#tintcolor">#</a></h4><div><p>Background color when the switch is turned off.</p></div></div></div></div><div class="docs-prevnext"><a class="docs-next" href="tabbarios.html#content">Next →</a></div>