зеркало из https://github.com/microsoft/reactxp.git
Revert "packages updated to point to react-16 (#294)"
This reverts commit 6675ae94a4
.
This commit is contained in:
Родитель
6675ae94a4
Коммит
6b7026749b
10
package.json
10
package.json
|
@ -10,8 +10,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/lodash": "^4.14.66",
|
"@types/lodash": "^4.14.66",
|
||||||
"@types/react": "^16.0.0",
|
"@types/react": "^15.4.1",
|
||||||
"@types/react-dom": "^15.5.5",
|
"@types/react-dom": "^15.4.1",
|
||||||
"assert": "^1.3.0",
|
"assert": "^1.3.0",
|
||||||
"ifvisible.js": "^1.0.6",
|
"ifvisible.js": "^1.0.6",
|
||||||
"lodash": "^4.17.1",
|
"lodash": "^4.17.1",
|
||||||
|
@ -21,10 +21,10 @@
|
||||||
"synctasks": "^0.2.9"
|
"synctasks": "^0.2.9"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.0.0",
|
"react": "^15.4.1",
|
||||||
"react-dom": "^16.0.0",
|
"react-dom": "^15.4.1",
|
||||||
"react-native": "^0.46.0",
|
"react-native": "^0.46.0",
|
||||||
"react-native-windows": "^0.46.0-rc.0"
|
"react-native-windows": "^0.33.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "2.6.0-dev.20170826",
|
"typescript": "2.6.0-dev.20170826",
|
||||||
|
|
|
@ -24,7 +24,7 @@ export abstract class Alert {
|
||||||
options?: Types.AlertOptions): void;
|
options?: Types.AlertOptions): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AnimatedComponent<P extends Types.CommonProps<any>, T> extends React.Component<P, T> {
|
export abstract class AnimatedComponent<P extends Types.CommonProps, T> extends React.Component<P, T> {
|
||||||
abstract setNativeProps(props: P): void;
|
abstract setNativeProps(props: P): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -448,12 +448,12 @@ export enum AccessibilityTrait {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommonStyledProps<S, T> extends CommonProps<T> {
|
export interface CommonStyledProps<T> extends CommonProps {
|
||||||
style?: StyleRuleSetRecursive<S>;
|
style?: StyleRuleSetRecursive<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button
|
// Button
|
||||||
export interface ButtonProps extends CommonStyledProps<ButtonStyleRuleSet, RX.Button>, CommonAccessibilityProps {
|
export interface ButtonProps extends CommonStyledProps<ButtonStyleRuleSet>, CommonAccessibilityProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
@ -489,7 +489,7 @@ export interface PickerPropsItem {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
export interface PickerProps extends CommonProps<RX.Picker> {
|
export interface PickerProps extends CommonProps {
|
||||||
items: PickerPropsItem[];
|
items: PickerPropsItem[];
|
||||||
selectedValue: string;
|
selectedValue: string;
|
||||||
onValueChange: (itemValue: string, itemPosition: number) => void;
|
onValueChange: (itemValue: string, itemPosition: number) => void;
|
||||||
|
@ -498,7 +498,7 @@ export interface PickerProps extends CommonProps<RX.Picker> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
export interface ImagePropsShared extends CommonProps<RX.Image> {
|
export interface ImagePropsShared extends CommonProps {
|
||||||
source: string;
|
source: string;
|
||||||
headers?: { [headerName: string]: string };
|
headers?: { [headerName: string]: string };
|
||||||
accessibilityLabel?: string;
|
accessibilityLabel?: string;
|
||||||
|
@ -531,7 +531,7 @@ export interface AnimatedImageProps extends ImagePropsShared {
|
||||||
// | I am a very |
|
// | I am a very |
|
||||||
// | important |
|
// | important |
|
||||||
// | example |
|
// | example |
|
||||||
export interface TextPropsShared extends CommonProps<RX.Text> {
|
export interface TextPropsShared extends CommonProps {
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
selectable?: boolean;
|
selectable?: boolean;
|
||||||
numberOfLines?: number;
|
numberOfLines?: number;
|
||||||
|
@ -573,7 +573,7 @@ export interface AnimatedTextProps extends TextPropsShared {
|
||||||
export type ViewLayerType = 'none' | 'software' | 'hardware';
|
export type ViewLayerType = 'none' | 'software' | 'hardware';
|
||||||
|
|
||||||
// View
|
// View
|
||||||
export interface ViewPropsShared<T> extends CommonProps<T>, CommonAccessibilityProps {
|
export interface ViewPropsShared extends CommonProps, CommonAccessibilityProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
ignorePointerEvents?: boolean;
|
ignorePointerEvents?: boolean;
|
||||||
blockPointerEvents?: boolean; // Native-only prop for disabling touches on self and all child views
|
blockPointerEvents?: boolean; // Native-only prop for disabling touches on self and all child views
|
||||||
|
@ -619,11 +619,7 @@ export interface ViewPropsShared<T> extends CommonProps<T>, CommonAccessibilityP
|
||||||
underlayColor?: string;
|
underlayColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for the ViewProps
|
export interface ViewProps extends ViewPropsShared {
|
||||||
export interface ViewProps extends ViewPropsBase<RX.View> { }
|
|
||||||
|
|
||||||
// Base interface for inheritance (ScrollView and other Views sharing the same set of props)
|
|
||||||
export interface ViewPropsBase<T> extends ViewPropsShared<T> {
|
|
||||||
style?: StyleRuleSetRecursive<ViewStyleRuleSet>;
|
style?: StyleRuleSetRecursive<ViewStyleRuleSet>;
|
||||||
onContextMenu?: (e: React.SyntheticEvent<any>) => void;
|
onContextMenu?: (e: React.SyntheticEvent<any>) => void;
|
||||||
onStartShouldSetResponder?: (e: React.SyntheticEvent<any>) => boolean;
|
onStartShouldSetResponder?: (e: React.SyntheticEvent<any>) => boolean;
|
||||||
|
@ -640,7 +636,7 @@ export interface ViewPropsBase<T> extends ViewPropsShared<T> {
|
||||||
onResponderTerminationRequest?: (e: React.SyntheticEvent<any>) => boolean;
|
onResponderTerminationRequest?: (e: React.SyntheticEvent<any>) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AnimatedViewProps extends ViewPropsShared<RX.View> {
|
export interface AnimatedViewProps extends ViewPropsShared {
|
||||||
style?: StyleRuleSetRecursive<AnimatedViewStyleRuleSet | ViewStyleRuleSet>;
|
style?: StyleRuleSetRecursive<AnimatedViewStyleRuleSet | ViewStyleRuleSet>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +711,7 @@ export enum PreferredPanGesture {
|
||||||
Vertical
|
Vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GestureViewProps extends CommonStyledProps<ViewStyleRuleSet, RX.GestureView>, CommonAccessibilityProps {
|
export interface GestureViewProps extends CommonStyledProps<ViewStyleRuleSet>, CommonAccessibilityProps {
|
||||||
// Gestures and attributes that apply only to touch inputs
|
// Gestures and attributes that apply only to touch inputs
|
||||||
onPinchZoom?: (gestureState: MultiTouchGestureState) => void;
|
onPinchZoom?: (gestureState: MultiTouchGestureState) => void;
|
||||||
onRotate?: (gestureState: MultiTouchGestureState) => void;
|
onRotate?: (gestureState: MultiTouchGestureState) => void;
|
||||||
|
@ -751,7 +747,7 @@ export interface ScrollIndicatorInsets {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScrollView
|
// ScrollView
|
||||||
export interface ScrollViewProps extends ViewPropsBase<RX.ScrollView> {
|
export interface ScrollViewProps extends ViewProps {
|
||||||
style?: StyleRuleSetRecursive<ScrollViewStyleRuleSet>;
|
style?: StyleRuleSetRecursive<ScrollViewStyleRuleSet>;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
|
|
||||||
|
@ -811,7 +807,7 @@ export interface ScrollViewProps extends ViewPropsBase<RX.ScrollView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
export interface LinkProps extends CommonStyledProps<LinkStyleRuleSet, RX.Link> {
|
export interface LinkProps extends CommonStyledProps<LinkStyleRuleSet> {
|
||||||
title?: string;
|
title?: string;
|
||||||
url: string;
|
url: string;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
|
@ -828,7 +824,7 @@ export interface LinkProps extends CommonStyledProps<LinkStyleRuleSet, RX.Link>
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextInput
|
// TextInput
|
||||||
export interface TextInputPropsShared extends CommonProps<RX.TextInput>, CommonAccessibilityProps {
|
export interface TextInputPropsShared extends CommonProps, CommonAccessibilityProps {
|
||||||
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
||||||
autoCorrect?: boolean;
|
autoCorrect?: boolean;
|
||||||
autoFocus?: boolean;
|
autoFocus?: boolean;
|
||||||
|
@ -885,7 +881,7 @@ export interface AnimatedTextInputProps extends TextInputPropsShared {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActivityIndicator
|
// ActivityIndicator
|
||||||
export interface ActivityIndicatorProps extends CommonStyledProps<ActivityIndicatorStyleRuleSet, RX.ActivityIndicator> {
|
export interface ActivityIndicatorProps extends CommonStyledProps<ActivityIndicatorStyleRuleSet> {
|
||||||
color: string;
|
color: string;
|
||||||
size?: 'large' | 'medium' | 'small' | 'tiny';
|
size?: 'large' | 'medium' | 'small' | 'tiny';
|
||||||
deferTime?: number; // Number of ms to wait before displaying
|
deferTime?: number; // Number of ms to wait before displaying
|
||||||
|
@ -920,7 +916,7 @@ export enum WebViewSandboxMode {
|
||||||
AllowTopNavigation = 1 << 9
|
AllowTopNavigation = 1 << 9
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebViewProps extends CommonStyledProps<WebViewStyleRuleSet, RX.WebView> {
|
export interface WebViewProps extends CommonStyledProps<WebViewStyleRuleSet> {
|
||||||
url: string;
|
url: string;
|
||||||
headers?: { [key: string]: string };
|
headers?: { [key: string]: string };
|
||||||
onLoad?: (e: SyntheticEvent) => void;
|
onLoad?: (e: SyntheticEvent) => void;
|
||||||
|
|
|
@ -59,10 +59,10 @@ export class Button extends React.Component<Types.ButtonProps, {}> {
|
||||||
touchableGetInitialState: () => RN.Touchable.State;
|
touchableGetInitialState: () => RN.Touchable.State;
|
||||||
touchableHandleStartShouldSetResponder: () => boolean;
|
touchableHandleStartShouldSetResponder: () => boolean;
|
||||||
touchableHandleResponderTerminationRequest: () => boolean;
|
touchableHandleResponderTerminationRequest: () => boolean;
|
||||||
touchableHandleResponderGrant: (e: React.SyntheticEvent<Button>) => void;
|
touchableHandleResponderGrant: (e: React.SyntheticEvent<any>) => void;
|
||||||
touchableHandleResponderMove: (e: React.SyntheticEvent<Button>) => void;
|
touchableHandleResponderMove: (e: React.SyntheticEvent<any>) => void;
|
||||||
touchableHandleResponderRelease: (e: React.SyntheticEvent<Button>) => void;
|
touchableHandleResponderRelease: (e: React.SyntheticEvent<any>) => void;
|
||||||
touchableHandleResponderTerminate: (e: React.SyntheticEvent<Button>) => void;
|
touchableHandleResponderTerminate: (e: React.SyntheticEvent<any>) => void;
|
||||||
|
|
||||||
private _isMounted = false;
|
private _isMounted = false;
|
||||||
private _hideTimeout: number|undefined;
|
private _hideTimeout: number|undefined;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
import React = require('react');
|
import React = require('react');
|
||||||
import RN = require('react-native');
|
import RN = require('react-native');
|
||||||
|
|
||||||
import RX = require('../common/Interfaces');
|
|
||||||
import Types= require('../common/Types');
|
import Types= require('../common/Types');
|
||||||
|
|
||||||
const _styles = {
|
const _styles = {
|
||||||
|
@ -30,7 +29,7 @@ const _styles = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface ModalContainerProps extends Types.CommonProps<RX.View> {
|
export interface ModalContainerProps extends Types.CommonProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModalContainer extends React.Component<ModalContainerProps, {}> {
|
export class ModalContainer extends React.Component<ModalContainerProps, {}> {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import assert = require('assert');
|
||||||
import React = require('react');
|
import React = require('react');
|
||||||
import RN = require('react-native');
|
import RN = require('react-native');
|
||||||
|
|
||||||
import RX = require('../common/Interfaces');
|
|
||||||
import Types = require('../common/Types');
|
import Types = require('../common/Types');
|
||||||
|
|
||||||
// Width of the "alley" around popups so they don't get too close to the boundary of the screen boundary.
|
// Width of the "alley" around popups so they don't get too close to the boundary of the screen boundary.
|
||||||
|
@ -24,7 +23,7 @@ const ALLEY_WIDTH = 2;
|
||||||
// attempting a different position?
|
// attempting a different position?
|
||||||
const MIN_ANCHOR_OFFSET = 16;
|
const MIN_ANCHOR_OFFSET = 16;
|
||||||
|
|
||||||
export interface PopupContainerViewProps extends Types.CommonProps<RX.View> {
|
export interface PopupContainerViewProps extends Types.CommonProps {
|
||||||
activePopupOptions: Types.PopupOptions;
|
activePopupOptions: Types.PopupOptions;
|
||||||
anchorHandle: number;
|
anchorHandle: number;
|
||||||
onDismissPopup?: () => void;
|
onDismissPopup?: () => void;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import RX = require('../common/Interfaces');
|
||||||
|
|
||||||
import Types = require('../common/Types');
|
import Types = require('../common/Types');
|
||||||
|
|
||||||
export abstract class ViewBase<P extends Types.ViewPropsBase<any>, S> extends RX.ViewBase<P, S> {
|
export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase<P, S> {
|
||||||
private static _defaultViewStyle: Types.ViewStyleRuleSet|undefined;
|
private static _defaultViewStyle: Types.ViewStyleRuleSet|undefined;
|
||||||
private _layoutEventValues: Types.ViewOnLayoutEvent|undefined;
|
private _layoutEventValues: Types.ViewOnLayoutEvent|undefined;
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ export var parallel: Types.Animated.ParallelFunction = function (
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function for creating wrapper AnimatedComponent around passed in component
|
// Function for creating wrapper AnimatedComponent around passed in component
|
||||||
function createAnimatedComponent<PropsType extends Types.CommonProps<any>>(Component: any): any {
|
function createAnimatedComponent<PropsType extends Types.CommonProps>(Component: any): any {
|
||||||
var refName = 'animatedNode';
|
var refName = 'animatedNode';
|
||||||
|
|
||||||
class AnimatedComponentGenerated extends React.Component<PropsType, void> implements RX.AnimatedComponent<PropsType, void> {
|
class AnimatedComponentGenerated extends React.Component<PropsType, void> implements RX.AnimatedComponent<PropsType, void> {
|
||||||
|
@ -613,11 +613,11 @@ function createAnimatedComponent<PropsType extends Types.CommonProps<any>>(Compo
|
||||||
throw 'Called setNativeProps on web AnimatedComponent';
|
throw 'Called setNativeProps on web AnimatedComponent';
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>, RX.Animated>) {
|
componentWillReceiveProps(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>>) {
|
||||||
this._updateStyles(props);
|
this._updateStyles(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateStyles(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>, RX.Animated>) {
|
private _updateStyles(props: Types.CommonStyledProps<Types.StyleRuleSet<Object>>) {
|
||||||
this._propsWithoutStyle = _.omit(props, 'style');
|
this._propsWithoutStyle = _.omit(props, 'style');
|
||||||
|
|
||||||
if (!props.style) {
|
if (!props.style) {
|
||||||
|
@ -672,7 +672,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps<any>>(Compo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeComponent(props: Types.CommonProps<any>) {
|
initializeComponent(props: Types.CommonProps) {
|
||||||
// Conclude the initialization setting the element.
|
// Conclude the initialization setting the element.
|
||||||
const element = ReactDOM.findDOMNode<HTMLElement>(this.refs[refName]);
|
const element = ReactDOM.findDOMNode<HTMLElement>(this.refs[refName]);
|
||||||
if (element) {
|
if (element) {
|
||||||
|
@ -744,7 +744,7 @@ function createAnimatedComponent<PropsType extends Types.CommonProps<any>>(Compo
|
||||||
return AnimatedComponentGenerated;
|
return AnimatedComponentGenerated;
|
||||||
}
|
}
|
||||||
|
|
||||||
export var Image = createAnimatedComponent(RXImage) as typeof RX.AnimatedImage;
|
export var Image = createAnimatedComponent<Types.ImageProps>(RXImage) as typeof RX.AnimatedImage;
|
||||||
export var Text = createAnimatedComponent(RXText) as typeof RX.AnimatedText;
|
export var Text = createAnimatedComponent(RXText) as typeof RX.AnimatedText;
|
||||||
export var TextInput = createAnimatedComponent(RXTextInput) as typeof RX.AnimatedTextInput;
|
export var TextInput = createAnimatedComponent(RXTextInput) as typeof RX.AnimatedTextInput;
|
||||||
export var View = createAnimatedComponent(RXView) as typeof RX.AnimatedView;
|
export var View = createAnimatedComponent(RXView) as typeof RX.AnimatedView;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
import React = require('react');
|
import React = require('react');
|
||||||
|
|
||||||
import RX = require('../common/Interfaces');
|
|
||||||
import Types = require('../common/Types');
|
import Types = require('../common/Types');
|
||||||
|
|
||||||
const _styles = {
|
const _styles = {
|
||||||
|
@ -30,7 +29,7 @@ const _styles = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ModalContainer extends React.Component<Types.CommonProps<RX.View>, {}> {
|
export class ModalContainer extends React.Component<Types.CommonProps, {}> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ export class ScrollView extends ViewBase<Types.ScrollViewProps, {}> implements R
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(newProps: Types.ViewPropsBase<any>) {
|
componentWillReceiveProps(newProps: Types.ScrollViewProps) {
|
||||||
super.componentWillReceiveProps(newProps);
|
super.componentWillReceiveProps(newProps);
|
||||||
this._onPropsChange(newProps);
|
this._onPropsChange(newProps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import Types = require('../common/Types');
|
||||||
const _layoutTimerActiveDuration = 1000;
|
const _layoutTimerActiveDuration = 1000;
|
||||||
const _layoutTimerInactiveDuration = 10000;
|
const _layoutTimerInactiveDuration = 10000;
|
||||||
|
|
||||||
export abstract class ViewBase<P extends Types.ViewPropsBase<any>, S> extends RX.ViewBase<P, S> {
|
export abstract class ViewBase<P extends Types.ViewProps, S> extends RX.ViewBase<P, S> {
|
||||||
private static _viewCheckingTimer: number|undefined;
|
private static _viewCheckingTimer: number|undefined;
|
||||||
private static _isResizeHandlerInstalled = false;
|
private static _isResizeHandlerInstalled = false;
|
||||||
private static _viewCheckingList: ViewBase<Types.ViewProps, {}>[] = [];
|
private static _viewCheckingList: ViewBase<Types.ViewProps, {}>[] = [];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче