diff --git a/react-native-scrollable-tab-view/index.d.ts b/react-native-scrollable-tab-view/index.d.ts index 9287ede79d..873d69855b 100644 --- a/react-native-scrollable-tab-view/index.d.ts +++ b/react-native-scrollable-tab-view/index.d.ts @@ -7,7 +7,8 @@ import * as React from 'react'; import { Animated, - ViewStyle + ViewStyle, + ScrollViewProperties } from 'react-native'; export interface onChangeTabProperties { @@ -85,7 +86,7 @@ interface ScrollableTabViewProperties extends React.Props { * contentProps (Object) - 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?: React.ScrollViewProperties; + contentProps?: ScrollViewProperties; /** * scrollWithoutAnimation (Bool) - on tab press change tab without animation. diff --git a/react-native/index.d.ts b/react-native/index.d.ts index 29dd9fa780..aeb57d82eb 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -18,10 +18,10 @@ import * as React from 'react'; -export = React; +export = ReactNative; +export as namespace ReactNative -//react-native "extends" react -declare module "react" { +declare namespace ReactNative { export type MeasureOnSuccessCallback = ( x: number, y: number, @@ -334,7 +334,7 @@ declare module "react" { blur(): void; refs: { - [key: string]: Component + [key: string]: React.Component }; } @@ -1193,7 +1193,7 @@ declare module "react" { */ value?: string - ref?: Ref + ref?: React.Ref } /** @@ -1359,7 +1359,7 @@ declare module "react" { */ titleColor?: string - ref?: Ref + ref?: React.Ref } /** @@ -1858,7 +1858,7 @@ declare module "react" { */ keyboardVerticalOffset?: number - ref?: Ref + ref?: React.Ref } /** @@ -2092,7 +2092,7 @@ declare module "react" { */ scalesPageToFit?: boolean - ref?: Ref + ref?: React.Ref } @@ -2181,7 +2181,7 @@ declare module "react" { */ values?: string[] - ref?: Ref + ref?: React.Ref } /** @@ -2360,10 +2360,10 @@ declare module "react" { style?: ViewStyle - ref?: Ref + ref?: React.Ref } - export interface ActivityIndicatorStatic extends React.NativeMethodsMixin, React.ClassicComponentClass { + export interface ActivityIndicatorStatic extends NativeMethodsMixin, React.ClassicComponentClass { } @@ -2402,7 +2402,7 @@ declare module "react" { style?: ViewStyle - ref?: Ref + ref?: React.Ref } /** @@ -2458,10 +2458,10 @@ declare module "react" { */ timeZoneOffsetInMinutes?: number - ref?: Ref + ref?: React.Ref } - export interface DatePickerIOSStatic extends React.NativeMethodsMixin, React.ComponentClass { + export interface DatePickerIOSStatic extends NativeMethodsMixin, React.ComponentClass { } export interface DrawerSlideEvent extends NativeSyntheticEvent { @@ -2561,7 +2561,7 @@ declare module "react" { */ statusBarBackgroundColor?: string - ref?: Ref + ref?: React.Ref } interface DrawerPosition { @@ -2621,7 +2621,7 @@ declare module "react" { */ itemStyle?: ViewStyle, - ref?: Ref + ref?: React.Ref } export interface PickerPropertiesAndroid extends ViewProperties, React.Props { @@ -2649,7 +2649,7 @@ declare module "react" { */ prompt?: string - ref?: Ref + ref?: React.Ref } /** @@ -2681,7 +2681,7 @@ declare module "react" { */ testId?: string - ref?: Ref + ref?: React.Ref } /** @@ -2712,7 +2712,7 @@ declare module "react" { onValueChange?: ( value: string | number ) => void selectedValue?: string | number - ref?: Ref + ref?: React.Ref } /** @@ -2763,7 +2763,7 @@ declare module "react" { */ testID?: string - ref?: Ref + ref?: React.Ref } /** * React component that wraps the Android-only `ProgressBar`. This component is used to indicate @@ -2808,7 +2808,7 @@ declare module "react" { */ trackImage?: ImageURISource | ImageURISource[] - ref?: Ref + ref?: React.Ref } export interface ProgressViewIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass { } @@ -2830,7 +2830,7 @@ declare module "react" { */ titleColor?: string - ref?: Ref + ref?: React.Ref } export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props { @@ -2861,7 +2861,7 @@ declare module "react" { */ progressViewOffset?: number - ref?: Ref + ref?: React.Ref } export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props { @@ -2876,7 +2876,7 @@ declare module "react" { */ refreshing: boolean - ref?: Ref + ref?: React.Ref } /** @@ -2892,7 +2892,7 @@ declare module "react" { } export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProperties, React.Props { - ref?: Ref + ref?: React.Ref } /** @@ -2975,7 +2975,7 @@ declare module "react" { */ trackImage?: ImageURISource - ref?: Ref + ref?: React.Ref } export interface SliderProperties extends SliderPropertiesIOS, React.Props { @@ -3075,7 +3075,7 @@ declare module "react" { */ value?: boolean - ref?: Ref + ref?: React.Ref } /** @@ -3352,7 +3352,7 @@ declare module "react" { } - export interface ImageStatic extends React.NativeMethodsMixin, React.ComponentClass { + export interface ImageStatic extends NativeMethodsMixin, React.ComponentClass { resizeMode: ImageResizeMode getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any prefetch(url: string): any @@ -3493,7 +3493,7 @@ declare module "react" { */ stickyHeaderIndices?: number[] - ref?: Ref + ref?: React.Ref } @@ -3545,12 +3545,12 @@ declare module "react" { onBlur?: () => any, title?: string subtitle?: string - leftCalloutView?: ReactElement - rightCalloutView?: ReactElement - detailCalloutView?: ReactElement + leftCalloutView?: React.ReactElement + rightCalloutView?: React.ReactElement + detailCalloutView?: React.ReactElement tintColor?: string image?: ImageURISource - view?: ReactElement + view?: React.ReactElement hasLeftCallout?: boolean hasRightCallout?: boolean onLeftCalloutPress?: () => void @@ -3695,13 +3695,13 @@ declare module "react" { */ zoomEnabled?: boolean - ref?: Ref + ref?: React.Ref } /** * @see https://facebook.github.io/react-native/docs/mapview.html#content */ - export interface MapViewStatic extends React.NativeMethodsMixin, React.ComponentClass { + export interface MapViewStatic extends NativeMethodsMixin, React.ComponentClass { PinColors: { RED: string, GREEN: string, @@ -4814,7 +4814,7 @@ declare module "react" { */ title?: string - ref?: Ref + ref?: React.Ref } export interface TabBarItemStatic extends React.ComponentClass { @@ -4856,7 +4856,7 @@ declare module "react" { */ unselectedTintColor?: string - ref?: Ref + ref?: React.Ref } export interface TabBarIOSStatic extends React.ComponentClass { @@ -5624,11 +5624,11 @@ declare module "react" { */ refreshControl?: React.ReactElement - ref?: Ref + ref?: React.Ref } export interface ScrollViewProps extends ScrollViewProperties, React.Props { - ref?: Ref + ref?: React.Ref } interface ScrollViewStatic extends ScrollResponderMixin, React.ComponentClass { @@ -5700,7 +5700,7 @@ declare module "react" { // A name to identify the individual instance to the SnapshotView testIdentifier : string, - ref?: Ref + ref?: React.Ref } export interface SnapshotViewIOSStatic extends NativeMethodsMixin, React.ComponentClass {} @@ -6144,7 +6144,7 @@ declare module "react" { disabled?: boolean; } - export interface ButtonStatic extends ComponentClass { + export interface ButtonStatic extends React.ComponentClass { } export type CameraRollGroupType = "Album" | "All" | "Event" | "Faces" | "Library" | "PhotoStream" | "SavedPhotos"; @@ -7036,7 +7036,7 @@ declare module "react" { * @platform ios */ takeSnapshot: ( - view ?: 'window' | ReactElement | number, + view ?: 'window' | React.ReactElement | number, options ?: { width ?: number, height ?: number, @@ -7063,7 +7063,7 @@ declare module "react" { */ tintColor?: string - ref?: Ref + ref?: React.Ref } export interface SwitchProperties extends SwitchPropertiesIOS, React.Props { @@ -8356,13 +8356,13 @@ declare module "react" { // // Prop Types // - export var ColorPropType: Requireable - export var EdgeInsetsPropType: Requireable - export var PointPropType: Requireable + export var ColorPropType: React.Requireable + export var EdgeInsetsPropType: React.Requireable + export var PointPropType: React.Requireable } declare global { - const global: React.GlobalStatic; + const global: ReactNative.GlobalStatic; function require(name: string): any; /** diff --git a/react-native/test/index.tsx b/react-native/test/index.tsx index 32bcbe931b..7a3b4b513d 100644 --- a/react-native/test/index.tsx +++ b/react-native/test/index.tsx @@ -11,11 +11,13 @@ The content of index.io.js could be something like For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer */ -import * as React from 'react-native' +import * as React from 'react' import { StyleSheet, Text, + TextStyle, View, + ViewStyle, AppState, AppStateIOS, ViewPagerAndroid, @@ -43,9 +45,9 @@ BackAndroid.addEventListener("hardwareBackPress", () => { }); interface LocalStyles { - container: React.ViewStyle; - welcome: React.TextStyle; - instructions: React.TextStyle; + container: ViewStyle; + welcome: TextStyle; + instructions: TextStyle; } var styles = StyleSheet.create( @@ -77,17 +79,17 @@ const stylesAlt = StyleSheet.create( justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', - } as React.ViewStyle, + } as ViewStyle, welcome: { fontSize: 20, textAlign: 'center', margin: 10, - } as React.TextStyle, + } as TextStyle, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, - } as React.TextStyle + } as TextStyle } )