mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 13:44:04 +00:00
RN: Improve <Switch> Documentation
Summary: Minor improvements to the <Switch> docblock, including adding some keywords to make it easier to find. Also, I updated documentation for the deprecated platform-specific versions of the component. Reviewed By: jingc Differential Revision: D3098626 fb-gh-sync-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846 fbshipit-source-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846
This commit is contained in:
parent
9b9cc6b543
commit
235b16d932
@ -1,5 +1,10 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule Switch
|
||||
* @flow
|
||||
@ -21,7 +26,15 @@ type DefaultProps = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Universal two-state toggle component.
|
||||
* Renders a boolean input.
|
||||
*
|
||||
* This is a controlled component that requires an `onValueChange` callback that
|
||||
* updates the `value` prop in order for the component to reflect user actions.
|
||||
* If the `value` prop is not updated, the component will continue to render
|
||||
* the supplied `value` prop instead of the expected result of any user actions.
|
||||
*
|
||||
* @keyword checkbox
|
||||
* @keyword toggle
|
||||
*/
|
||||
var Switch = React.createClass({
|
||||
propTypes: {
|
||||
|
@ -20,7 +20,9 @@ var requireNativeComponent = require('requireNativeComponent');
|
||||
var SWITCH = 'switch';
|
||||
|
||||
/**
|
||||
* Standard Android two-state toggle component
|
||||
* @deprecated
|
||||
*
|
||||
* Use <Switch> instead for cross-platform compatibility.
|
||||
*/
|
||||
var SwitchAndroid = React.createClass({
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
@ -32,11 +32,9 @@ type DefaultProps = {
|
||||
type Event = Object;
|
||||
|
||||
/**
|
||||
* Use `SwitchIOS` to render a boolean input on iOS. This is
|
||||
* a controlled component, so you must hook in to the `onValueChange` callback
|
||||
* and update the `value` prop in order for the component to update, otherwise
|
||||
* the user's change will be reverted immediately to reflect `props.value` as the
|
||||
* source of truth.
|
||||
* @deprecated
|
||||
*
|
||||
* Use <Switch> instead for cross-platform compatibility.
|
||||
*/
|
||||
var SwitchIOS = React.createClass({
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
Loading…
x
Reference in New Issue
Block a user