Skip to content

Commit

Permalink
🤖 Merge PR #48869 react-native: add deprecation notice for deprecated…
Browse files Browse the repository at this point in the history
… components/modules by @Naturalclar
  • Loading branch information
Naturalclar committed Oct 20, 2020
1 parent 02ec426 commit cc68288
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 16 deletions.
85 changes: 72 additions & 13 deletions types/react-native/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,7 @@ export interface TransformsStyle {
| TranslateYTransform
| SkewXTransform
| SkewYTransform
| MatrixTransform
)[];
| MatrixTransform)[];
/**
* @deprecated Use matrix in transform prop instead.
*/
Expand Down Expand Up @@ -967,7 +966,7 @@ export interface TextPropsAndroid {
* Determines the types of data converted to clickable URLs in the text element.
* By default no data types are detected.
*/
dataDetectorType?: null |'phoneNumber' | 'link' | 'email' | 'none' | 'all';
dataDetectorType?: null | 'phoneNumber' | 'link' | 'email' | 'none' | 'all';
}

// https://facebook.github.io/react-native/docs/text.html#props
Expand Down Expand Up @@ -3336,6 +3335,12 @@ export interface ProgressBarAndroidProps extends ViewProps {
*/
declare class ProgressBarAndroidComponent extends React.Component<ProgressBarAndroidProps> {}
declare const ProgressBarAndroidBase: Constructor<NativeMethodsMixinType> & typeof ProgressBarAndroidComponent;
/**
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
* @see https://github.com/react-native-progress-view/progress-bar-android
* @deprecated
*/
export class ProgressBarAndroid extends ProgressBarAndroidBase {}

/**
Expand Down Expand Up @@ -3601,14 +3606,21 @@ declare const SliderBase: Constructor<NativeMethodsMixinType> & typeof SliderCom
/**
* Slider has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'.
* @see https://github.com/react-native-community/react-native-slider
* @see https://github.com/callstack/react-native-slider
* @deprecated
*/
export class Slider extends SliderBase {}
/** SliderIOS has been removed from react-native.
* It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'.
* @see https://github.com/callstack/react-native-slider
* @deprecated
*/
export type SliderIOS = Slider;

/**
* https://facebook.github.io/react-native/docs/switchios.html#props
* SwitchIOS Component has been removed from react-native in favor of Switch Component
* https://github.com/facebook/react-native/pull/9891/files
* @deprecated see SwitchProps
*/
export interface SwitchIOSProps extends ViewProps {
/**
Expand Down Expand Up @@ -3643,13 +3655,9 @@ export interface SwitchIOSProps extends ViewProps {
}

/**
*
* 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.
*
* @see https://facebook.github.io/react-native/docs/switchios.html
* SwitchIOS component has been removed from react-native in favor of Switch component
* https://github.com/facebook/react-native/pull/9891/files
* @deprecated see Switch
*/
export class SwitchIOS extends React.Component<SwitchIOSProps> {}

Expand Down Expand Up @@ -5889,6 +5897,10 @@ export interface TabBarIOSProps extends ViewProps {
unselectedItemTintColor?: ColorValue;
}

/**
* TabBarIOS has been removed from react-native
* @deprecated
*/
export class TabBarIOS extends React.Component<TabBarIOSProps> {
static Item: typeof TabBarIOSItem;
}
Expand Down Expand Up @@ -6677,7 +6689,7 @@ export interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollVi
* - `'normal'`: 0.998 on iOS, 0.985 on Android (the default)
* - `'fast'`: 0.99 on iOS, 0.9 on Android
*/
decelerationRate?: 'fast' | 'normal' | number,
decelerationRate?: 'fast' | 'normal' | number;

/**
* When true the scroll view's children are arranged horizontally in a row
Expand Down Expand Up @@ -9386,6 +9398,12 @@ export const DevSettings: DevSettingsStatic;
* @deprecated
*/
export const ART: ARTStatic;
/**
* ART has been removed from React Native.
* It can now be installed and imported from `@react-native-community/art` instead of 'react-native'.
* @see https://github.com/react-native-community/art
* @deprecated
*/
export type ART = ARTStatic;

//////////// APIS //////////////
Expand All @@ -9408,6 +9426,12 @@ export type AppState = AppStateStatic;
* @deprecated
*/
export const AsyncStorage: AsyncStorageStatic;
/**
* AsyncStorage has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/async-storage` instead of 'react-native'.
* @see https://github.com/react-native-community/async-storage
* @deprecated
*/
export type AsyncStorage = AsyncStorageStatic;

export const BackHandler: BackHandlerStatic;
Expand All @@ -9420,6 +9444,12 @@ export type BackHandler = BackHandlerStatic;
* @deprecated
*/
export const CameraRoll: CameraRollStatic;
/**
* CameraRoll has been removed from React Native.
* It can now be installed and imported from `@react-native-community/cameraroll` instead of 'react-native'.
* @see https://github.com/react-native-community/react-native-cameraroll
* @deprecated
*/
export type CameraRoll = CameraRollStatic;

/**
Expand All @@ -9429,6 +9459,12 @@ export type CameraRoll = CameraRollStatic;
* @deprecated
*/
export const Clipboard: ClipboardStatic;
/**
* Clipboard has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/clipboard` instead of 'react-native'.
* @see https://github.com/react-native-community/clipboard
* @deprecated
*/
export type Clipboard = ClipboardStatic;

/**
Expand All @@ -9438,6 +9474,12 @@ export type Clipboard = ClipboardStatic;
* @deprecated
*/
export const DatePickerAndroid: DatePickerAndroidStatic;
/**
* DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
* @see https://github.com/react-native-community/datetimepicker
* @deprecated
*/
export type DatePickerAndroid = DatePickerAndroidStatic;

export const Dimensions: Dimensions;
Expand Down Expand Up @@ -9504,6 +9546,12 @@ export type PermissionsAndroid = PermissionsAndroidStatic;
* @deprecated
*/
export const PushNotificationIOS: PushNotificationIOSStatic;
/**
* PushNotificationIOS has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/push-notification-ios` instead of 'react-native'.
* @see https://github.com/react-native-community/react-native-push-notification-ios
* @deprecated
*/
export type PushNotificationIOS = PushNotificationIOSStatic;

export const Settings: SettingsStatic;
Expand All @@ -9528,6 +9576,12 @@ export type Systrace = SystraceStatic;
* @deprecated
*/
export const TimePickerAndroid: TimePickerAndroidStatic;
/**
* TimePickerAndroid has been removed from React Native.
* It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
* @see https://github.com/react-native-community/datetimepicker
* @deprecated
*/
export type TimePickerAndroid = TimePickerAndroidStatic;

export const ToastAndroid: ToastAndroidStatic;
Expand Down Expand Up @@ -9605,6 +9659,11 @@ export function findNodeHandle(

export function processColor(color?: number | ColorValue): ProcessedColorValue | null | undefined;

/**
* YellowBox has been replaced with LogBox.
* @see LogBox
* @deprecated
*/
export const YellowBox: React.ComponentClass<any, any> & { ignoreWarnings: (warnings: string[]) => void };

/**
Expand Down
11 changes: 8 additions & 3 deletions types/react-native/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ The content of index.io.js could be something like
'use strict';
import { AppRegistry } from 'react-native'
import Welcome from './gen/Welcome'
import { AppRegistry } from 'react-native'
import Welcome from './gen/Welcome'
AppRegistry.registerComponent('MopNative', () => Welcome);
AppRegistry.registerComponent('MopNative', () => Welcome);
For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer
*/

import * as PropTypes from 'prop-types';
import * as React from 'react';
import {
ART,
AccessibilityInfo,
AsyncStorage,
Alert,
AppState,
AppStateStatus,
Expand Down Expand Up @@ -62,10 +64,12 @@ import {
NativeSyntheticEvent,
PermissionsAndroid,
Picker,
PickerIOS,
Platform,
PlatformColor,
Pressable,
ProgressBarAndroid,
ProgressViewIOS,
PushNotificationIOS,
RefreshControl,
RegisteredStyle,
Expand All @@ -82,6 +86,7 @@ import {
StyleProp,
StyleSheet,
Switch,
SwitchIOS,
Systrace,
TabBarIOS,
Text,
Expand Down

0 comments on commit cc68288

Please sign in to comment.