diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index c5beebd7f0..8093b52861 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -16,7 +16,7 @@ import { ImageRequireSource, ImageURISource, NativeEventEmitter, - ViewProperties, + ViewProps, ViewStyle, Permission, StyleProp @@ -624,7 +624,7 @@ export class PlaybackObject { /** * BarCodeScanner */ -export interface BarCodeScannerProps extends ViewProperties { +export interface BarCodeScannerProps extends ViewProps { type?: 'front' | 'back'; torchMode?: 'on' | 'off'; barCodeTypes?: string[]; @@ -645,7 +645,7 @@ export class BarCodeScanner extends Component { /** * BlurView */ -export interface BlurViewProps extends ViewProperties { +export interface BlurViewProps extends ViewProps { tint: 'light' | 'default' | 'dark'; intensity: number; } @@ -691,7 +691,7 @@ export class CameraObject { getSupportedRatiosAsync(): Promise; // Android only } -export interface CameraProps extends ViewProperties { +export interface CameraProps extends ViewProps { zoom?: FloatFromZeroToOne; ratio?: string; focusDepth?: FloatFromZeroToOne; @@ -1316,7 +1316,7 @@ export namespace Font { /** * GLView */ -export interface GLViewProps extends ViewProperties { +export interface GLViewProps extends ViewProps { onContextCreate(): void; msaaSamples: number; } diff --git a/types/expo/v23/index.d.ts b/types/expo/v23/index.d.ts index 78de7bf415..322c1b3c6a 100644 --- a/types/expo/v23/index.d.ts +++ b/types/expo/v23/index.d.ts @@ -8,7 +8,7 @@ import { EventSubscription } from 'fbemitter'; import { Component, Ref } from 'react'; import { ViewStyle, - ViewProperties, + ViewProps, ColorPropType, ImageURISource, NativeEventEmitter, @@ -341,7 +341,7 @@ export class AppLoading extends Component { } /** * BarCodeScanner */ -export interface BarCodeScannerProps extends ViewProperties { +export interface BarCodeScannerProps extends ViewProps { type?: 'front' | 'back'; torchMode?: 'on' | 'off'; barCodeTypes?: string[]; @@ -353,7 +353,7 @@ export class BarCodeScanner extends Component { } /** * BlurView */ -export interface BlurViewProps extends ViewProperties { +export interface BlurViewProps extends ViewProps { tint: 'light' | 'default' | 'dark'; intensity: number; } @@ -396,7 +396,7 @@ export class CameraObject { stopRecording(): void; getSupportedRatiosAsync(): Promise; // Android only } -export interface CameraProperties extends ViewProperties { +export interface CameraProperties extends ViewProps { flashMode?: string | number; type?: string | number; ratio?: string; @@ -896,7 +896,7 @@ export namespace Font { /** * GLView */ -export interface GLViewProps extends ViewProperties { +export interface GLViewProps extends ViewProps { onContextCreate(): void; msaaSamples: number; } diff --git a/types/expo/v24/index.d.ts b/types/expo/v24/index.d.ts index 0647519da4..e6a238d129 100644 --- a/types/expo/v24/index.d.ts +++ b/types/expo/v24/index.d.ts @@ -15,7 +15,7 @@ import { ImageRequireSource, ImageURISource, NativeEventEmitter, - ViewProperties, + ViewProps, ViewStyle, Permission, StyleProp @@ -623,7 +623,7 @@ export class PlaybackObject { /** * BarCodeScanner */ -export interface BarCodeScannerProps extends ViewProperties { +export interface BarCodeScannerProps extends ViewProps { type?: 'front' | 'back'; torchMode?: 'on' | 'off'; barCodeTypes?: string[]; @@ -644,7 +644,7 @@ export class BarCodeScanner extends Component { /** * BlurView */ -export interface BlurViewProps extends ViewProperties { +export interface BlurViewProps extends ViewProps { tint: 'light' | 'default' | 'dark'; intensity: number; } @@ -690,7 +690,7 @@ export class CameraObject { getSupportedRatiosAsync(): Promise; // Android only } -export interface CameraProps extends ViewProperties { +export interface CameraProps extends ViewProps { flashMode?: string | number; type?: string | number; ratio?: string; @@ -1302,7 +1302,7 @@ export namespace Font { /** * GLView */ -export interface GLViewProps extends ViewProperties { +export interface GLViewProps extends ViewProps { onContextCreate(): void; msaaSamples: number; } diff --git a/types/expo__vector-icons/index.d.ts b/types/expo__vector-icons/index.d.ts index 864ae1d0cc..19aadf2a33 100644 --- a/types/expo__vector-icons/index.d.ts +++ b/types/expo__vector-icons/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.6 import * as React from 'react'; -import { TextProperties } from 'react-native'; +import { TextProps } from 'react-native'; export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons'; export { default as Entypo } from 'react-native-vector-icons/Entypo'; diff --git a/types/react-native-drawer-layout/index.d.ts b/types/react-native-drawer-layout/index.d.ts index e77bcb268c..af3a05698e 100644 --- a/types/react-native-drawer-layout/index.d.ts +++ b/types/react-native-drawer-layout/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.6 import * as React from 'react'; -import { ViewProperties } from 'react-native'; +import { ViewProps } from 'react-native'; export type DrawerLayoutOpenEventHandler = () => void; @@ -21,7 +21,7 @@ export type DrawerLayoutSlideEventHandler = (event: DrawerLayoutSlideEvent) => v export type DrawerLayoutStateChangeEventHandler = (state: string) => void; -export interface DrawerLayoutProperties extends ViewProperties { +export interface DrawerLayoutProperties extends ViewProps { /** * Child content. */ diff --git a/types/react-native-elevated-view/index.d.ts b/types/react-native-elevated-view/index.d.ts index 4ad853294b..e9ac2b1103 100644 --- a/types/react-native-elevated-view/index.d.ts +++ b/types/react-native-elevated-view/index.d.ts @@ -7,7 +7,7 @@ import * as React from 'react'; import * as ReactNative from 'react-native'; -export interface ElevatedViewProperties extends ReactNative.ViewProperties { +export interface ElevatedViewProperties extends ReactNative.ViewProps { elevation?: number; } diff --git a/types/react-native-google-signin/index.d.ts b/types/react-native-google-signin/index.d.ts index c99a767b8a..862a40a35a 100644 --- a/types/react-native-google-signin/index.d.ts +++ b/types/react-native-google-signin/index.d.ts @@ -5,9 +5,9 @@ // TypeScript Version: 2.6 import * as React from 'react'; -import { ViewProperties } from 'react-native'; +import { ViewProps } from 'react-native'; -export interface GoogleSigninButtonProps extends ViewProperties { +export interface GoogleSigninButtonProps extends ViewProps { size?: GoogleSigninButton.Size; color?: GoogleSigninButton.Color; onPress?(): void; diff --git a/types/react-native-material-design-searchbar/index.d.ts b/types/react-native-material-design-searchbar/index.d.ts index 3c2aad9c51..23b3204c76 100644 --- a/types/react-native-material-design-searchbar/index.d.ts +++ b/types/react-native-material-design-searchbar/index.d.ts @@ -6,7 +6,7 @@ import * as React from 'react'; import { - TextInputProperties, + TextInputProps, ReturnKeyType, ReturnKeyTypeAndroid, TextStyle, @@ -28,7 +28,7 @@ export interface SearchBarProps { placeholderColor?: string; iconColor?: string; textStyle?: TextStyle; - inputProps?: TextInputProperties; + inputProps?: TextInputProps; alwaysShowBackButton?: boolean; onSearchChange?(text: string): void; onClose?(): void; diff --git a/types/react-native-material-kit/index.d.ts b/types/react-native-material-kit/index.d.ts index 79379e599a..f820d8e4cd 100644 --- a/types/react-native-material-kit/index.d.ts +++ b/types/react-native-material-kit/index.d.ts @@ -9,9 +9,9 @@ import * as React from 'react'; import { ViewStyle, TextStyle, - TextInputProperties, - TouchableWithoutFeedbackProperties, - ViewProperties, + TextInputProps, + TouchableWithoutFeedbackProps, + ViewProps, } from 'react-native'; /////////////////////////////// @@ -178,7 +178,7 @@ export namespace MKPropTypes { type rippleLocation = 'tapLocation' | 'center'; } -export interface TickProperties extends ViewProperties { +export interface TickProperties extends ViewProps { fillColor?: string; inset?: number; } @@ -251,12 +251,12 @@ export interface MKColorStatic { } export interface MKButtonProperties extends - TouchableWithoutFeedbackProperties, MKRippleProperties { + TouchableWithoutFeedbackProps, MKRippleProperties { fab?: boolean; enabled?: boolean; } -export interface MKTextFieldProperties extends TextInputProperties, FloatingLabelProperties { +export interface MKTextFieldProperties extends TextInputProps, FloatingLabelProperties { text?: string; password?: boolean; underlineEnabled?: boolean; @@ -265,11 +265,11 @@ export interface MKTextFieldProperties extends TextInputProperties, FloatingLabe tintColor?: string; textInputStyle?: TextStyle; allowFontScaling?: boolean; - additionalInputProps?: TextInputProperties; + additionalInputProps?: TextInputProps; onTextChange?(val: string): void; } -export interface MKSwitchProperties extends TouchableWithoutFeedbackProperties { +export interface MKSwitchProperties extends TouchableWithoutFeedbackProps { checked?: boolean; onColor?: string; offColor?: string; @@ -284,12 +284,12 @@ export interface MKSwitchProperties extends TouchableWithoutFeedbackProperties { onCheckedChange?(checked: boolean): void; } -export interface MKIconToggleProperties extends MKRippleProperties, TouchableWithoutFeedbackProperties { +export interface MKIconToggleProperties extends MKRippleProperties, TouchableWithoutFeedbackProps { checked?: boolean; onCheckedChange?(checked: boolean): void; } -export interface MKRippleProperties extends ViewProperties { +export interface MKRippleProperties extends ViewProps { rippleColor?: string; rippleDuration?: number; rippleLocation?: MKPropTypes.rippleLocation; @@ -301,7 +301,7 @@ export interface MKRippleProperties extends ViewProperties { shadowAniEnabled?: boolean; } -export interface MKProgressProperties extends ViewProperties { +export interface MKProgressProperties extends ViewProps { progress?: number; buffer?: number; progressColor?: string; @@ -310,12 +310,12 @@ export interface MKProgressProperties extends ViewProperties { bufferAniDuration?: number; } -export interface IndeterminateProgressProperties extends ViewProperties { +export interface IndeterminateProgressProperties extends ViewProps { progressColor?: string; progressAniDuration?: number; } -export interface BaseSlider extends ViewProperties { +export interface BaseSlider extends ViewProps { min?: number; max?: number; value?: number; @@ -340,13 +340,13 @@ export interface MKRangeSliderProperties extends BaseSlider { onChange?(curValue: { min: number, max: number }): void; } -export interface MKSpinnerProperties extends ViewProperties { +export interface MKSpinnerProperties extends ViewProps { strokeColor?: string; strokeWidth?: number; spinnerAniDuration?: number; } -export interface MKRadioButtonProperties extends MKRippleProperties, TouchableWithoutFeedbackProperties { +export interface MKRadioButtonProperties extends MKRippleProperties, TouchableWithoutFeedbackProps { borderOnColor?: string; borderOffColor?: string; fillColor?: string; @@ -356,7 +356,7 @@ export interface MKRadioButtonProperties extends MKRippleProperties, TouchableWi onCheckedChange?(opts: { checked: boolean }): void; } -export interface MKCheckboxProperties extends MKRippleProperties, TickProperties, TouchableWithoutFeedbackProperties { +export interface MKCheckboxProperties extends MKRippleProperties, TickProperties, TouchableWithoutFeedbackProps { borderOnColor?: string; borderOffColor?: string; fillColor?: string; diff --git a/types/react-native-photo-view/index.d.ts b/types/react-native-photo-view/index.d.ts index 8979635288..c3f27d78a6 100644 --- a/types/react-native-photo-view/index.d.ts +++ b/types/react-native-photo-view/index.d.ts @@ -5,11 +5,11 @@ // TypeScript Version: 2.6 import * as React from 'react'; -import { ImagePropertiesSourceOptions, ViewProperties } from 'react-native'; +import { ImageSourcePropType, ViewProps } from 'react-native'; export interface ReactNativePhotoViewProps { - source?: ImagePropertiesSourceOptions; - loadingIndicatorSource?: ImagePropertiesSourceOptions; + source?: ImageSourcePropType; + loadingIndicatorSource?: ImageSourcePropType; fadeDuration?: number; minimumZoomScale?: number; maximumZoomScale?: number; @@ -27,4 +27,4 @@ export interface ReactNativePhotoViewProps { onScale?: (scale: number, target?: React.ReactElement) => void; } -export default class ReactNativePhotoView extends React.Component {} +export default class ReactNativePhotoView extends React.Component {} diff --git a/types/react-native-scrollable-tab-view/index.d.ts b/types/react-native-scrollable-tab-view/index.d.ts index b18ee374a9..962ba8a810 100644 --- a/types/react-native-scrollable-tab-view/index.d.ts +++ b/types/react-native-scrollable-tab-view/index.d.ts @@ -6,7 +6,7 @@ // TypeScript Version: 2.6 import * as React from 'react'; -import { Animated, ScrollViewProperties, ViewStyle, TextStyle } from 'react-native'; +import { Animated, ScrollViewProps, ViewStyle, TextStyle } from 'react-native'; export interface ScrollableTabViewProperties extends React.Props { /** @@ -88,7 +88,7 @@ export interface ScrollableTabViewProperties extends React.Props>; + carouselRef?: React.Component>; itemHeight?: number; itemWidth?: number; scrollPosition?: Animated.Value; @@ -30,7 +30,7 @@ export interface AdditionalParallaxProps { vertical?: boolean; } -export interface CarouselProps extends React.Props { +export interface CarouselProps extends React.Props { // Required /** @@ -278,9 +278,9 @@ export interface CarouselStatic extends React.ComponentClass triggerRenderingHack(offset: number): void; } -export type CarouselProperties = ScrollViewProperties & CarouselProps & React.Props>; +export type CarouselProperties = ScrollViewProps & CarouselProps & React.Props>; -export interface ParallaxImageProps extends ImageProperties, AdditionalParallaxProps { +export interface ParallaxImageProps extends ImageProps, AdditionalParallaxProps { /** * Optional style for image's container */ @@ -330,7 +330,7 @@ export interface PaginationProps { * Reference to the Carousel component to which pagination is linked. * Needed only when setting tappableDots to true */ - carouselRef?: React.Component>; + carouselRef?: React.Component>; /** * Style for dots' container that will be merged with the default one */ diff --git a/types/react-native-vector-icons/Icon.d.ts b/types/react-native-vector-icons/Icon.d.ts index 4b64503452..455a3269b0 100644 --- a/types/react-native-vector-icons/Icon.d.ts +++ b/types/react-native-vector-icons/Icon.d.ts @@ -2,14 +2,14 @@ import * as React from 'react'; import { TextStyle, ViewStyle, - TextProperties, - TouchableHighlightProperties, - TouchableNativeFeedbackProperties, - TabBarItemProperties, - ToolbarAndroidProperties + TextProps, + TouchableHighlightProps, + TouchableNativeFeedbackProps, + TabBarIOSItemProps, + ToolbarAndroidProps } from 'react-native'; -export interface IconProps extends TextProperties { +export interface IconProps extends TextProps { /** * Size of the icon, can also be passed as fontSize in the style object. * @@ -32,7 +32,7 @@ export interface IconProps extends TextProperties { color?: string; } -export interface IconButtonProps extends IconProps, TouchableHighlightProperties, TouchableNativeFeedbackProperties { +export interface IconButtonProps extends IconProps, TouchableHighlightProps, TouchableNativeFeedbackProps { /** * Text and icon color * Use iconStyle or nest a Text component if you need different colors. @@ -58,7 +58,7 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties iconStyle?: ViewStyle; /** - * Style prop inherited from TextProperties and TouchableWithoutFeedbackProperties + * Style prop inherited from TextProps and TouchableWithoutFeedbackProperties * Only exist here so we can have ViewStyle or TextStyle * */ @@ -74,7 +74,7 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties export type ImageSource = any; -export interface ToolbarAndroidProps extends ToolbarAndroidProperties { +export interface ToolbarAndroidProps extends ToolbarAndroidProps { /** * Name of the navigation logo icon * (similar to ToolbarAndroid logo) @@ -111,7 +111,7 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties { iconColor: string; } -export interface TabBarItemIOSProps extends TabBarItemProperties { +export interface TabBarItemIOSProps extends TabBarIOSItemProps { /** * Name of the default icon (similar to TabBarIOS.Item icon) * @@ -164,7 +164,7 @@ export class Icon extends React.Component { export namespace Icon { class ToolbarAndroid extends React.Component {} - class TabBarItem extends React.Component {} + class TabBarItem extends React.Component {} class TabBarItemIOS extends React.Component {} class Button extends React.Component {} } diff --git a/types/react-native-vector-icons/index.d.ts b/types/react-native-vector-icons/index.d.ts index 2a2ef8fdce..60e6408d18 100644 --- a/types/react-native-vector-icons/index.d.ts +++ b/types/react-native-vector-icons/index.d.ts @@ -7,7 +7,7 @@ import * as React from 'react'; import { Icon } from './Icon'; -import { TextProperties } from 'react-native'; +import { TextProps } from 'react-native'; /** * Returns your own custom font based on the glyphMap where the key is the icon name diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index 3ca2dc80fb..25a58a3e00 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -6,7 +6,7 @@ import * as React from 'react'; import { - ViewProperties + ViewProps } from 'react-native'; export interface OnLoadData { @@ -32,7 +32,7 @@ export interface LoadError { }; } -export interface VideoProperties extends ViewProperties { +export interface VideoProperties extends ViewProps { /* Native only */ src?: any; seek?: number; diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index fe73c7abae..ebd75b2089 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -9,6 +9,7 @@ // Alex Dunne // Manuel Alabor // Michele Bombardi +// Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -25,9 +26,12 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// +/// import * as React from 'react'; +type Constructor = new(...args: any[]) => T; + export type MeasureOnSuccessCallback = ( x: number, y: number, @@ -411,7 +415,8 @@ export interface NativeTouchEvent { export interface GestureResponderEvent extends NativeSyntheticEvent {} -export interface PointProperties { +// See https://facebook.github.io/react-native/docs/scrollview.html#contentoffset +export interface PointPropType { x: number; y: number; } @@ -605,7 +610,7 @@ export interface FlexStyle { * @see https://facebook.github.io/react-native/docs/layout-props.html * @see LayoutPropTypes.js */ -export interface LayoutProperties extends FlexStyle {} +export interface LayoutProps extends FlexStyle {} /** * @see ShadowPropTypesIOS.js @@ -751,7 +756,7 @@ export interface LayoutRectangle { height: number; } -// @see TextProperties.onLayout +// @see TextProps.onLayout export interface LayoutChangeEvent { nativeEvent: { layout: LayoutRectangle; @@ -794,7 +799,7 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { testID?: string; } -export interface TextPropertiesIOS { +export interface TextPropsIOS { /** * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The * default is `true`. @@ -818,7 +823,7 @@ export interface TextPropertiesIOS { suppressHighlighting?: boolean; } -export interface TextPropertiesAndroid { +export interface TextPropsAndroid { /** * Lets the user select text, to use the native copy and paste functionality. */ @@ -837,7 +842,7 @@ export interface TextPropertiesAndroid { } // https://facebook.github.io/react-native/docs/text.html#props -export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid, AccessibilityProperties { +export interface TextProps extends TextPropsIOS, TextPropsAndroid, AccessibilityProps { /** * This can be one of the following values: * @@ -905,7 +910,9 @@ export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid /** * A React component for displaying text which supports nesting, styling, and touch handling. */ -export interface TextStatic extends NativeMethodsMixin, React.ClassicComponentClass {} +declare class TextComponent extends React.Component {} +declare const TextBase: Constructor & typeof TextComponent; +export class Text extends TextBase {} type DataDetectorTypes = "phoneNumber" | "link" | "address" | "calendarEvent" | "none" | "all"; @@ -952,7 +959,7 @@ export interface DocumentSelectionState extends EventEmitter { * IOS Specific properties for TextInput * @see https://facebook.github.io/react-native/docs/textinput.html#props */ -export interface TextInputIOSProperties { +export interface TextInputIOSProps { /** * enum('never', 'while-editing', 'unless-editing', 'always') * When the clear button should appear on the right side of the text view @@ -1015,7 +1022,7 @@ export interface TextInputIOSProperties { * Android Specific properties for TextInput * @see https://facebook.github.io/react-native/docs/textinput.html#props */ -export interface TextInputAndroidProperties { +export interface TextInputAndroidProps { /** * When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), * the OS may choose to have the user edit the text inside of a full screen text input mode. @@ -1079,8 +1086,8 @@ export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | Return /** * @see https://facebook.github.io/react-native/docs/textinput.html#props */ -export interface TextInputProperties - extends ViewProperties, TextInputIOSProperties, TextInputAndroidProperties, AccessibilityProperties { +export interface TextInputProps + extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps { /** * Can tell TextInput to automatically capitalize certain characters. * characters: all characters, @@ -1297,7 +1304,9 @@ interface TextInputState { /** * @see https://facebook.github.io/react-native/docs/textinput.html#methods */ -export interface TextInputStatic extends NativeMethodsMixin, TimerMixin, React.ComponentClass { +declare class TextInputComponent extends React.Component {} +declare const TextInputBase: Constructor & Constructor & typeof TextInputComponent; +export class TextInput extends TextInputBase { State: TextInputState; /** @@ -1333,7 +1342,7 @@ export type ToolbarAndroidAction = { showWithText?: boolean; }; -export interface ToolbarAndroidProperties extends ViewProperties { +export interface ToolbarAndroidProps extends ViewProps { /** * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons * or text on the right side of the widget. If they don't fit they are placed in an 'overflow' @@ -1446,7 +1455,9 @@ export interface ToolbarAndroidProperties extends ViewProperties { * * [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html */ -export interface ToolbarAndroidStatic extends NativeMethodsMixin, React.ComponentClass {} +declare class ToolbarAndroidComponent extends React.Component {} +declare const ToolbarAndroidBase: Constructor & typeof ToolbarAndroidComponent; +export class ToolbarAndroid extends ToolbarAndroidBase {} /** * Gesture recognition on mobile devices is much more complicated than web. @@ -1595,7 +1606,7 @@ export interface ViewStyle extends FlexStyle, TransformsStyle { testID?: string; } -export interface ViewPropertiesIOS { +export interface ViewPropsIOS { /** * A Boolean value indicating whether VoiceOver should ignore the elements within views that are siblings of the receiver. * @platform ios @@ -1628,7 +1639,7 @@ export interface ViewPropertiesIOS { shouldRasterizeIOS?: boolean; } -export interface ViewPropertiesAndroid { +export interface ViewPropsAndroid { /** * Views that are only used to layout their children or otherwise don't draw anything * may be automatically removed from the native hierarchy as an optimization. @@ -1671,7 +1682,7 @@ export type StyleProp = T | RegisteredStyle | RecursiveArray, android.view, etc. */ -export interface ViewStatic extends NativeMethodsMixin, React.ClassicComponentClass { +declare class ViewComponent extends React.Component {} +declare const ViewBase: Constructor & typeof ViewComponent; +export class View extends ViewBase { /** * Is 3D Touch / Force Touch available (i.e. will touch events include `force`) * @platform ios @@ -1849,7 +1862,7 @@ export interface ViewPagerAndroidOnPageSelectedEventData { position: number; } -export interface ViewPagerAndroidProperties extends ViewProperties { +export interface ViewPagerAndroidProps extends ViewProps { /** * Index of initial page that should be selected. Use `setPage` method to * update the page, and `onPageSelected` to monitor page changes @@ -1905,7 +1918,9 @@ export interface ViewPagerAndroidProperties extends ViewProperties { pageMargin?: number; } -export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.ComponentClass { +declare class ViewPagerAndroidComponent extends React.Component {} +declare const ViewPagerAndroidBase: Constructor & typeof ViewPagerAndroidComponent; +export class ViewPagerAndroid extends ViewPagerAndroidBase { /** * A helper function to scroll to a specific page in the ViewPager. * The transition between pages will be animated. @@ -1923,11 +1938,11 @@ export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.Compon * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard. * It can automatically adjust either its position or bottom padding based on the position of the keyboard. */ -export interface KeyboardAvoidingViewStatic - extends TimerMixin, - React.ClassicComponentClass {} +declare class KeyboardAvoidingViewComponent extends React.Component {} +declare const KeyboardAvoidingViewBase: Constructor & typeof KeyboardAvoidingViewComponent; +export class KeyboardAvoidingView extends KeyboardAvoidingViewBase {} -export interface KeyboardAvoidingViewProps extends ViewProperties { +export interface KeyboardAvoidingViewProps extends ViewProps { behavior?: "height" | "position" | "padding"; /** @@ -1965,7 +1980,7 @@ export interface WebViewMessageEventData { data: string; } -export interface WebViewPropertiesAndroid { +export interface WebViewPropsAndroid { /** * Used for android only, JS is enabled by default for WebView on iOS */ @@ -2003,7 +2018,7 @@ export interface WebViewIOSLoadRequestEvent { url: string; } -export interface WebViewPropertiesIOS { +export interface WebViewPropsIOS { /** * Determines whether HTML5 videos play inline or use the native * full-screen controller. default value false @@ -2104,7 +2119,7 @@ export interface WebViewHtmlSource { /** * @see https://facebook.github.io/react-native/docs/webview.html#props */ -export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS { +export interface WebViewProps extends ViewProps, WebViewPropsAndroid, WebViewPropsIOS { /** * Controls whether to adjust the content inset for web views that are * placed behind a navigation bar, tab bar, or toolbar. The default value @@ -2162,12 +2177,12 @@ export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndr /** * Function that returns a view to show if there's an error. */ - renderError?: () => React.ReactElement; + renderError?: () => React.ReactElement; /** * Function that returns a loading indicator. */ - renderLoading?: () => React.ReactElement; + renderLoading?: () => React.ReactElement; /** * Boolean value that forces the `WebView` to show the loading view @@ -2194,7 +2209,7 @@ export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndr scalesPageToFit?: boolean; } -export interface WebViewStatic extends React.ClassicComponentClass { +export class WebView extends React.Component { /** * Go back one page in the webview's history. */ @@ -2241,7 +2256,7 @@ export interface NativeSegmentedControlIOSChangeEvent { target: number; } -export interface SegmentedControlIOSProperties extends ViewProperties { +export interface SegmentedControlIOSProps extends ViewProps { /** * If false the user won't be able to interact with the control. Default value is true. */ @@ -2286,7 +2301,9 @@ export interface SegmentedControlIOSProperties extends ViewProperties { * Moreover, and most importantly, Safe Area's paddings feflect physical limitation of the screen, * such as rounded corners or camera notches (aka sensor housing area on iPhone X). */ -export interface SafeAreaViewStatic extends NativeMethodsMixin, React.ClassicComponentClass {} +declare class SafeAreaViewComponent extends React.Component {} +declare const SafeAreaViewBase: Constructor & typeof SafeAreaViewComponent; +export class SafeAreaView extends SafeAreaViewBase {} /** @@ -2296,9 +2313,9 @@ export interface SafeAreaViewStatic extends NativeMethodsMixin, React.ClassicCom * To use this component wrap your custom toolbar with the InputAccessoryView component, and set a nativeID. Then, pass * that nativeID as the inputAccessoryViewID of whatever TextInput you desire. */ -export interface InputAccessoryViewStatic extends React.ClassicComponentClass {} +export class InputAccessoryView extends React.Component {} -export interface InputAccessoryViewProperties { +export interface InputAccessoryViewProps { backgroundColor?: string; /** @@ -2329,11 +2346,11 @@ export interface InputAccessoryViewProperties { * /> * ```` */ -export interface SegmentedControlIOSStatic - extends NativeMethodsMixin, - React.ClassicComponentClass {} +declare class SegmentedControlIOSComponent extends React.Component {} +declare const SegmentedControlIOSBase: Constructor & typeof SegmentedControlIOSComponent; +export class SegmentedControlIOS extends SegmentedControlIOSBase {} -export interface NavigatorIOSProperties { +export interface NavigatorIOSProps { /** * The default background color of the navigation bar. */ @@ -2403,7 +2420,7 @@ export interface NavigatorIOSProperties { * * @see https://facebook.github.io/react-native/docs/navigatorios.html#navigator */ -export interface NavigationIOS { +export class NavigatorIOS extends React.Component { /** * Navigate forward to a new route */ @@ -2450,12 +2467,10 @@ export interface NavigationIOS { popToTop(): void; } -export interface NavigatorIOSStatic extends NavigationIOS, React.ComponentClass {} - /** * @see https://facebook.github.io/react-native/docs/activityindicator.html#props */ -export interface ActivityIndicatorProperties extends ViewProperties { +export interface ActivityIndicatorProps extends ViewProps { /** * Whether to show the indicator (true, the default) or hide it (false). */ @@ -2482,14 +2497,14 @@ export interface ActivityIndicatorProperties extends ViewProperties { style?: StyleProp; } -export interface ActivityIndicatorStatic - extends NativeMethodsMixin, - React.ClassicComponentClass {} +declare class ActivityIndicatorComponent extends React.Component {} +declare const ActivityIndicatorBase: Constructor & typeof ActivityIndicatorComponent; +export class ActivityIndicator extends ActivityIndicatorBase {} /** * @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props */ -export interface ActivityIndicatorIOSProperties extends ViewProperties { +export interface ActivityIndicatorIOSProps extends ViewProps { /** * Whether to show the indicator (true, the default) or hide it (false). */ @@ -2524,9 +2539,9 @@ export interface ActivityIndicatorIOSProperties extends ViewProperties { /** * @Deprecated since version 0.28.0 */ -export interface ActivityIndicatorIOSStatic extends React.ComponentClass {} +export class ActivityIndicatorIOS extends React.Component {} -export interface DatePickerIOSProperties extends ViewProperties { +export interface DatePickerIOSProps extends ViewProps { /** * The currently selected date. */ @@ -2576,14 +2591,16 @@ export interface DatePickerIOSProperties extends ViewProperties { timeZoneOffsetInMinutes?: number; } -export interface DatePickerIOSStatic extends NativeMethodsMixin, React.ComponentClass {} +declare class DatePickerIOSComponent extends React.Component {} +declare const DatePickerIOSBase: Constructor & typeof DatePickerIOSComponent; +export class DatePickerIOS extends TextInputBase {} export interface DrawerSlideEvent extends NativeSyntheticEvent {} /** * @see DrawerLayoutAndroid.android.js */ -export interface DrawerLayoutAndroidProperties extends ViewProperties { +export interface DrawerLayoutAndroidProps extends ViewProps { /** * Specifies the background color of the drawer. The default value * is white. If you want to set the opacity of the drawer, use rgba. @@ -2677,9 +2694,9 @@ interface DrawerPosition { Right: number; } -export interface DrawerLayoutAndroidStatic - extends NativeMethodsMixin, - React.ClassicComponentClass { +declare class DrawerLayoutAndroidComponent extends React.Component {} +declare const DrawerLayoutAndroidBase: Constructor & typeof DrawerLayoutAndroidComponent; +export class DrawerLayoutAndroid extends DrawerLayoutAndroidBase { /** * drawer's positions. */ @@ -2699,7 +2716,7 @@ export interface DrawerLayoutAndroidStatic /** * @see PickerIOS.ios.js */ -export interface PickerIOSItemProperties { +export interface PickerIOSItemProps { value?: string | number; label?: string; } @@ -2707,21 +2724,21 @@ export interface PickerIOSItemProperties { /** * @see PickerIOS.ios.js */ -export interface PickerIOSItemStatic extends React.ComponentClass {} +export class PickerIOSItem extends React.Component {} /** * @see Picker.js */ -export interface PickerItemProperties { +export interface PickerItemProps { testID?: string; color?: string; label: string; value?: any; } -export interface PickerItem extends React.ComponentClass {} +export class PickerItem extends React.Component {} -export interface PickerPropertiesIOS extends ViewProperties { +export interface PickerPropsIOS extends ViewProps { /** * Style to apply to each of the item labels. * @platform ios @@ -2729,7 +2746,7 @@ export interface PickerPropertiesIOS extends ViewProperties { itemStyle?: StyleProp; } -export interface PickerPropertiesAndroid extends ViewProperties { +export interface PickerPropsAndroid extends ViewProps { /** * If set to false, the picker will be disabled, i.e. the user will not be able to make a * selection. @@ -2758,7 +2775,7 @@ export interface PickerPropertiesAndroid extends ViewProperties { * @see https://facebook.github.io/react-native/docs/picker.html * @see Picker.js */ -export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesAndroid { +export interface PickerProps extends PickerPropsIOS, PickerPropsAndroid { /** * Callback for when an item is selected. This is called with the * following parameters: @@ -2785,7 +2802,7 @@ export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesA * @see https://facebook.github.io/react-native/docs/picker.html * @see Picker.js */ -export interface PickerStatic extends React.ComponentClass { +export class Picker extends React.Component { /** * On Android, display the options in a dialog. */ @@ -2795,14 +2812,14 @@ export interface PickerStatic extends React.ComponentClass { */ MODE_DROPDOWN: string; - Item: PickerItem; + static Item: typeof PickerItem; } /** * @see https://facebook.github.io/react-native/docs/pickerios.html * @see PickerIOS.ios.js */ -export interface PickerIOSProperties extends ViewProperties { +export interface PickerIOSProps extends ViewProps { itemStyle?: StyleProp; onValueChange?: (value: string | number) => void; selectedValue?: string | number; @@ -2812,15 +2829,17 @@ export interface PickerIOSProperties extends ViewProperties { * @see https://facebook.github.io/react-native/docs/pickerios.html * @see PickerIOS.ios.js */ -export interface PickerIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass { - Item: PickerIOSItemStatic; +declare class PickerIOSComponent extends React.Component {} +declare const PickerIOSBase: Constructor & typeof PickerIOSComponent; +export class PickerIOS extends PickerIOSBase { + static Item: typeof PickerIOSItem; } /** * @see https://facebook.github.io/react-native/docs/progressbarandroid.html * @see ProgressBarAndroid.android.js */ -export interface ProgressBarAndroidProperties extends ViewProperties { +export interface ProgressBarAndroidProps extends ViewProps { /** * Style of the ProgressBar. One of: Horizontal @@ -2858,15 +2877,15 @@ export interface ProgressBarAndroidProperties extends ViewProperties { * React component that wraps the Android-only `ProgressBar`. This component is used to indicate * that the app is loading or there is some activity in the app. */ -export interface ProgressBarAndroidStatic - extends NativeMethodsMixin, - React.ClassicComponentClass {} +declare class ProgressBarAndroidComponent extends React.Component {} +declare const ProgressBarAndroidBase: Constructor & typeof ProgressBarAndroidComponent; +export class ProgressBarAndroid extends ProgressBarAndroidBase {} /** * @see https://facebook.github.io/react-native/docs/progressviewios.html * @see ProgressViewIOS.ios.js */ -export interface ProgressViewIOSProperties extends ViewProperties { +export interface ProgressViewIOSProps extends ViewProps { /** * The progress bar style. */ @@ -2897,11 +2916,11 @@ export interface ProgressViewIOSProperties extends ViewProperties { */ trackImage?: ImageURISource | ImageURISource[]; } -export interface ProgressViewIOSStatic - extends NativeMethodsMixin, - React.ClassicComponentClass {} +declare class ProgressViewIOSComponent extends React.Component {} +declare const ProgressViewIOSBase: Constructor & typeof ProgressViewIOSComponent; +export class ProgressViewIOS extends ProgressViewIOSBase {} -export interface RefreshControlPropertiesIOS extends ViewProperties { +export interface RefreshControlPropsIOS extends ViewProps { /** * The color of the refresh indicator. */ @@ -2918,7 +2937,7 @@ export interface RefreshControlPropertiesIOS extends ViewProperties { titleColor?: string; } -export interface RefreshControlPropertiesAndroid extends ViewProperties { +export interface RefreshControlPropsAndroid extends ViewProps { /** * The colors (at least one) that will be used to draw the refresh indicator. */ @@ -2946,7 +2965,7 @@ export interface RefreshControlPropertiesAndroid extends ViewProperties { progressViewOffset?: number; } -export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid { +export interface RefreshControlProps extends RefreshControlPropsIOS, RefreshControlPropsAndroid { /** * Called when the view starts refreshing. */ @@ -2966,13 +2985,13 @@ export interface RefreshControlProperties extends RefreshControlPropertiesIOS, R * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true * in the `onRefresh` function otherwise the refresh indicator will stop immediately. */ -export interface RefreshControlStatic - extends NativeMethodsMixin, - React.ClassicComponentClass { +declare class RefreshControlComponent extends React.Component {} +declare const RefreshControlBase: Constructor & typeof RefreshControlComponent; +export class RefreshControl extends RefreshControlBase { SIZE: Object; // Undocumented } -export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProperties {} +export interface RecyclerViewBackedScrollViewProps extends ScrollViewProps {} /** * Wrapper around android native recycler view. @@ -2988,9 +3007,9 @@ export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProper * use it pass this component as `renderScrollComponent` to the list view. For * now only horizontal scrolling is supported. */ -export interface RecyclerViewBackedScrollViewStatic - extends ScrollResponderMixin, - React.ClassicComponentClass { +declare class RecyclerViewBackedScrollViewComponent extends React.Component {} +declare const RecyclerViewBackedScrollViewBase: Constructor & typeof RecyclerViewBackedScrollViewComponent; +export class RecyclerViewBackedScrollView extends RecyclerViewBackedScrollViewBase { /** * A helper function to scroll to a specific point in the scrollview. * This is currently used to help focus on child textviews, but can also @@ -3013,14 +3032,14 @@ export interface RecyclerViewBackedScrollViewStatic getScrollResponder(): JSX.Element; } -export interface SliderPropertiesAndroid extends ViewProperties { +export interface SliderPropsAndroid extends ViewProps { /** * Color of the foreground switch grip. */ thumbTintColor?: string; } -export interface SliderPropertiesIOS extends ViewProperties { +export interface SliderPropsIOS extends ViewProps { /** * Assigns a maximum track image. Only static images are supported. * The leftmost pixel of the image will be stretched to fill the track. @@ -3046,7 +3065,7 @@ export interface SliderPropertiesIOS extends ViewProperties { trackImage?: ImageURISource; } -export interface SliderProperties extends SliderPropertiesIOS, SliderPropertiesAndroid { +export interface SliderProps extends SliderPropsIOS, SliderPropsAndroid { /** * If true the user won't be able to move the slider. * Default value is false. @@ -3113,12 +3132,15 @@ export interface SliderProperties extends SliderPropertiesIOS, SliderPropertiesA /** * A component used to select a single value from a range of values. */ -export interface SliderStatic extends NativeMethodsMixin, React.ClassicComponentClass {} +declare class SliderComponent extends React.Component {} +declare const SliderBase: Constructor & typeof SliderComponent; +export class Slider extends TextBase {} +export type SliderIOS = Slider; /** * https://facebook.github.io/react-native/docs/switchios.html#props */ -export interface SwitchIOSProperties extends ViewProperties { +export interface SwitchIOSProps extends ViewProps { /** * If true the user won't be able to toggle the switch. Default value is false. */ @@ -3159,7 +3181,7 @@ export interface SwitchIOSProperties extends ViewProperties { * * @see https://facebook.github.io/react-native/docs/switchios.html */ -export interface SwitchIOSStatic extends React.ComponentClass {} +export class SwitchIOS extends React.Component {} export type ImageResizeMode = "contain" | "cover" | "stretch" | "center" | "repeat"; @@ -3293,7 +3315,7 @@ export interface ImageURISource { export type ImageRequireSource = number; -export interface ImagePropertiesIOS { +export interface ImagePropsIOS { /** * blurRadius: the blur radius of the blur filter added to the image * @platform ios @@ -3327,7 +3349,7 @@ export interface ImagePropertiesIOS { onPartialLoad?: () => void; } -interface ImagePropertiesAndroid { +interface ImagePropsAndroid { /** * The mechanism that should be used to resize the image when the image's dimensions * differ from the image view's dimensions. Defaults to auto. @@ -3349,11 +3371,13 @@ interface ImagePropertiesAndroid { fadeDuration?: number; } +// See https://facebook.github.io/react-native/docs/image.html#source +export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequireSource; + /** * @see https://facebook.github.io/react-native/docs/image.html */ -export type ImagePropertiesSourceOptions = ImageURISource | ImageURISource[] | ImageRequireSource; -export interface ImageProperties extends ImagePropertiesIOS, ImagePropertiesAndroid, AccessibilityProperties, LayoutProperties { +export interface ImageProps extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, LayoutProps { /** * onLayout function * @@ -3441,14 +3465,15 @@ export interface ImageProperties extends ImagePropertiesIOS, ImagePropertiesAndr resizeMethod?: "auto" | "resize" | "scale"; /** - * `uri` is a string representing the resource identifier for the image, which - * could be an http address, a local file path, or a static image - * resource (which should be wrapped in the `require('./path/to/image.png')` function). - * This prop can also contain several remote `uri`, specified together with - * their width and height. The native side will then choose the best `uri` to display - * based on the measured size of the image container. + * The image source (either a remote URL or a local file resource). + * + * This prop can also contain several remote URLs, specified together with their width and height and potentially with scale/other URI arguments. + * The native side will then choose the best uri to display based on the measured size of the image container. + * A cache property can be added to control how networked request interacts with the local cache. + * + * The currently supported formats are png, jpg, jpeg, bmp, gif, webp (Android only), psd (iOS only). */ - source: ImagePropertiesSourceOptions; + source: ImageSourcePropType; /** * similarly to `source`, this property represents the resource used to render @@ -3469,7 +3494,9 @@ export interface ImageProperties extends ImagePropertiesIOS, ImagePropertiesAndr testID?: string; } -export interface ImageStatic extends NativeMethodsMixin, React.ComponentClass { +declare class ImageComponent extends React.Component {} +declare const ImageBase: Constructor & typeof ImageComponent; +export class Image extends ImageBase { resizeMode: ImageResizeMode; getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any; prefetch(url: string): any; @@ -3477,12 +3504,14 @@ export interface ImageStatic extends NativeMethodsMixin, React.ComponentClass>; } -export interface ImageBackgroundProperties extends ImageProperties { +export interface ImageBackgroundProps extends ImageProps { style?: StyleProp; imageStyle?: StyleProp; } -export interface ImageBackgroundStatic extends NativeMethodsMixin, React.ComponentClass { +declare class ImageBackgroundComponent extends React.Component {} +declare const ImageBackgroundBase: Constructor & typeof ImageBackgroundComponent; +export class ImageBackground extends ImageBackgroundBase { resizeMode: ImageResizeMode; getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any; prefetch(url: string): any; @@ -3545,7 +3574,7 @@ export interface ListRenderItemInfo { export type ListRenderItem = (info: ListRenderItemInfo) => React.ReactElement | null; -export interface FlatListProperties extends VirtualizedListProperties { +export interface FlatListProps extends VirtualizedListProps { /** * Rendered in between each item, but not at the top or bottom */ @@ -3693,7 +3722,7 @@ export interface FlatListProperties extends VirtualizedListProperties extends React.ComponentClass> { +export class FlatList extends React.Component> { /** * Exports some data, e.g. for perf investigations or analytics. */ @@ -3762,7 +3791,7 @@ export interface SectionListScrollParams { viewPosition?: number; } -export interface SectionListProperties extends ScrollViewProperties { +export interface SectionListProps extends ScrollViewProps { /** * Rendered in between adjacent Items within each section. */ @@ -3856,7 +3885,7 @@ export interface SectionListProperties extends ScrollViewProperties { /** * Render a custom scroll component, e.g. with a differently styled `RefreshControl`. */ - renderScrollComponent?: (props: ScrollViewProperties) => React.ReactElement; + renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement; /** * Note: may have bugs (missing content) in some circumstances - use at your own risk. @@ -3879,12 +3908,12 @@ export interface SectionListProperties extends ScrollViewProperties { scrollToLocation?(params: SectionListScrollParams): void; } -export interface SectionListStatic extends React.ComponentClass> {} +export interface SectionListStatic extends React.ComponentClass> {} /** * @see https://facebook.github.io/react-native/docs/virtualizedlist.html#props */ -export interface VirtualizedListProperties extends ScrollViewProperties { +export interface VirtualizedListProps extends ScrollViewProps { /** * Rendered when the list is empty. Can be a React Component Class, a render function, or * a rendered element. @@ -4033,7 +4062,7 @@ export interface VirtualizedListProperties extends ScrollViewProperties { /** * Render a custom scroll component, e.g. with a differently styled `RefreshControl`. */ - renderScrollComponent?: (props: ScrollViewProperties) => React.ReactElement; + renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement; /** * Amount of time between low-pri item render batches, e.g. for rendering items quite a ways off @@ -4056,7 +4085,7 @@ export interface VirtualizedListProperties extends ScrollViewProperties { /** * @see https://facebook.github.io/react-native/docs/listview.html#props */ -export interface ListViewProperties extends ScrollViewProperties { +export interface ListViewProps extends ScrollViewProps { /** * An instance of [ListView.DataSource](docs/listviewdatasource.html) to use */ @@ -4154,7 +4183,7 @@ export interface ListViewProperties extends ScrollViewProperties { * A function that returns the scrollable component in which the list rows are rendered. * Defaults to returning a ScrollView with the given props. */ - renderScrollComponent?: (props: ScrollViewProperties) => React.ReactElement; + renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement; /** * (sectionData, sectionID) => renderable @@ -4216,7 +4245,9 @@ interface TimerMixin { cancelAnimationFrame: typeof cancelAnimationFrame; } -export interface ListViewStatic extends ScrollResponderMixin, TimerMixin, React.ComponentClass { +declare class ListViewComponent extends React.Component {} +declare const ListViewBase: Constructor & Constructor & typeof ListViewComponent; +export class ListView extends ListViewBase { DataSource: ListViewDataSource; /** @@ -4280,7 +4311,7 @@ export interface MapViewOverlay { id?: string; } -export interface MapViewProperties extends ViewProperties { +export interface MapViewProps extends ViewProps { /** * If false points of interest won't be displayed on the map. * Default value is true. @@ -4405,7 +4436,9 @@ export interface MapViewProperties extends ViewProperties { /** * @see https://facebook.github.io/react-native/docs/mapview.html#content */ -export interface MapViewStatic extends NativeMethodsMixin, React.ComponentClass { +declare class MapViewComponent extends React.Component {} +declare const MapViewBase: Constructor & typeof MapViewComponent; +export class MapView extends MapViewBase { PinColors: { RED: string; GREEN: string; @@ -4413,16 +4446,18 @@ export interface MapViewStatic extends NativeMethodsMixin, React.ComponentClass< }; } -interface MaskedViewProperties extends ViewProperties { +interface MaskedViewIOSProps extends ViewProps { maskElement: React.ReactElement; } /** * @see https://facebook.github.io/react-native/docs/maskedviewios.html */ -export interface MaskedViewStatic extends NativeMethodsMixin, React.ComponentClass {} +declare class MaskedViewComponent extends React.Component {} +declare const MaskedViewBase: Constructor & typeof MaskedViewComponent; +export class MaskedViewIOS extends MaskedViewBase {} -export interface ModalProperties { +export interface ModalProps { // Only `animated` is documented. The JS code says `animated` is // deprecated and `animationType` is preferred. animated?: boolean; @@ -4481,7 +4516,7 @@ export interface ModalProperties { presentationStyle?: "fullScreen" | "pageSheet" | "formSheet" | "overFullScreen"; } -export interface ModalStatic extends React.ComponentClass {} +export class Modal extends React.Component {} /** * @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\Components\Touchable\Touchable.js @@ -4544,7 +4579,7 @@ interface TouchableMixin { /** * @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html#props */ -export interface TouchableWithoutFeedbackProperties extends AccessibilityProperties { +export interface TouchableWithoutFeedbackProps extends AccessibilityProps { /** * Delay in ms, from onPressIn, before onLongPress is called. */ @@ -4613,8 +4648,6 @@ export interface TouchableWithoutFeedbackProperties extends AccessibilityPropert testID?: string; } -export interface TouchableWithoutFeedbackProps extends TouchableWithoutFeedbackProperties {} - /** * Do not use unless you have a very good reason. * All the elements that respond to press should have a visual feedback when touched. @@ -4622,15 +4655,14 @@ export interface TouchableWithoutFeedbackProps extends TouchableWithoutFeedbackP * * @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html */ -export interface TouchableWithoutFeedbackStatic - extends TimerMixin, - TouchableMixin, - React.ClassicComponentClass {} +declare class TouchableWithoutFeedbackComponent extends React.Component {} +declare const TouchableWithoutFeedbackBase: Constructor & Constructor & typeof TouchableWithoutFeedbackComponent; +export class TouchableWithoutFeedback extends TouchableWithoutFeedbackBase {} /** * @see https://facebook.github.io/react-native/docs/touchablehighlight.html#props */ -export interface TouchableHighlightProperties extends TouchableWithoutFeedbackProperties { +export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps { /** * Determines what the opacity of the wrapped view should be when touch is active. */ @@ -4671,16 +4703,14 @@ export interface TouchableHighlightProperties extends TouchableWithoutFeedbackPr * * @see https://facebook.github.io/react-native/docs/touchablehighlight.html */ -export interface TouchableHighlightStatic - extends NativeMethodsMixin, - TimerMixin, - TouchableMixin, - React.ClassicComponentClass {} +declare class TouchableHighlightComponent extends React.Component {} +declare const TouchableHighlightBase: Constructor & Constructor & Constructor & typeof TouchableHighlightComponent; +export class TouchableHighlight extends TouchableHighlightBase {} /** * @see https://facebook.github.io/react-native/docs/touchableopacity.html#props */ -export interface TouchableOpacityProperties extends TouchableWithoutFeedbackProperties { +export interface TouchableOpacityProps extends TouchableWithoutFeedbackProps { /** * Determines what the opacity of the wrapped view should be when touch is active. * Defaults to 0.2 @@ -4696,11 +4726,9 @@ export interface TouchableOpacityProperties extends TouchableWithoutFeedbackProp * * @see https://facebook.github.io/react-native/docs/touchableopacity.html */ -export interface TouchableOpacityStatic - extends TimerMixin, - TouchableMixin, - NativeMethodsMixin, - React.ClassicComponentClass { +declare class TouchableOpacityComponent extends React.Component {} +declare const TouchableOpacityBase: Constructor & Constructor & Constructor & typeof TouchableOpacityComponent; +export class TouchableOpacity extends TouchableOpacityBase { /** * Animate the touchable to a new opacity. */ @@ -4727,7 +4755,7 @@ type BackgroundPropType = RippleBackgroundPropType | ThemeAttributeBackgroundPro /** * @see https://facebook.github.io/react-native/docs/touchableopacity.html#props */ -export interface TouchableNativeFeedbackProperties extends TouchableWithoutFeedbackProperties { +export interface TouchableNativeFeedbackProps extends TouchableWithoutFeedbackProps { /** * Determines the type of background drawable that's going to be used to display feedback. * It takes an object with type property and extra data depending on the type. @@ -4756,9 +4784,9 @@ export interface TouchableNativeFeedbackProperties extends TouchableWithoutFeedb * * @see https://facebook.github.io/react-native/docs/touchablenativefeedback.html#content */ -export interface TouchableNativeFeedbackStatic - extends TouchableMixin, - React.ClassicComponentClass { +declare class TouchableNativeFeedbackComponent extends React.Component {} +declare const TouchableNativeFeedbackBase: Constructor & typeof TouchableNativeFeedbackComponent; +export class TouchableNativeFeedback extends TouchableNativeFeedbackBase { /** * Creates an object that represents android theme's default background for * selectable elements (?android:attr/selectableItemBackground). @@ -5121,7 +5149,7 @@ export interface ListViewDataSource { /** * @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props */ -export interface TabBarItemProperties extends ViewProperties { +export interface TabBarIOSItemProps extends ViewProps { /** * Little red bubble that sits at the top right of the icon. */ @@ -5191,12 +5219,12 @@ export interface TabBarItemProperties extends ViewProperties { title?: string; } -export interface TabBarItemStatic extends React.ComponentClass {} +export class TabBarIOSItem extends React.Component {} /** * @see https://facebook.github.io/react-native/docs/tabbarios.html#props */ -export interface TabBarIOSProperties extends ViewProperties { +export interface TabBarIOSProps extends ViewProps { /** * Background color of the tab bar */ @@ -5234,8 +5262,8 @@ export interface TabBarIOSProperties extends ViewProperties { unselectedItemTintColor?: string; } -export interface TabBarIOSStatic extends React.ComponentClass { - Item: TabBarItemStatic; +export class TabBarIOS extends React.Component { + static Item: typeof TabBarIOSItem; } export interface PixelRatioStatic { @@ -5724,7 +5752,7 @@ interface ScrollResponderMixin extends SubscribableMixin { scrollResponderKeyboardDidHide(e: ScrollResponderEvent): void; } -export interface ScrollViewPropertiesIOS { +export interface ScrollViewPropsIOS { /** * When true the scroll view bounces horizontally when it reaches the end * even if the content is smaller than the scroll view itself. The default @@ -5782,7 +5810,7 @@ export interface ScrollViewPropertiesIOS { * Used to manually set the starting scroll offset. * The default value is {x: 0, y: 0} */ - contentOffset?: PointProperties; // zeros + contentOffset?: PointPropType; // zeros /** * This property specifies how the safe area insets are used to modify the content area of the scroll view. @@ -5886,7 +5914,7 @@ export interface ScrollViewPropertiesIOS { zoomScale?: number; } -export interface ScrollViewPropertiesAndroid { +export interface ScrollViewPropsAndroid { /** * Sometimes a scrollview takes up more space than its content fills. * When this is the case, this prop will fill the rest of the @@ -5916,10 +5944,10 @@ export interface ScrollViewPropertiesAndroid { overScrollMode?: "auto" | "always" | "never"; } -export interface ScrollViewProperties - extends ViewProperties, - ScrollViewPropertiesIOS, - ScrollViewPropertiesAndroid, +export interface ScrollViewProps + extends ViewProps, + ScrollViewPropsIOS, + ScrollViewPropsAndroid, Touchable { /** * These styles will be applied to the scroll view content container which @@ -6035,12 +6063,12 @@ export interface ScrollViewProperties * A RefreshControl component, used to provide pull-to-refresh * functionality for the ScrollView. */ - refreshControl?: React.ReactElement; + refreshControl?: React.ReactElement; } -export interface ScrollViewProps extends ScrollViewProperties {} - -interface ScrollViewStatic extends ScrollResponderMixin, React.ComponentClass { +declare class ScrollViewComponent extends React.Component {} +declare const ScrollViewBase: Constructor & typeof ScrollViewComponent; +export class ScrollView extends ScrollViewBase { /** * Scrolls to a given x, y offset, either immediately or with a smooth animation. * Syntax: @@ -6111,7 +6139,7 @@ export interface NativeScrollEvent { zoomScale: number; } -export interface SnapshotViewIOSProperties extends ViewProperties { +export interface SnapshotViewIOSProps extends ViewProps { // A callback when the Snapshot view is ready to be compared onSnapshotReady(): any; @@ -6119,7 +6147,9 @@ export interface SnapshotViewIOSProperties extends ViewProperties { testIdentifier: string; } -export interface SnapshotViewIOSStatic extends NativeMethodsMixin, React.ComponentClass {} +declare class SnapshotViewIOSComponent extends React.Component {} +declare const SnapshotViewIOSBase: Constructor & typeof SnapshotViewIOSComponent; +export class SnapshotViewIOS extends SnapshotViewIOSBase {} // Deduced from // https://github.com/facebook/react-native/commit/052cd7eb8afa7a805ef13e940251be080499919c @@ -6190,7 +6220,7 @@ export interface SwipeableListViewProps { * - It can bounce the 1st row of the list so users know it's swipeable * - More to come */ -export interface SwipeableListViewStatic extends React.ComponentClass { +export class SwipeableListView extends React.Component { getNewDataSource(): SwipeableListViewDataSource; } @@ -6639,7 +6669,7 @@ export interface BackHandlerStatic { removeEventListener(eventName: BackPressEventName, handler: () => void): void; } -export interface ButtonProperties { +export interface ButtonProps { title: string; onPress: () => any; color?: string; @@ -6652,7 +6682,7 @@ export interface ButtonProperties { testID?: string; } -export interface ButtonStatic extends React.ComponentClass {} +export class Button extends React.Component {} export type CameraRollGroupType = "Album" | "All" | "Event" | "Faces" | "Library" | "PhotoStream" | "SavedPhotos"; export type CameraRollAssetType = "All" | "Videos" | "Photos"; @@ -6790,7 +6820,7 @@ export interface ClipboardStatic { setString(content: string): void; } -export interface DatePickerAndroidOpenOption { +export interface DatePickerAndroidOpenOptions { date?: Date | number; minDate?: Date | number; maxDate?: Date | number; @@ -6806,22 +6836,25 @@ export interface DatePickerAndroidOpenReturn { } export interface DatePickerAndroidStatic { - /* - Opens the standard Android date picker dialog. - - The available keys for the options object are: - * date (Date object or timestamp in milliseconds) - date to show by default - * minDate (Date object or timestamp in milliseconds) - minimum date that can be selected - * maxDate (Date object or timestamp in milliseconds) - maximum date that can be selected - - Returns a Promise which will be invoked an object containing action, year, month (0-11), day if the user picked - a date. If the user dismissed the dialog, the Promise will still be resolved with action being - DatePickerAndroid.dismissedAction and all the other keys being undefined. Always check whether the action before - reading the values. - - Note the native date picker dialog has some UI glitches on Android 4 and lower when using the minDate and maxDate options. - */ - open(options?: DatePickerAndroidOpenOption): Promise; + /** + * Opens the standard Android date picker dialog. + * + * The available keys for the options object are: + * - date (Date object or timestamp in milliseconds) - date to show by default + * - minDate (Date or timestamp in milliseconds) - minimum date that can be selected + * - maxDate (Date object or timestamp in milliseconds) - maximum date that can be selected + * - mode (enum('calendar', 'spinner', 'default')) - To set the date-picker mode to calendar/spinner/default + * - 'calendar': Show a date picker in calendar mode. + * - 'spinner': Show a date picker in spinner mode. + * - 'default': Show a default native date picker(spinner/calendar) based on android versions. + * + * Returns a Promise which will be invoked an object containing action, year, month (0-11), day if the user picked a date. + * If the user dismissed the dialog, the Promise will still be resolved with action being DatePickerAndroid.dismissedAction and all the other keys being undefined. + * Always check whether the action before reading the values. + * + * Note the native date picker dialog has some UI glitches on Android 4 and lower when using the minDate and maxDate options. + */ + open(options?: DatePickerAndroidOpenOptions): Promise; /** * A date has been selected. @@ -7460,7 +7493,7 @@ export type StatusBarStyle = "default" | "light-content" | "dark-content"; export type StatusBarAnimation = "none" | "fade" | "slide"; -export interface StatusBarPropertiesIOS { +export interface StatusBarPropsIOS { /** * Sets the color of the status bar text. */ @@ -7478,7 +7511,7 @@ export interface StatusBarPropertiesIOS { showHideTransition?: "fade" | "slide"; } -export interface StatusBarPropertiesAndroid { +export interface StatusBarPropsAndroid { /** * The background color of the status bar. */ @@ -7492,7 +7525,7 @@ export interface StatusBarPropertiesAndroid { translucent?: boolean; } -export interface StatusBarProperties extends StatusBarPropertiesIOS, StatusBarPropertiesAndroid { +export interface StatusBarProps extends StatusBarPropsIOS, StatusBarPropsAndroid { /** * If the transition between status bar property changes should be * animated. Supported for backgroundColor, barStyle and hidden. @@ -7505,7 +7538,7 @@ export interface StatusBarProperties extends StatusBarPropertiesIOS, StatusBarPr hidden?: boolean; } -export interface StatusBarStatic extends React.ComponentClass { +export class StatusBar extends React.Component { /** * The current height of the status bar on the device. * @platform android @@ -7728,7 +7761,7 @@ export interface UIManagerStatic { setLayoutAnimationEnabledExperimental(value: boolean): void; } -export interface SwitchPropertiesIOS extends ViewProperties { +export interface SwitchPropsIOS extends ViewProps { /** * Background color when the switch is turned on. */ @@ -7745,7 +7778,7 @@ export interface SwitchPropertiesIOS extends ViewProperties { tintColor?: string; } -export interface SwitchProperties extends SwitchPropertiesIOS { +export interface SwitchProps extends SwitchPropsIOS { /** * If true the user won't be able to toggle the switch. * Default value is false. @@ -7778,7 +7811,9 @@ export interface SwitchProperties extends SwitchPropertiesIOS { * 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. */ -export interface SwitchStatic extends NativeMethodsMixin, React.ClassicComponentClass {} +declare class SwitchComponent extends React.Component {} +declare const SwitchBase: Constructor & typeof SwitchComponent; +export class Switch extends SwitchBase {} /** * NOTE: `VibrationIOS` is being deprecated. Use `Vibration` instead. @@ -8414,22 +8449,22 @@ export interface ARTSurfaceProps { height: number; } -export interface ClippingRectangleStatic extends React.ComponentClass {} +export class ClippingRectangle extends React.Component {} -export interface GroupStatic extends React.ComponentClass {} +export class Group extends React.Component {} -export interface ShapeStatic extends React.ComponentClass {} +export class Shape extends React.Component {} -export interface SurfaceStatic extends React.ComponentClass {} +export class Surface extends React.Component {} -export interface ARTTextStatic extends React.ComponentClass {} +export class ARTText extends React.Component {} export interface ARTStatic { - ClippingRectangle: ClippingRectangleStatic; - Group: GroupStatic; - Shape: ShapeStatic; - Surface: SurfaceStatic; - Text: ARTTextStatic; + ClippingRectangle: typeof ClippingRectangle; + Group: typeof Group; + Shape: typeof Shape; + Surface: typeof Surface; + Text: typeof ARTText; } export interface KeyboardStatic extends NativeEventEmitter { @@ -8447,138 +8482,18 @@ export interface KeyboardStatic extends NativeEventEmitter { export const ART: ARTStatic; export type ART = ARTStatic; -export const ActivityIndicator: ActivityIndicatorStatic; -export type ActivityIndicator = ActivityIndicatorStatic; - -export const ActivityIndicatorIOS: ActivityIndicatorIOSStatic; -export type ActivityIndicatorIOS = ActivityIndicatorIOSStatic; - -export const DatePickerIOS: DatePickerIOSStatic; -export type DatePickerIOS = DatePickerIOSStatic; - -export const DrawerLayoutAndroid: DrawerLayoutAndroidStatic; -export type DrawerLayoutAndroid = DrawerLayoutAndroidStatic; - -export const Image: ImageStatic; -export type Image = ImageStatic; - -export const ImageBackground: ImageBackgroundStatic; -export type ImageBackground = ImageBackgroundStatic; - export const ImagePickerIOS: ImagePickerIOSStatic; export type ImagePickerIOS = ImagePickerIOSStatic; -export const InputAccessoryView: InputAccessoryViewStatic; -export type InputAccessoryView = InputAccessoryViewStatic; - -export const FlatList: FlatListStatic; -export type FlatList = FlatListStatic; - export const LayoutAnimation: LayoutAnimationStatic; export type LayoutAnimation = LayoutAnimationStatic; -export const ListView: ListViewStatic; -export type ListView = ListViewStatic; - -export const MapView: MapViewStatic; -export type MapView = MapViewStatic; - -export const MaskedViewIOS: MaskedViewStatic; -export type MaskedViewIOS = MaskedViewStatic; - -export const Modal: ModalStatic; -export type Modal = ModalStatic; - -export const NavigatorIOS: NavigatorIOSStatic; -export type NavigatorIOS = NavigatorIOSStatic; - -export const Picker: PickerStatic; -export type Picker = PickerStatic; - -export const PickerIOS: PickerIOSStatic; -export type PickerIOS = PickerIOSStatic; - -export const ProgressBarAndroid: ProgressBarAndroidStatic; -export type ProgressBarAndroid = ProgressBarAndroidStatic; - -export const ProgressViewIOS: ProgressViewIOSStatic; -export type ProgressViewIOS = ProgressViewIOSStatic; - -export const RefreshControl: RefreshControlStatic; -export type RefreshControl = RefreshControlStatic; - -export const RecyclerViewBackedScrollView: RecyclerViewBackedScrollViewStatic; -export type RecyclerViewBackedScrollView = RecyclerViewBackedScrollViewStatic; - -export const SafeAreaView: SafeAreaViewStatic; -export type SafeAreaView = SafeAreaViewStatic; - -export const SegmentedControlIOS: SegmentedControlIOSStatic; -export type SegmentedControlIOS = SegmentedControlIOSStatic; - -export const Slider: SliderStatic; -export type Slider = SliderStatic; - -export const SliderIOS: SliderStatic; -export type SliderIOS = SliderStatic; - -export const StatusBar: StatusBarStatic; -export type StatusBar = StatusBarStatic; - -export const ScrollView: ScrollViewStatic; -export type ScrollView = ScrollViewStatic; - export const SectionList: SectionListStatic; export type SectionList = SectionListStatic; -export const SnapshotViewIOS: SnapshotViewIOSStatic; -export type SnapshotViewIOS = SnapshotViewIOSStatic; - export const Systrace: SystraceStatic; export type Systrace = SystraceStatic; -export const SwipeableListView: SwipeableListViewStatic; -export type SwipeableListView = SwipeableListViewStatic; - -export const Switch: SwitchStatic; -export type Switch = SwitchStatic; - -export const SwitchIOS: SwitchIOSStatic; -export type SwitchIOS = SwitchIOSStatic; - -export const TabBarIOS: TabBarIOSStatic; -export type TabBarIOS = TabBarIOSStatic; - -export const Text: TextStatic; -export type Text = TextStatic; - -export const TextInput: TextInputStatic; -export type TextInput = TextInputStatic; - -export const ToolbarAndroid: ToolbarAndroidStatic; -export type ToolbarAndroid = ToolbarAndroidStatic; - -export const TouchableHighlight: TouchableHighlightStatic; -export type TouchableHighlight = TouchableHighlightStatic; - -export const TouchableNativeFeedback: TouchableNativeFeedbackStatic; -export type TouchableNativeFeedback = TouchableNativeFeedbackStatic; - -export const TouchableOpacity: TouchableOpacityStatic; -export type TouchableOpacity = TouchableOpacityStatic; - -export const TouchableWithoutFeedback: TouchableWithoutFeedbackStatic; -export type TouchableWithoutFeedback = TouchableWithoutFeedbackStatic; - -export const View: ViewStatic; -export type View = ViewStatic; - -export const ViewPagerAndroid: ViewPagerAndroidStatic; -export type ViewPagerAndroid = ViewPagerAndroidStatic; - -export const WebView: WebViewStatic; -export type WebView = WebViewStatic; - //////////// APIS ////////////// export const ActionSheetIOS: ActionSheetIOSStatic; export type ActionSheetIOS = ActionSheetIOSStatic; @@ -8616,9 +8531,6 @@ export type BackAndroid = BackAndroidStatic; export const BackHandler: BackHandlerStatic; export type BackHandler = BackHandlerStatic; -export const Button: ButtonStatic; -export type Button = ButtonStatic; - export const CameraRoll: CameraRollStatic; export type CameraRoll = CameraRollStatic; @@ -8648,9 +8560,6 @@ export type IntentAndroid = IntentAndroidStatic; export const Keyboard: KeyboardStatic; -export const KeyboardAvoidingView: KeyboardAvoidingViewStatic; -export type KeyboardAvoidingView = KeyboardAvoidingViewStatic; - export const Linking: LinkingStatic; export type Linking = LinkingStatic; diff --git a/types/react-native/legacy-properties.d.ts b/types/react-native/legacy-properties.d.ts new file mode 100644 index 0000000000..eae30f65c7 --- /dev/null +++ b/types/react-native/legacy-properties.d.ts @@ -0,0 +1,286 @@ +import { + LayoutProps, + TextProps, + TextPropsIOS, + TextPropsAndroid, + AccessibilityProps, + AccessibilityPropsIOS, + AccessibilityPropsAndroid, + TextInputProps, + TextInputIOSProps, + TextInputAndroidProps, + ViewProps, + ViewPropsIOS, + ViewPropsAndroid, + ToolbarAndroidProps, + ViewPagerAndroidProps, + WebViewProps, + WebViewPropsIOS, + WebViewPropsAndroid, + SegmentedControlIOSProps, + ScrollViewProps, + ScrollViewPropsIOS, + ScrollViewPropsAndroid, + InputAccessoryViewProps, + NavigatorIOSProps, + ActivityIndicatorProps, + ActivityIndicatorIOSProps, + DatePickerIOSProps, + DrawerLayoutAndroidProps, + PickerItemProps, + PickerIOSItemProps, + PickerProps, + PickerPropsIOS, + PickerPropsAndroid, + PickerIOSProps, + ProgressBarAndroidProps, + ProgressViewIOSProps, + RefreshControlProps, + RefreshControlPropsIOS, + RefreshControlPropsAndroid, + RecyclerViewBackedScrollViewProps, + SliderProps, + SliderPropsIOS, + SliderPropsAndroid, + SwitchIOSProps, + ImageSourcePropType, + ImageProps, + ImagePropsIOS, + ImagePropsAndroid, + ImageBackgroundProps, + FlatListProps, + VirtualizedListProps, + SectionListProps, + ListViewProps, + MapViewProps, + MaskedViewIOSProps, + ModalProps, + TouchableWithoutFeedbackProps, + TouchableHighlightProps, + TouchableOpacityProps, + TouchableNativeFeedbackProps, + TabBarIOSItemProps, + TabBarIOSProps, + SnapshotViewIOSProps, + ButtonProps, + StatusBarProps, + StatusBarPropsIOS, + StatusBarPropsAndroid, + SwitchProps, + SwitchPropsIOS +} from "react-native"; + +declare module "react-native" { + /* + * Previously, props interfaces where named *Properties + * They have been renamed to *Props to match React Native documentation + * The following lines ensure compatibility with *Properties and should be removed in the future + */ + + /** @deprecated Use LayoutProps */ + export type LayoutProperties = LayoutProps; + + /** @deprecated Use TextProps */ + export type TextProperties = TextProps; + + /** @deprecated Use TextPropsIOS */ + export type TextPropertiesIOS = TextPropsIOS; + + /** @deprecated Use TextPropsAndroid */ + export type TextPropertiesAndroid = TextPropsAndroid; + + /** @deprecated Use AccessibilityProps */ + export type AccessibilityProperties = AccessibilityProps; + + /** @deprecated Use AccessibilityPropsIOS */ + export type AccessibilityPropertiesIOS = AccessibilityPropsIOS; + + /** @deprecated Use AccessibilityPropsAndroid */ + export type AccessibilityPropertiesAndroid = AccessibilityPropsAndroid; + + /** @deprecated Use TextInputProps */ + export type TextInputProperties = TextInputProps; + + /** @deprecated Use TextInputIOSProps */ + export type TextInputIOSProperties = TextInputIOSProps; + + /** @deprecated Use TextInputAndroidProps */ + export type TextInputAndroidProperties = TextInputAndroidProps; + + /** @deprecated Use ViewProps */ + export type ViewProperties = ViewProps; + + /** @deprecated Use ViewPropsIOS */ + export type ViewPropertiesIOS = ViewPropsIOS; + + /** @deprecated Use ViewPropsAndroid */ + export type ViewPropertiesAndroid = ViewPropsAndroid; + + /** @deprecated Use ToolbarAndroidProps */ + export type ToolbarAndroidProperties = ToolbarAndroidProps; + + /** @deprecated Use ViewPagerAndroidProps */ + export type ViewPagerAndroidProperties = ViewPagerAndroidProps; + + /** @deprecated Use WebViewProps */ + export type WebViewProperties = WebViewProps; + + /** @deprecated Use WebViewPropsIOS */ + export type WebViewPropertiesIOS = WebViewPropsIOS; + + /** @deprecated Use WebViewPropsAndroid */ + export type WebViewPropertiesAndroid = WebViewPropsAndroid; + + /** @deprecated Use SegmentedControlIOSProps */ + export type SegmentedControlIOSProperties = SegmentedControlIOSProps; + + /** @deprecated Use ScrollViewProps */ + export type ScrollViewProperties = ScrollViewProps; + + /** @deprecated Use ScrollViewPropsIOS */ + export type ScrollViewPropertiesIOS = ScrollViewPropsIOS; + + /** @deprecated Use ScrollViewPropsAndroid */ + export type ScrollViewPropertiesAndroid = ScrollViewPropsAndroid; + + /** @deprecated Use InputAccessoryViewProps */ + export type InputAccessoryViewProperties = InputAccessoryViewProps; + + /** @deprecated Use NavigatorIOSProps */ + export type NavigatorIOSProperties = NavigatorIOSProps; + + /** @deprecated Use ActivityIndicatorProps */ + export type ActivityIndicatorProperties = ActivityIndicatorProps; + + /** @deprecated Use ActivityIndicatorIOSProps */ + export type ActivityIndicatorIOSProperties = ActivityIndicatorIOSProps; + + /** @deprecated Use DatePickerIOSProps */ + export type DatePickerIOSProperties = DatePickerIOSProps; + + /** @deprecated Use DrawerLayoutAndroidProps */ + export type DrawerLayoutAndroidProperties = DrawerLayoutAndroidProps; + + /** @deprecated Use PickerItemProps */ + export type PickerItemProperties = PickerItemProps; + + /** @deprecated Use PickerIOSItemProps */ + export type PickerIOSItemProperties = PickerIOSItemProps; + + /** @deprecated Use PickerProps */ + export type PickerProperties = PickerProps; + + /** @deprecated Use PickerPropsIOS */ + export type PickerPropertiesIOS = PickerPropsIOS; + + /** @deprecated Use PickerPropsAndroid */ + export type PickerPropertiesAndroid = PickerPropsAndroid; + + /** @deprecated Use PickerIOSProps */ + export type PickerIOSProperties = PickerIOSProps; + + /** @deprecated Use ProgressBarAndroidProps */ + export type ProgressBarAndroidProperties = ProgressBarAndroidProps; + + /** @deprecated Use ProgressViewIOSProps */ + export type ProgressViewIOSProperties = ProgressViewIOSProps; + + /** @deprecated Use RefreshControlProps */ + export type RefreshControlProperties = RefreshControlProps; + + /** @deprecated Use RefreshControlPropsIOS */ + export type RefreshControlPropertiesIOS = RefreshControlPropsIOS; + + /** @deprecated Use RefreshControlPropsAndroid */ + export type RefreshControlPropertiesAndroid = RefreshControlPropsAndroid; + + /** @deprecated Use RecyclerViewBackedScrollViewProps */ + export type RecyclerViewBackedScrollViewProperties = RecyclerViewBackedScrollViewProps; + + /** @deprecated Use SliderProps */ + export type SliderProperties = SliderProps; + + /** @deprecated Use SliderPropsIOS */ + export type SliderPropertiesIOS = SliderPropsIOS; + + /** @deprecated Use SliderPropsAndroid */ + export type SliderPropertiesAndroid = SliderPropsAndroid; + + /** @deprecated Use SwitchIOSProps */ + export type SwitchIOSProperties = SwitchIOSProps; + + /** @deprecated Use ImageSourcePropType */ + export type ImagePropertiesSourceOptions = ImageSourcePropType; + + /** @deprecated Use ImageProps */ + export type ImageProperties = ImageProps; + + /** @deprecated Use ImagePropsIOS */ + export type ImagePropertiesIOS = ImagePropsIOS; + + /** @deprecated Use ImagePropsAndroid */ + export type ImagePropertiesAndroid = ImagePropsAndroid; + + /** @deprecated Use ImageBackgroundProps */ + export type ImageBackgroundProperties = ImageBackgroundProps; + + /** @deprecated Use FlatListProps */ + export type FlatListProperties = FlatListProps; + + /** @deprecated Use VirtualizedListProps */ + export type VirtualizedListProperties = VirtualizedListProps; + + /** @deprecated Use SectionListProps */ + export type SectionListProperties = SectionListProps; + + /** @deprecated Use ListViewProps */ + export type ListViewProperties = ListViewProps; + + /** @deprecated Use MapViewProps */ + export type MapViewProperties = MapViewProps; + + /** @deprecated Use MaskedViewIOSProps */ + export type MaskedViewIOSProperties = MaskedViewIOSProps; + + /** @deprecated Use ModalProps */ + export type ModalProperties = ModalProps; + + /** @deprecated Use TouchableWithoutFeedbackProps */ + export type TouchableWithoutFeedbackProperties = TouchableWithoutFeedbackProps; + + /** @deprecated Use TouchableHighlightProps */ + export type TouchableHighlightProperties = TouchableHighlightProps; + + /** @deprecated Use TouchableOpacityProps */ + export type TouchableOpacityProperties = TouchableOpacityProps; + + /** @deprecated Use TouchableNativeFeedbackProps */ + export type TouchableNativeFeedbackProperties = TouchableNativeFeedbackProps; + + /** @deprecated Use TabBarIOSItemProps */ + export type TabBarIOSItemProperties = TabBarIOSItemProps; + + /** @deprecated Use TabBarIOSProps */ + export type TabBarIOSProperties = TabBarIOSProps; + + /** @deprecated Use SnapshotViewIOSProps */ + export type SnapshotViewIOSProperties = SnapshotViewIOSProps; + + /** @deprecated Use ButtonProps */ + export type ButtonProperties = ButtonProps; + + /** @deprecated Use StatusBarProps */ + export type StatusBarProperties = StatusBarProps; + + /** @deprecated Use StatusBarPropsIOS */ + export type StatusBarPropertiesIOS = StatusBarPropsIOS; + + /** @deprecated Use StatusBarPropsAndroid */ + export type StatusBarPropertiesAndroid = StatusBarPropsAndroid; + + /** @deprecated Use SwitchProps */ + export type SwitchProperties = SwitchProps; + + /** @deprecated Use SwitchPropsIOS */ + export type SwitchPropertiesIOS = SwitchPropsIOS; +} diff --git a/types/react-native/test/ART.tsx b/types/react-native/test/ART.tsx new file mode 100644 index 0000000000..86fa48ca88 --- /dev/null +++ b/types/react-native/test/ART.tsx @@ -0,0 +1,29 @@ +import * as React from "react"; +import * as ReactNative from "react-native"; + +// See https://github.com/react-native-china/react-native-ART-doc/blob/6ba9c0f7c7e495a12045f3d7061834d2c74413c5/doc.md + +const { + Surface, + Shape, + Group, + Text, + ClippingRectangle +} = ReactNative.ART + +class Test extends React.Component { + render() { + return ( + + + + + + ) + } +} diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 8d3925d4bd..31cbc5a50e 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -31,15 +31,15 @@ import { Systrace, Text, TextStyle, - TextProperties, + TextProps, View, ViewStyle, ViewPagerAndroid, FlatList, - FlatListProperties, + FlatListProps, ScaledSize, SectionList, - SectionListProperties, + SectionListProps, findNodeHandle, ScrollView, ScrollViewProps, @@ -235,7 +235,7 @@ InteractionManager.runAfterInteractions(() => { // ... }).then(() => "done"); -export class FlatListTest extends React.Component, {}> { +export class FlatListTest extends React.Component, {}> { _renderItem = (rowData: any) => { return ( @@ -257,7 +257,7 @@ export class FlatListTest extends React.Component, {} } } -export class SectionListTest extends React.Component, {}> { +export class SectionListTest extends React.Component, {}> { render() { const sections = [ { @@ -293,7 +293,7 @@ export class SectionListTest extends React.Component { +export class CapsLockComponent extends React.Component { render() { const content = (this.props.children || "") as string; return {content.toUpperCase()}; @@ -318,7 +318,7 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi throw new Error("Expected scroll to be enabled."); } - return ; + return ; }} renderRow={({ type, data }, _, row) => { return Filler; @@ -412,3 +412,24 @@ const dataSourceAssetCallback2: DataSourceAssetCallback = {}; const deviceEventEmitterStatic: DeviceEventEmitterStatic = null; deviceEventEmitterStatic.addListener("keyboardWillShow", data => true); deviceEventEmitterStatic.addListener("keyboardWillShow", data => true, {}); + + +class TextInputRefTest extends React.Component<{}, {username: string}> { + username: TextInput | null = null; + + handleUsernameChange(text: string) { + } + + render() { + return ( + + this.username.focus()}>Username + this.username = input} + value={this.state.username} + onChangeText={this.handleUsernameChange.bind(this)} + /> + + ); + } +} diff --git a/types/react-native/test/legacy-properties.tsx b/types/react-native/test/legacy-properties.tsx new file mode 100644 index 0000000000..1637cb207c --- /dev/null +++ b/types/react-native/test/legacy-properties.tsx @@ -0,0 +1,5 @@ +import * as React from "react"; +import { TextInputProperties } from "react-native"; + +class Test extends React.Component { +} diff --git a/types/react-native/tsconfig.json b/types/react-native/tsconfig.json index 508ac06f1a..16c6bf9275 100644 --- a/types/react-native/tsconfig.json +++ b/types/react-native/tsconfig.json @@ -21,6 +21,8 @@ "index.d.ts", "test/index.tsx", "test/animated.tsx", - "test/init-example.tsx" + "test/init-example.tsx", + "test/ART.tsx", + "test/legacy-properties.tsx" ] } \ No newline at end of file diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index a054ecf4d0..db45006ef0 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -32,7 +32,7 @@ import * as React from 'react'; import { Animated, TextStyle, - ViewProperties, + ViewProps, ViewStyle, StyleProp, } from 'react-native'; @@ -926,7 +926,7 @@ export function withNavigationFocus( * SafeAreaView Component */ export type SafeAreaViewForceInsetValue = 'always' | 'never'; -export interface SafeAreaViewProps extends ViewProperties { +export interface SafeAreaViewProps extends ViewProps { forceInset?: { top?: SafeAreaViewForceInsetValue; bottom?: SafeAreaViewForceInsetValue; diff --git a/types/react-router-native/react-router-native-tests.tsx b/types/react-router-native/react-router-native-tests.tsx index 5b7dcfa4e7..7ae1b10653 100644 --- a/types/react-router-native/react-router-native-tests.tsx +++ b/types/react-router-native/react-router-native-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { StyleSheet, Text, TouchableOpacity, TouchableOpacityProperties, View } from 'react-native'; +import { StyleSheet, Text, TouchableOpacity, TouchableOpacityProps, View } from 'react-native'; import { AndroidBackButton, BackButton, Link, NativeRouter as Router, Route } from 'react-router-native'; const Home: React.SFC = () => { @@ -24,7 +24,7 @@ const About: React.SFC = () => { ); }; -interface ButtonTextProps extends TouchableOpacityProperties { +interface ButtonTextProps extends TouchableOpacityProps { text: string; } diff --git a/types/react-router-navigation/index.d.ts b/types/react-router-navigation/index.d.ts index c69a172c43..62258b4b6c 100644 --- a/types/react-router-navigation/index.d.ts +++ b/types/react-router-navigation/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.6 import { Component, ReactNode, ReactElement, ComponentClass } from "react"; -import { StyleProp, ViewProperties, ViewStyle, TextStyle } from "react-native"; +import { StyleProp, ViewProps, ViewStyle, TextStyle } from "react-native"; import { TabViewAnimated, TabViewPagerPan } from "react-native-tab-view"; import { RouteProps } from "react-router-navigation-core"; import { @@ -128,7 +128,7 @@ export class BottomNavigation extends Component< renderSceneView: (sceneProps: TabSubViewProps) => ReactNode; - renderScene: (sceneProps: TabSubViewProps) => ReactElement; + renderScene: (sceneProps: TabSubViewProps) => ReactElement; } export function Card(props: CardProps): ReactElement;