From 5a3d3f6fbdca6de33271dae7e4b4a56b0fe9ffe0 Mon Sep 17 00:00:00 2001 From: Andy Shu Xin Date: Sun, 19 Jun 2016 11:00:06 +0800 Subject: [PATCH] RN: Fix typo and flukes (#9665) * RN: add props definition for WebView * RN: Add platform-specific props to WebView * RN: Add getWebViewHandle method * RN: add source props to WebView * RN: fix type of decelerationRate * RN: Update Picker.Item props * RN: Update props name * RN: Clarify mode range * RN: Add definition for DrawerLayoutAndroid * RN: Update Image * RN: Update ListView * RN: Update MapView to 0.25 * RN: Add Modal * RN: Update ScrollView * RN: Add SegmentedControlIOS * RN: Add Slider * RN: Update SliderIOS * RN: Define Status Bar * RN: export StatusBar * RN: Define Switch * RN: Update Text * RN: Update TextInput * RN: Add ToolbarAndroid * RN: Update TouchableOpacity * RN: Update TouchableWithoutFeedback * RN: Update View * RN: Update ViewPagerAndroid * RN: Fix mistakes * RN: Unify indentation * Add 2 components; fix some minor problems * fix: follow the convention * RN: Update ActionSheetIOS * RN: Add Alert api * RN: Fix reference * RN: Update AlertIOS * RN: add typing for type parameter * RN: Update AppRegistry * RN: Update AppState and AppStateIOS * RN: Add BackAndroid * RN: Update Camera Roll * RN: Add Clipboard * RN: Add DatePickerAndroid * RN: Update Dimensions * RN: Update InteractionManager * RN: Add methods to DrawerLayoutAndroid * RN: Export DatePickerAndroid * RN: Add IntentAndroid * RN: Add Linking * RN: Add LinkingIOS * RN: Add NetInfo * RN: Update PixelRatio * RN: Update PushNotificationIOS * RN: Update StyleSheet * RN: Add TimePickerAndroid * RN: Update ToastAndroid * RN: Add Vibration * RN: Set stricter definition for flexbox props * RN: Define ShadowPropTypesIOSStatic * RN: Fix indentation * RN: Add Geolocation * RN: Export Geolocation * RN: Move Geolocation to proper position * RN: Define fetch * RN: Fix tabs * RN: Define schedulers * RN: Major fixes from @PublicParadise * RN: Update version * RN: Add documentation as comments * RN: Add more comments * fix: typo * add some missing callbacks * RN: Export switch * add missing commentes * Fix(Switch): add style property * RN: Update Navigation Experimental * RN: Define SwipableListView * RN: Add necessary marks * RN: Improve unclear typing * RN: Enable pagingEnabled for ScrollView * RN: Enable returnKeyType for both platforms * RN: Add returnKeyLabel to Android * RN: Add a prop * RN: Add scrollEnabled prop in 0.27 * RN: Add new prop from 0.27 * RN: Fix typo * RN: Remove redundant export * RN: Fix typo * RN: Add missing definitions * RN: Fix missing type declarations * Annotate params --- react-native/react-native-tests.tsx | 19 +++++++++++++++---- react-native/react-native.d.ts | 29 +++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index 6079637ce6..d33918dbd6 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -51,7 +51,13 @@ function testDimensions() { BackAndroid.addEventListener("hardwareBackPress", () => { }); -var styles = StyleSheet.create( +interface LocalStyles { + container: React.ViewStyle; + welcome: React.TextStyle; + instructions: React.TextStyle; +} + +var styles = StyleSheet.create( { container: { flex: 1, @@ -74,13 +80,18 @@ var styles = StyleSheet.create( class Welcome extends React.Component { - + + refs: { + [key: string]: any + rootView: View + } + testNativeMethods() { - this.setNativeProps({}); + // this.setNativeProps({}); const { rootView } = this.refs; - rootView.measure((x, y, width, height) => { + rootView.measure((x: number, y: number, width: number, height: number) => { }); } diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index d0bbf5aea8..8be6ac8d56 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -5522,7 +5522,7 @@ declare namespace __React { } export interface NavigationHeaderProps { - renderTitleComponent?(props: Object): JSX.element + renderTitleComponent?(props: Object): JSX.Element } export interface NavigationHeaderStatic extends React.ComponentClass { @@ -5535,7 +5535,7 @@ declare namespace __React { style?: ViewStyle navigationState?: any onNavigate(action: Object): boolean - renderScene?(props): JSX.Element + renderScene?(props: any /* undocumented on 0.27 */): JSX.Element } export interface NavigationCardStackStatic extends React.ComponentClass { @@ -5547,6 +5547,26 @@ declare namespace __React { Header: NavigationHeaderStatic; Reducer: NavigationReducerStatic; } + + export interface NavigationContainerProps { + tabs: NavigationTab[]; + index: number; + } + + export interface NavigationContainerStatic extends React.ComponentClass { + create(inClass: any): any; + } + + export interface NavigationRootContainerProps extends React.Props { + renderNavigation: NavigationRenderer; + reducer: NavigationReducerStatic; + persistenceKey?: string; + } + + export interface NavigationRootContainerStatic extends React.ComponentClass { + getBackAction(): NavigationAction; + handleNavigation( action: NavigationAction ): boolean; + } ////////////////////////////////////////////////////////////////////////// // @@ -5618,7 +5638,7 @@ declare namespace __React { export type StyleSheet = StyleSheetStatic export var SwipeableListView: SwipeableListViewStatic - export type SwipeableListView = SwipeableListViewStatci + export type SwipeableListView = SwipeableListViewStatic export var Switch: SwitchStatic export type Switch = SwitchStatic @@ -5741,9 +5761,6 @@ declare namespace __React { export type NavigationReducer = NavigationReducerStatic; export var NavigationReducer: NavigationReducerStatic; - - export type SwipeableListView = SwipeableListViewStatic; - export var SwipeableListView: SwipeableListViewStatic; export type Easing = EasingStatic; export var Easing: EasingStatic;