From 235b16d93287061a09c4624e612b5dc4f960ce47 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Fri, 25 Mar 2016 15:16:43 -0700 Subject: [PATCH] RN: Improve Documentation Summary: Minor improvements to the 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 --- Libraries/Components/Switch/Switch.js | 17 +++++++++++++++-- .../SwitchAndroid/SwitchAndroid.android.js | 4 +++- Libraries/Components/SwitchIOS/SwitchIOS.ios.js | 8 +++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index 273139e71..705ae8fbe 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -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: { diff --git a/Libraries/Components/SwitchAndroid/SwitchAndroid.android.js b/Libraries/Components/SwitchAndroid/SwitchAndroid.android.js index 2cbfb87dd..d9a2bbe1a 100644 --- a/Libraries/Components/SwitchAndroid/SwitchAndroid.android.js +++ b/Libraries/Components/SwitchAndroid/SwitchAndroid.android.js @@ -20,7 +20,9 @@ var requireNativeComponent = require('requireNativeComponent'); var SWITCH = 'switch'; /** - * Standard Android two-state toggle component + * @deprecated + * + * Use instead for cross-platform compatibility. */ var SwitchAndroid = React.createClass({ mixins: [NativeMethodsMixin], diff --git a/Libraries/Components/SwitchIOS/SwitchIOS.ios.js b/Libraries/Components/SwitchIOS/SwitchIOS.ios.js index 798529c58..1546f41df 100644 --- a/Libraries/Components/SwitchIOS/SwitchIOS.ios.js +++ b/Libraries/Components/SwitchIOS/SwitchIOS.ios.js @@ -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 instead for cross-platform compatibility. */ var SwitchIOS = React.createClass({ mixins: [NativeMethodsMixin],