[react-native] Switch to *real* components + rename Properties to Props (#25307)

* Switch from var to const

* import React instead of /// <reference types="react" />

* Fix TextInput and remove TextInputStatic

See #16318 [react-native] Wrong type for component ref

* Remove TextStatic

* Remove ActivityIndicatorStatic

* Remove ActivityIndicatorIOSStatic

* Remove DatePickerIOSStatic

* Remove DrawerLayoutAndroidStatic

* Remove ImageStatic

* Remove ImageBackgroundStatic

* Remove InputAccessoryViewStatic

* Remove ListViewStatic

* Remove MapViewStatic

* Remove MaskedViewStatic

* Remove ModalStatic

* Remove NavigatorIOSStatic

* Remove PickerStatic

* Remove PickerIOSStatic

* Remove ProgressBarAndroidStatic

* Remove ProgressViewIOSStatic

* Remove RefreshControlStatic

* Remove RecyclerViewBackedScrollViewStatic

* Remove SafeAreaViewStatic

* Remove SegmentedControlIOSStatic

* Remove SliderStatic

* Remove StatusBarStatic

* Remove ScrollViewStatic

* Remove SnapshotViewIOSStatic

* Remove SwipeableListViewStatic

* Remove SwitchStatic

* Remove SwitchIOSStatic

* Remove TabBarIOSStatic

* Remove ToolbarAndroidStatic

* Remove TouchableHighlightStatic

* Remove TouchableNativeFeedbackStatic

* Remove TouchableOpacityStatic

* Remove TouchableWithoutFeedbackStatic

* Remove ViewStatic

* Remove ViewPagerAndroidStatic

* Remove WebViewStatic

* Remove ButtonStatic

* Remove ClippingRectangleStatic, GroupStatic, ShapeStatic, SurfaceStatic, ARTTextStatic, ARTTextStatic

* Remove KeyboardAvoidingViewStatic

* Remove FlatListStatic

* Rename TextProperties and friends to *Props

* Rename TextInputProperties and friends to *Props

* Rename WebViewProperties and friends to *Props

* Rename *Properties to *Props

* Rename ScrollViewProperties and friends to *Props

* Improve DatePickerAndroid.open()

* Rename ImagePropertiesSourceOptions to ImageSourcePropType

* Rename MaskedViewProps to MaskedViewIOSProps

* Rename PointProperties to PointPropType

* Rename TabBarItem to TabBarIOSItem

* Remove internal *Properties

* ImagePropertiesSourceOptions => ImagePropsSourceOptions

* Merge fail: react-native-linear-gradient has been removed

* Rename ImageProperties to ImageProps

* Update authors list

* Remove ImagePropsSourceOptions

* Move *Properties redirections to legacy-properties.d.ts
This commit is contained in:
Tanguy Krotoff 2018-04-26 19:30:30 +02:00 committed by Wesley Wigham
parent b67b2df1d9
commit 4abbfb42ff
24 changed files with 660 additions and 408 deletions

10
types/expo/index.d.ts vendored
View File

@ -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<BarCodeScannerProps> {
/**
* 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<string[]>; // 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;
}

View File

@ -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<AppLoadingProperties> { }
/**
* 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<BarCodeScannerProps> { }
/**
* 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<string[]>; // 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;
}

View File

@ -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<BarCodeScannerProps> {
/**
* 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<string[]>; // 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;
}

View File

@ -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';

View File

@ -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.
*/

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<any>) => void;
}
export default class ReactNativePhotoView extends React.Component<ReactNativePhotoViewProps & ViewProperties> {}
export default class ReactNativePhotoView extends React.Component<ReactNativePhotoViewProps & ViewProps> {}

View File

@ -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<ScrollableTabView> {
/**
@ -88,7 +88,7 @@ export interface ScrollableTabViewProperties extends React.Props<ScrollableTabVi
* props that are applied to root ScrollView/ViewPagerAndroid.
* Note that overriding defaults set by the library may break functionality; see the source for details.
*/
contentProps?: ScrollViewProperties;
contentProps?: ScrollViewProps;
/**
* on tab press change tab without animation.

View File

@ -13,15 +13,15 @@ import {
NativeSyntheticEvent,
NativeScrollEvent,
StyleProp,
ScrollViewProperties,
ScrollViewProps,
ScrollViewStyle,
ViewStyle,
ImageProperties,
FlatListProperties
ImageProps,
FlatListProps
} from 'react-native';
export interface AdditionalParallaxProps {
carouselRef?: React.Component<FlatListProperties<any>>;
carouselRef?: React.Component<FlatListProps<any>>;
itemHeight?: number;
itemWidth?: number;
scrollPosition?: Animated.Value;
@ -30,7 +30,7 @@ export interface AdditionalParallaxProps {
vertical?: boolean;
}
export interface CarouselProps<T> extends React.Props<ScrollViewProperties> {
export interface CarouselProps<T> extends React.Props<ScrollViewProps> {
// Required
/**
@ -278,9 +278,9 @@ export interface CarouselStatic<T> extends React.ComponentClass<CarouselProps<T>
triggerRenderingHack(offset: number): void;
}
export type CarouselProperties<T> = ScrollViewProperties & CarouselProps<T> & React.Props<CarouselStatic<T>>;
export type CarouselProperties<T> = ScrollViewProps & CarouselProps<T> & React.Props<CarouselStatic<T>>;
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<FlatListProperties<any>>;
carouselRef?: React.Component<FlatListProps<any>>;
/**
* Style for dots' container that will be merged with the default one
*/

View File

@ -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<IconProps, any> {
export namespace Icon {
class ToolbarAndroid extends React.Component<ToolbarAndroidProps, any> {}
class TabBarItem extends React.Component<TabBarItemProperties, any> {}
class TabBarItem extends React.Component<TabBarItemIOSProps, any> {}
class TabBarItemIOS extends React.Component<TabBarItemIOSProps, any> {}
class Button extends React.Component<IconButtonProps, any> {}
}

View File

@ -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

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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<ItemT> = FlatListProps<ItemT>;
/** @deprecated Use VirtualizedListProps */
export type VirtualizedListProperties<ItemT> = VirtualizedListProps<ItemT>;
/** @deprecated Use SectionListProps */
export type SectionListProperties<ItemT> = SectionListProps<ItemT>;
/** @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;
}

View File

@ -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 (
<Surface width={200} height={200}>
<ClippingRectangle
width={ 20 }
height={ 20 }
x={ 100 }
y={ 100 }
>
<Shape d={ /*new Path().moveTo(0,0).lineTo(200,200)*/ 'fixme' } stroke="black" strokeWidth={10}/>
</ClippingRectangle>
</Surface>
)
}
}

View File

@ -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<FlatListProperties<number>, {}> {
export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
_renderItem = (rowData: any) => {
return (
<View>
@ -257,7 +257,7 @@ export class FlatListTest extends React.Component<FlatListProperties<number>, {}
}
}
export class SectionListTest extends React.Component<SectionListProperties<string>, {}> {
export class SectionListTest extends React.Component<SectionListProps<string>, {}> {
render() {
const sections = [
{
@ -293,7 +293,7 @@ export class SectionListTest extends React.Component<SectionListProperties<strin
}
}
export class CapsLockComponent extends React.Component<TextProperties> {
export class CapsLockComponent extends React.Component<TextProps> {
render() {
const content = (this.props.children || "") as string;
return <Text {...this.props}>{content.toUpperCase()}</Text>;
@ -318,7 +318,7 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
throw new Error("Expected scroll to be enabled.");
}
return <ScrollView {...props} style={[scrollViewStyle1.scrollView, scrollViewStyle2]} />;
return <ScrollView horizontal={true} contentOffset={{x: 0, y: 0}} {...props} style={[scrollViewStyle1.scrollView, scrollViewStyle2]} />;
}}
renderRow={({ type, data }, _, row) => {
return <Text>Filler</Text>;
@ -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 (
<View>
<Text onPress={() => this.username.focus()}>Username</Text>
<TextInput
ref={input => this.username = input}
value={this.state.username}
onChangeText={this.handleUsernameChange.bind(this)}
/>
</View>
);
}
}

View File

@ -0,0 +1,5 @@
import * as React from "react";
import { TextInputProperties } from "react-native";
class Test extends React.Component<TextInputProperties> {
}

View File

@ -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"
]
}

View File

@ -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<T = {}>(
* SafeAreaView Component
*/
export type SafeAreaViewForceInsetValue = 'always' | 'never';
export interface SafeAreaViewProps extends ViewProperties {
export interface SafeAreaViewProps extends ViewProps {
forceInset?: {
top?: SafeAreaViewForceInsetValue;
bottom?: SafeAreaViewForceInsetValue;

View File

@ -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;
}

View File

@ -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<ViewProperties>;
renderScene: (sceneProps: TabSubViewProps) => ReactElement<ViewProps>;
}
export function Card(props: CardProps): ReactElement<CardProps>;