From 29e1a843c288692a5c4925721c0e9c95ea9aa188 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Tue, 12 Jul 2016 01:09:21 +0900 Subject: [PATCH] let the following interfaces extend `ViewProperties`: - ActivityIndicatorIOSProperties - ActivityIndicatorProperties - DatePickerIOSProperties - DrawerLayoutAndroidProperties - PickerProperties - MapViewProperties - ProgressBarAndroidProperties - ProgressViewIOSProperties - RefreshControlProperties - ScrollViewProperties - ListViewProperties - SegmentedControlIOSProperties - SliderProperties - SliderIOSProperties - TabBarIOSProperties - TabBarItemProperties - SwitchProperties - SwitchPropertiesIOS - WebViewProperties --- react-native/react-native.d.ts | 91 +++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 23 deletions(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 0ffc6763a7..bfb977ffed 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -918,7 +918,7 @@ declare namespace __React { showWithText?: boolean } - export interface ToolbarAndroidProperties extends React.Props { + export interface ToolbarAndroidProperties extends ViewProperties, React.Props { actions?: ToolbarAndroidAction[] /** @@ -1000,6 +1000,8 @@ declare namespace __React { * Sets the toolbar title color. */ titleColor?: string + + ref?: Ref } export interface ToolbarAndroidStatic extends React.ComponentClass { @@ -1479,7 +1481,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/webview.html#props */ - export interface WebViewProperties extends WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props { + export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props { automaticallyAdjustContentInsets?: boolean @@ -1553,6 +1555,8 @@ declare namespace __React { * sets whether the webpage scales to fit the view and the user can change the scale */ scalesPageToFit?: boolean + + ref?: Ref } @@ -1590,7 +1594,7 @@ declare namespace __React { target: number } - export interface SegmentedControlIOSProperties extends React.Props { + export interface SegmentedControlIOSProperties extends ViewProperties, React.Props { /** * If false the user won't be able to interact with the control. Default value is true. @@ -1630,6 +1634,8 @@ declare namespace __React { * The labels for the control's segment buttons, in order. */ values?: string[] + + ref?: Ref } export interface SegmentedControlIOSStatic extends React.ComponentClass { @@ -1744,7 +1750,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/activityindicator.html#props */ - export interface ActivityIndicatorProperties extends React.Props { + export interface ActivityIndicatorProperties extends ViewProperties, React.Props { /** * Whether to show the indicator (true, the default) or hide it (false). @@ -1770,6 +1776,8 @@ declare namespace __React { size?: 'small' | 'large' style?: ViewStyle + + ref?: Ref } export interface ActivityIndicatorStatic extends React.ComponentClass { @@ -1779,7 +1787,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props */ - export interface ActivityIndicatorIOSProperties extends React.Props { + export interface ActivityIndicatorIOSProperties extends ViewProperties, React.Props { /** * Whether to show the indicator (true, the default) or hide it (false). @@ -1810,6 +1818,8 @@ declare namespace __React { size?: 'small' | 'large' style?: ViewStyle + + ref?: Ref } /** @@ -1819,7 +1829,7 @@ declare namespace __React { } - export interface DatePickerIOSProperties extends React.Props { + export interface DatePickerIOSProperties extends ViewProperties, React.Props { /** * The currently selected date. @@ -1865,6 +1875,7 @@ declare namespace __React { */ timeZoneOffsetInMinutes?: number + ref?: Ref } export interface DatePickerIOSStatic extends React.ComponentClass { @@ -1876,7 +1887,7 @@ declare namespace __React { /** * @see DrawerLayoutAndroid.android.js */ - export interface DrawerLayoutAndroidProperties extends React.Props { + export interface DrawerLayoutAndroidProperties extends ViewProperties, React.Props { /** * Specifies the background color of the drawer. The default value @@ -1967,6 +1978,7 @@ declare namespace __React { */ statusBarBackgroundColor?: any + ref?: Ref } export interface DrawerLayoutAndroidStatic extends React.ComponentClass { @@ -2010,18 +2022,22 @@ declare namespace __React { export interface PickerItemStatic extends React.ComponentClass { } - export interface PickerPropertiesIOS extends React.Props { + export interface PickerPropertiesIOS extends ViewProperties, React.Props { itemStyle?: ViewStyle + + ref?: Ref } - export interface PickerPropertiesAndroid extends React.Props { + export interface PickerPropertiesAndroid extends ViewProperties, React.Props { enabled?: boolean mode?: "dialog" | "dropdown" prompt?: string + + ref?: Ref } /** @@ -2052,6 +2068,8 @@ declare namespace __React { * Used to locate this view in end-to-end tests. */ testId?: string + + ref?: Ref } /** @@ -2086,7 +2104,7 @@ declare namespace __React { * @see https://facebook.github.io/react-native/docs/progressbarandroid.html * @see ProgressBarAndroid.android.js */ - export interface ProgressBarAndroidProperties extends React.Props { + export interface ProgressBarAndroidProperties extends ViewProperties, React.Props { style?: ViewStyle @@ -2122,6 +2140,8 @@ declare namespace __React { * Used to locate this view in end-to-end tests. */ testID?: string + + ref?: Ref } export interface ProgressBarAndroidStatic extends React.ComponentClass { } @@ -2130,7 +2150,7 @@ declare namespace __React { * @see https://facebook.github.io/react-native/docs/progressviewios.html * @see ProgressViewIOS.ios.js */ - export interface ProgressViewIOSProperties extends React.Props { + export interface ProgressViewIOSProperties extends ViewProperties, React.Props { style?: ViewStyle @@ -2163,11 +2183,13 @@ declare namespace __React { * A stretchable image to display behind the progress bar. */ trackImage?: any + + ref?: Ref } export interface ProgressViewIOSStatic extends React.ComponentClass { } - export interface RefreshControlPropertiesIOS extends React.Props { + export interface RefreshControlPropertiesIOS extends ViewProperties, React.Props { /** * The color of the refresh indicator. @@ -2183,9 +2205,11 @@ declare namespace __React { * Title color. */ titleColor?: string + + ref?: Ref } - export interface RefreshControlPropertiesAndroid extends React.Props { + export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props { /** * The colors (at least one) that will be used to draw the refresh indicator. @@ -2212,6 +2236,8 @@ declare namespace __React { * @platform android */ progressViewOffset?: number + + ref?: Ref } export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props { @@ -2225,13 +2251,15 @@ declare namespace __React { * Whether the view should be indicating an active refresh. */ refreshing?: boolean + + ref?: Ref } export interface RefreshControlStatic extends React.ComponentClass { SIZE: Object // Undocumented } - export interface SliderPropertiesIOS extends React.Props { + export interface SliderPropertiesIOS extends ViewProperties, React.Props { /** * Assigns a maximum track image. Only static images are supported. @@ -2268,6 +2296,8 @@ declare namespace __React { * to fill the track. */ trackImage?: any + + ref?: Ref } export interface SliderProperties extends SliderPropertiesIOS, React.Props { @@ -2333,7 +2363,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/sliderios.html */ - export interface SliderIOSProperties extends React.Props { + export interface SliderIOSProperties extends ViewProperties, React.Props { /** * If true the user won't be able to move the slider. Default value is false. @@ -2393,6 +2423,8 @@ declare namespace __React { * This is not a controlled component, e.g. if you don't update the value, the component won't be reset to its inital value. */ value?: number + + ref?: Ref } export interface SliderIOSStatic extends React.ComponentClass { @@ -2721,6 +2753,8 @@ declare namespace __React { * pixels. */ scrollRenderAheadDistance?: number + + ref?: Ref } export interface ListViewStatic extends React.ComponentClass { @@ -2815,7 +2849,7 @@ declare namespace __React { active?: boolean } - export interface MapViewProperties extends MapViewPropertiesIOS, MapViewPropertiesAndroid, Touchable, React.Props { + export interface MapViewProperties extends MapViewPropertiesIOS, MapViewPropertiesAndroid, Touchable, ViewProperties, React.Props { @@ -2884,6 +2918,8 @@ declare namespace __React { * Default value is true. */ zoomEnabled?: boolean + + ref?: Ref } /** @@ -3502,7 +3538,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props */ - export interface TabBarItemProperties extends React.Props { + export interface TabBarItemProperties extends ViewProperties, React.Props { /** * Little red bubble that sits at the top right of the icon. @@ -3549,6 +3585,7 @@ declare namespace __React { */ title?: string + ref?: Ref } export interface TabBarItemStatic extends React.ComponentClass { @@ -3557,7 +3594,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/tabbarios.html#props */ - export interface TabBarIOSProperties extends React.Props { + export interface TabBarIOSProperties extends ViewProperties, React.Props { /** * Background color of the tab bar @@ -3580,6 +3617,8 @@ declare namespace __React { * Color of text on unselected tabs */ unselectedTintColor?: string + + ref?: Ref } export interface TabBarIOSStatic extends React.ComponentClass { @@ -3959,7 +3998,7 @@ declare namespace __React { } - export interface ScrollViewProperties extends ScrollViewPropertiesIOS, ScrollViewPropertiesAndroid, Touchable { + export interface ScrollViewProperties extends ViewProperties, ScrollViewPropertiesIOS, ScrollViewPropertiesAndroid, Touchable, React.Props { /** * These styles will be applied to the scroll view content container which @@ -4043,10 +4082,12 @@ declare namespace __React { * functionality for the ScrollView. */ refreshControl?: RefreshControl + + ref?: Ref } export interface ScrollViewProps extends ScrollViewProperties, React.Props { - + ref?: Ref } interface ScrollViewStatic extends React.ComponentClass { @@ -5084,7 +5125,7 @@ declare namespace __React { LONG: number } - export interface SwitchPropertiesIOS extends React.Props { + export interface SwitchPropertiesIOS extends ViewProperties, React.Props { /** * Background color when the switch is turned on. @@ -5100,9 +5141,11 @@ declare namespace __React { * Background color when the switch is turned off. */ tintColor?: string + + ref?: Ref } - export interface SwitchProperties extends React.Props { + export interface SwitchProperties extends ViewProperties, React.Props { /** * If true the user won't be able to toggle the switch. @@ -5126,7 +5169,9 @@ declare namespace __React { */ value?: boolean - style?: ViewStyle + style?: ViewStyle + + ref?: Ref } export interface SwitchStatic extends React.ComponentClass {