diff --git a/types/color/index.d.ts b/types/color/index.d.ts index 83302cc38d..0b7b505c01 100644 --- a/types/color/index.d.ts +++ b/types/color/index.d.ts @@ -66,6 +66,7 @@ declare namespace Color { keyword(): string | undefined; hex(color: string): Color; hex(): string; + rgb(): Color; rgbNumber(): number; luminosity(): number; contrast(color: Color): number; diff --git a/types/graphlib/graphlib-tests.ts b/types/graphlib/graphlib-tests.ts index 114deef66a..d808f1ec2e 100644 --- a/types/graphlib/graphlib-tests.ts +++ b/types/graphlib/graphlib-tests.ts @@ -23,6 +23,7 @@ function test_graph() { g.setDefaultEdgeLabel(() => 'e42'); g.setNodes(['a', 'b', 'c'], 42); g.setParent('d', 'a'); + g.setParent('d'); g.parent('d'); g.children('a'); g.filterNodes(v => true); diff --git a/types/graphlib/index.d.ts b/types/graphlib/index.d.ts index 773cb621d1..3f35b82112 100644 --- a/types/graphlib/index.d.ts +++ b/types/graphlib/index.d.ts @@ -65,7 +65,8 @@ declare module "graphlib" { setNodes(names: string[], label?: any): Graph; /** - * Sets node p as a parent for node v. Method throws an exception in case of + * Sets node p as a parent for node v if it is defined, or removes the + * parent for v if p is undefined. Method throws an exception in case of * invoking it in context of noncompound graph. * Average-case complexity: O(1). * @@ -73,7 +74,7 @@ declare module "graphlib" { * @argument p - node to be parent for v. * @returns the graph, allowing this to be chained with other functions. */ - setParent(v: string, p: string): Graph; + setParent(v: string, p?: string): Graph; /** * Gets parent node for node v. diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index 0cbe0ba202..467981c2fc 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -16,21 +16,28 @@ declare module "react-datepicker" { dateFormat?: string; dateFormatCalendar?: string; disabled?: boolean; + dropdownMode?: string; endDate?: moment.Moment; excludeDates?: any[]; filterDate?(): any; fixedHeight?: boolean; + forceShowMonthNavigation?: boolean; + highlightDates?: any[]; id?: string; includeDates?: any[]; + inline?: boolean; isClearable?: boolean; locale?: string; maxDate?: moment.Moment; minDate?: moment.Moment; + monthsShown?: number; name?: string; onBlur?(event: React.FocusEvent): void; onChange(date: moment.Moment | null, event: React.SyntheticEvent | undefined): any; onChangeRaw?(event: React.FocusEvent): void; onFocus?(event: React.FocusEvent): void; + onMonthChange?(date: moment.Moment): void; + openToDate?: moment.Moment; peekNextMonth?: boolean; placeholderText?: string; popoverAttachment?: string; diff --git a/types/react-native-sortable-list/react-native-sortable-list-tests.tsx b/types/react-native-sortable-list/react-native-sortable-list-tests.tsx index 57a59b8d20..91be1dfed4 100644 --- a/types/react-native-sortable-list/react-native-sortable-list-tests.tsx +++ b/types/react-native-sortable-list/react-native-sortable-list-tests.tsx @@ -8,8 +8,9 @@ import { Image, View, Dimensions, - FlexJustifyType, - FlexAlignType + ViewStyle, + TextStyle, + ImageStyle, } from 'react-native'; import SortableList, {RowProps} from 'react-native-sortable-list'; @@ -61,20 +62,20 @@ const data = { const styles = StyleSheet.create({ container: { flex: 1, - justifyContent: "center" as FlexJustifyType, - alignItems: "center" as FlexAlignType, + justifyContent: 'center', + alignItems: 'center', backgroundColor: '#eee', paddingTop: 60, - }, + } as ViewStyle, list: { flex: 1, - }, + } as ViewStyle, contentContainer: { width: window.width, paddingHorizontal: 30, - }, + } as ViewStyle, row: { flexDirection: 'row', @@ -89,18 +90,18 @@ const styles = StyleSheet.create({ shadowOpacity: 1, shadowOffset: {height: 2, width: 2}, shadowRadius: 2, - }, + } as ViewStyle, image: { width: 60, height: 60, marginRight: 30, borderRadius: 30, - }, + } as ImageStyle, text: { fontSize: 24, - }, + } as TextStyle, }); diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index e282f17191..84a58f9212 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-native 0.42 +// Type definitions for react-native 0.43 // Project: https://github.com/facebook/react-native // Definitions by: Eloy DurĂ¡n +// Fedor Nezhivoi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -531,9 +532,7 @@ export interface LayoutAnimationStatic { spring: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void } -export type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch" | "baseline"; -export type FlexJustifyType = "flex-start" | "flex-end" | "center" | "space-between" | "space-around"; -export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse"; +type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch" | "baseline"; /** * Flex Prop Types @@ -541,9 +540,9 @@ export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse"; * @see LayoutPropTypes.js */ export interface FlexStyle { - - alignItems?: FlexAlignType; - alignSelf?: "auto" | FlexAlignType; + alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" + alignItems?: FlexAlignType + alignSelf?: "auto" | FlexAlignType borderBottomWidth?: number borderLeftWidth?: number borderRightWidth?: number @@ -551,18 +550,14 @@ export interface FlexStyle { borderWidth?: number bottom?: number | string flex?: number + flexBasis?: number | string + flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" flexGrow?: number flexShrink?: number - flexBasis?: number | string - flexDirection?: FlexDirection flexWrap?: "wrap" | "nowrap" height?: number | string - justifyContent?: FlexJustifyType + justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" left?: number | string - minWidth?: number | string - maxWidth?: number | string - minHeight?: number | string - maxHeight?: number | string margin?: number | string marginBottom?: number | string marginHorizontal?: number | string @@ -570,6 +565,10 @@ export interface FlexStyle { marginRight?: number | string marginTop?: number | string marginVertical?: number | string + maxHeight?: number | string + maxWidth?: number | string + minHeight?: number | string + minWidth?: number | string overflow?: "visible" | "hidden" | "scroll" padding?: number | string paddingBottom?: number | string @@ -582,11 +581,12 @@ export interface FlexStyle { right?: number | string top?: number | string width?: number | string + zIndex?: number /** * @platform ios */ - zIndex?: number + direction?: 'inherit' | 'ltr' | 'rtl' } /** @@ -7156,6 +7156,57 @@ export interface UIManagerStatic { quality ?: number, } ) => Promise + + /** + * Determines the location on screen, width, and height of the given view and + * returns the values via an async callback. If successful, the callback will + * be called with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * Note that these measurements are not available until after the rendering + * has been completed in native. If you need the measurements as soon as + * possible, consider using the [`onLayout` + * prop](docs/view.html#onlayout) instead. + */ + measure(node: number, callback: MeasureOnSuccessCallback): void; + + /** + * Determines the location of the given view in the window and returns the + * values via an async callback. If the React root view is embedded in + * another native view, this will give you the absolute coordinates. If + * successful, the callback will be called with the following + * arguments: + * + * - x + * - y + * - width + * - height + * + * Note that these measurements are not available until after the rendering + * has been completed in native. + */ + measureInWindow(node: number, callback: MeasureInWindowOnSuccessCallback): void; + + /** + * Like [`measure()`](#measure), but measures the view relative an ancestor, + * specified as `relativeToNativeNode`. This means that the returned x, y + * are relative to the origin x, y of the ancestor view. + * + * As always, to obtain a native node handle for a component, you can use + * `React.findNodeHandle(component)`. + */ + measureLayout( + node: number, + relativeToNativeNode: number, + onFail: () => void, /* currently unused */ + onSuccess: MeasureLayoutOnSuccessCallback + ): void; } export interface SwitchPropertiesIOS extends ViewProperties, React.Props {