Permalink
Browse files

Remove deprecated APIs and modules

Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes #9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
  • Loading branch information...
1 parent 9ed9bca commit fa5ad85252be9e5e5a8f04d705463e7ba4cb85e3 @satya164 satya164 committed with Facebook Github Bot Oct 11, 2016
@@ -32,7 +32,7 @@ var {
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
-var SwitchAndroid = require('SwitchAndroid');
+var Switch = require('Switch');
var ToolbarAndroid = require('ToolbarAndroid');
class ToolbarAndroidExample extends React.Component {
@@ -67,7 +67,7 @@ class ToolbarAndroidExample extends React.Component {
logo={require('image!launcher_icon')}
style={styles.toolbar}>
<View style={{height: 56, flexDirection: 'row', alignItems: 'center'}}>
- <SwitchAndroid
+ <Switch
value={this.state.toolbarSwitch}
onValueChange={(value) => this.setState({'toolbarSwitch': value})} />
<Text>{'\'Tis but a switch'}</Text>
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) 2015-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 AppStateIOS
- * @flow
- */
-'use strict';
-
-const AppState = require('AppState');
-
-console.warn('AppStateIOS is deprecated. Use AppState instead');
-
-module.exports = AppState;
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) 2015-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 ActivityIndicatorIOS
- */
-'use strict';
-
-var React = require('React');
-var View = require('View');
-
-class ActivityIndicatorIOS extends React.Component {
- render(): ReactElement {
- return <View {...this.props} />;
- }
-}
-
-module.exports = ActivityIndicatorIOS;
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2015-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 ActivityIndicatorIOS
- */
-'use strict';
-
-var ActivityIndicator = require('ActivityIndicator');
-var NativeMethodsMixin = require('react/lib/NativeMethodsMixin');
-var PropTypes = require('react/lib/ReactPropTypes');
-var React = require('React');
-var View = require('View');
-
-/**
- * Deprecated, use ActivityIndicator instead.
- */
-var ActivityIndicatorIOS = React.createClass({
- mixins: [NativeMethodsMixin],
-
- propTypes: {
- ...View.propTypes,
- /**
- * Whether to show the indicator (true, the default) or hide it (false).
- */
- animating: PropTypes.bool,
- /**
- * The foreground color of the spinner (default is gray).
- */
- color: PropTypes.string,
- /**
- * Whether the indicator should hide when not animating (true by default).
- */
- hidesWhenStopped: PropTypes.bool,
- /**
- * Size of the indicator. Small has a height of 20, large has a height of 36.
- */
- size: PropTypes.oneOf([
- 'small',
- 'large',
- ]),
- /**
- * Invoked on mount and layout changes with
- *
- * {nativeEvent: { layout: {x, y, width, height}}}.
- */
- onLayout: PropTypes.func,
- },
-
- componentDidMount: function() {
- console.warn('ActivityIndicatorIOS is deprecated. Use ActivityIndicator instead.');
- },
-
- render: function() {
- return <ActivityIndicator {...this.props} />;
- }
-});
-
-module.exports = ActivityIndicatorIOS;
@@ -12,7 +12,6 @@
'use strict';
const Clipboard = require('NativeModules').Clipboard;
-const deprecatedCallback = require('deprecatedCallback');
/**
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
@@ -27,12 +26,7 @@ module.exports = {
* ```
*/
getString(): Promise<string> {
- return deprecatedCallback(
- Clipboard.getString(),
- Array.prototype.slice.call(arguments),
- 'success-first',
- 'Clipboard.getString(callback) is deprecated. Use the returned Promise instead'
- );
+ return Clipboard.getString();
},
/**
* Set content of string type. You can use following code to set clipboard content
@@ -1,142 +0,0 @@
-/**
- * Copyright (c) 2015-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 IntentAndroid
- * @flow
- */
-'use strict';
-
-var Linking = require('Linking');
-var invariant = require('fbjs/lib/invariant');
-
-/**
- * NOTE: `IntentAndroid` is being deprecated. Use `Linking` instead.
- *
- * `IntentAndroid` gives you a general interface to handle external links.
- *
- * ### Basic Usage
- *
- * #### Handling deep links
- *
- * If your app was launched from an external url registered to your app you can
- * access and handle it from any component you want with
- *
- * ```
- * componentDidMount() {
- * var url = IntentAndroid.getInitialURL(url => {
- * if (url) {
- * console.log('Initial url is: ' + url);
- * }
- * });
- * }
- * ```
- *
- * Example to add support for deep linking inside your React Native app.
- * More Info: [Enabling Deep Links for App Content - Add Intent Filters for Your Deep Links](http://developer.android.com/training/app-indexing/deep-linking.html#adding-filters).
- *
- * Edit in `android/app/src/main/AndroidManifest.xml`
- *
- * ```
- * <intent-filter>
- * <action android:name="android.intent.action.VIEW" />
- * <category android:name="android.intent.category.DEFAULT" />
- * <category android:name="android.intent.category.BROWSABLE" />
- *
- * <!-- Accepts URIs that begin with "http://www.facebook.com/react -->
- * <data android:scheme="http"
- * android:host="www.facebook.com"
- * android:pathPrefix="/react" />
- * <!-- note that the leading "/" is required for pathPrefix-->
- *
- * <!-- Accepts URIs that begin with "facebook://react -->
- * <!-- <data android:scheme="facebook" android:host="react" /> -->
- * </intent-filter>
- * ```
- *
- * #### Opening external links
- *
- * To start the corresponding activity for a link (web URL, email, contact etc.), call
- *
- * ```
- * IntentAndroid.openURL(url)
- * ```
- *
- * If you want to check if any installed app can handle a given URL beforehand you can call
- * ```
- * IntentAndroid.canOpenURL(url, (supported) => {
- * if (!supported) {
- * console.log('Can\'t handle url: ' + url);
- * } else {
- * IntentAndroid.openURL(url);
- * }
- * });
- * ```
- */
-class IntentAndroid {
-
- /**
- * Starts a corresponding external activity for the given URL.
- *
- * For example, if the URL is "https://www.facebook.com", the system browser will be opened,
- * or the "choose application" dialog will be shown.
- *
- * You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact,
- * or any other URL that can be opened with {@code Intent.ACTION_VIEW}.
- *
- * NOTE: This method will fail if the system doesn't know how to open the specified URL.
- * If you're passing in a non-http(s) URL, it's best to check {@code canOpenURL} first.
- *
- * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!
- *
- * @deprecated
- */
- static openURL(url: string) {
- console.warn('"IntentAndroid.openURL" is deprecated. Use the promise based "Linking.openURL" instead.');
- Linking.openURL(url);
- }
-
- /**
- * Determine whether or not an installed app can handle a given URL.
- *
- * You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact,
- * or any other URL that can be opened with {@code Intent.ACTION_VIEW}.
- *
- * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!
- *
- * @param URL the URL to open
- *
- * @deprecated
- */
- static canOpenURL(url: string, callback: Function) {
- console.warn('"IntentAndroid.canOpenURL" is deprecated. Use the promise based "Linking.canOpenURL" instead.');
- invariant(
- typeof callback === 'function',
- 'A valid callback function is required'
- );
- Linking.canOpenURL(url).then(callback);
- }
-
- /**
- * If the app launch was triggered by an app link with {@code Intent.ACTION_VIEW},
- * it will give the link url, otherwise it will give `null`
- *
- * Refer http://developer.android.com/training/app-indexing/deep-linking.html#handling-intents
- *
- * @deprecated
- */
- static getInitialURL(callback: Function) {
- console.warn('"IntentAndroid.getInitialURL" is deprecated. Use the promise based "Linking.getInitialURL" instead.');
- invariant(
- typeof callback === 'function',
- 'A valid callback function is required'
- );
- Linking.getInitialURL().then(callback);
- }
-}
-
-module.exports = IntentAndroid;
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) 2015-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 IntentAndroid
- */
-'use strict';
-
-module.exports = {
- openURL: function(url) {
- console.error('IntentAndroid is not supported on iOS');
- },
-};
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) 2015-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 SliderIOS
- */
-
-'use strict';
-
-module.exports = require('UnimplementedView');
Oops, something went wrong.

0 comments on commit fa5ad85

Please sign in to comment.