mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Fix or suppress errors in react-native
Reviewed By: jeffmo Differential Revision: D3209973 fb-gh-sync-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81 fbshipit-source-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
This commit is contained in:
parent
5a93877673
commit
91d4a093ea
@ -15,8 +15,6 @@
|
|||||||
# Ignore react and fbjs where there are overlaps, but don't ignore
|
# Ignore react and fbjs where there are overlaps, but don't ignore
|
||||||
# anything that react-native relies on
|
# anything that react-native relies on
|
||||||
.*/node_modules/fbjs/lib/Map.js
|
.*/node_modules/fbjs/lib/Map.js
|
||||||
.*/node_modules/fbjs/lib/fetch.js
|
|
||||||
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
|
|
||||||
.*/node_modules/fbjs/lib/ErrorUtils.js
|
.*/node_modules/fbjs/lib/ErrorUtils.js
|
||||||
|
|
||||||
# Flow has a built-in definition for the 'react' module which we prefer to use
|
# Flow has a built-in definition for the 'react' module which we prefer to use
|
||||||
|
@ -351,6 +351,7 @@ const MapView = React.createClass({
|
|||||||
}
|
}
|
||||||
var viewIndex = children.length;
|
var viewIndex = children.length;
|
||||||
children.push(React.cloneElement(view, {
|
children.push(React.cloneElement(view, {
|
||||||
|
// $FlowFixMe - An array of styles should be fine
|
||||||
style: [styles.annotationView, view.props.style || {}]
|
style: [styles.annotationView, view.props.style || {}]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,11 @@ type Props = {
|
|||||||
renderScene: NavigationSceneRenderer,
|
renderScene: NavigationSceneRenderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type DefaultProps = {
|
||||||
|
direction: NavigationGestureDirection,
|
||||||
|
renderOverlay: ?NavigationSceneRenderer,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A controlled navigation view that renders a stack of cards.
|
* A controlled navigation view that renders a stack of cards.
|
||||||
*
|
*
|
||||||
@ -78,7 +83,7 @@ type Props = {
|
|||||||
* +-+ |
|
* +-+ |
|
||||||
* +------------+
|
* +------------+
|
||||||
*/
|
*/
|
||||||
class NavigationCardStack extends React.Component {
|
class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
|
||||||
_renderScene : NavigationSceneRenderer;
|
_renderScene : NavigationSceneRenderer;
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -88,7 +93,7 @@ class NavigationCardStack extends React.Component {
|
|||||||
renderScene: PropTypes.func.isRequired,
|
renderScene: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps: DefaultProps = {
|
||||||
direction: Directions.HORIZONTAL,
|
direction: Directions.HORIZONTAL,
|
||||||
renderOverlay: emptyFunction.thatReturnsNull,
|
renderOverlay: emptyFunction.thatReturnsNull,
|
||||||
};
|
};
|
||||||
@ -101,7 +106,7 @@ class NavigationCardStack extends React.Component {
|
|||||||
this._renderScene = this._renderScene.bind(this);
|
this._renderScene = this._renderScene.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Object, nextState: Object): boolean {
|
shouldComponentUpdate(nextProps: Object, nextState: void): boolean {
|
||||||
return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
|
return ReactComponentWithPureRenderMixin.shouldComponentUpdate.call(
|
||||||
this,
|
this,
|
||||||
nextProps,
|
nextProps,
|
||||||
@ -115,6 +120,7 @@ class NavigationCardStack extends React.Component {
|
|||||||
navigationState={this.props.navigationState}
|
navigationState={this.props.navigationState}
|
||||||
renderOverlay={this.props.renderOverlay}
|
renderOverlay={this.props.renderOverlay}
|
||||||
renderScene={this._renderScene}
|
renderScene={this._renderScene}
|
||||||
|
// $FlowFixMe - style should be declared
|
||||||
style={[styles.animatedView, this.props.style]}
|
style={[styles.animatedView, this.props.style]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -244,10 +244,10 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
NavigationHeader = NavigationContainer.create(NavigationHeader);
|
const NavigationHeaderContainer = NavigationContainer.create(NavigationHeader);
|
||||||
|
|
||||||
NavigationHeader.HEIGHT = APPBAR_HEIGHT + STATUSBAR_HEIGHT;
|
NavigationHeaderContainer.HEIGHT = APPBAR_HEIGHT + STATUSBAR_HEIGHT;
|
||||||
NavigationHeader.Title = NavigationHeaderTitle;
|
NavigationHeaderContainer.Title = NavigationHeaderTitle;
|
||||||
NavigationHeader.BackButton = NavigationHeaderBackButton;
|
NavigationHeaderContainer.BackButton = NavigationHeaderBackButton;
|
||||||
|
|
||||||
module.exports = NavigationHeader;
|
module.exports = NavigationHeaderContainer;
|
||||||
|
@ -87,18 +87,31 @@ export type Props = {
|
|||||||
* Tags instances and associated tasks for easier debugging.
|
* Tags instances and associated tasks for easier debugging.
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
children: any;
|
children?: any;
|
||||||
};
|
};
|
||||||
class Incremental extends React.Component {
|
type DefaultProps = {
|
||||||
|
name: string,
|
||||||
|
};
|
||||||
|
type State = {
|
||||||
|
doIncrementalRender: boolean,
|
||||||
|
};
|
||||||
|
class Incremental extends React.Component<DefaultProps, Props, State> {
|
||||||
props: Props;
|
props: Props;
|
||||||
state: {
|
state: State;
|
||||||
doIncrementalRender: boolean;
|
|
||||||
};
|
|
||||||
context: Context;
|
context: Context;
|
||||||
_incrementId: number;
|
_incrementId: number;
|
||||||
_mounted: boolean;
|
_mounted: boolean;
|
||||||
_rendered: boolean;
|
_rendered: boolean;
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
name: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
incrementalGroup: React.PropTypes.object,
|
||||||
|
incrementalGroupEnabled: React.PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
constructor(props: Props, context: Context) {
|
constructor(props: Props, context: Context) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this._mounted = false;
|
this._mounted = false;
|
||||||
@ -159,13 +172,6 @@ class Incremental extends React.Component {
|
|||||||
this._mounted = false;
|
this._mounted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Incremental.defaultProps = {
|
|
||||||
name: '',
|
|
||||||
};
|
|
||||||
Incremental.contextTypes = {
|
|
||||||
incrementalGroup: React.PropTypes.object,
|
|
||||||
incrementalGroupEnabled: React.PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Context = {
|
export type Context = {
|
||||||
incrementalGroupEnabled: boolean;
|
incrementalGroupEnabled: boolean;
|
||||||
|
@ -31,16 +31,29 @@ import type {Context} from 'Incremental';
|
|||||||
*/
|
*/
|
||||||
type Props = {
|
type Props = {
|
||||||
name: string;
|
name: string;
|
||||||
disabled: boolean;
|
disabled?: boolean;
|
||||||
onDone: () => void;
|
onDone?: () => void;
|
||||||
onLayout: (event: Object) => void;
|
onLayout?: (event: Object) => void;
|
||||||
style: mixed;
|
style?: mixed;
|
||||||
children: any;
|
children?: any;
|
||||||
}
|
}
|
||||||
class IncrementalPresenter extends React.Component {
|
class IncrementalPresenter extends React.Component {
|
||||||
props: Props;
|
props: Props;
|
||||||
context: Context;
|
context: Context;
|
||||||
_isDone: boolean;
|
_isDone: boolean;
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
name: React.PropTypes.string,
|
||||||
|
disabled: React.PropTypes.bool,
|
||||||
|
onDone: React.PropTypes.func,
|
||||||
|
onLayout: React.PropTypes.func,
|
||||||
|
style: View.propTypes.style,
|
||||||
|
};
|
||||||
|
static contextTypes = {
|
||||||
|
incrementalGroup: React.PropTypes.object,
|
||||||
|
incrementalGroupEnabled: React.PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
constructor(props: Props, context: Context) {
|
constructor(props: Props, context: Context) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this._isDone = false;
|
this._isDone = false;
|
||||||
@ -80,16 +93,5 @@ class IncrementalPresenter extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IncrementalPresenter.propTypes = {
|
|
||||||
name: React.PropTypes.string,
|
|
||||||
disabled: React.PropTypes.bool,
|
|
||||||
onDone: React.PropTypes.func,
|
|
||||||
onLayout: React.PropTypes.func,
|
|
||||||
style: View.propTypes.style,
|
|
||||||
};
|
|
||||||
IncrementalPresenter.contextTypes = {
|
|
||||||
incrementalGroup: React.PropTypes.object,
|
|
||||||
incrementalGroupEnabled: React.PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = IncrementalPresenter;
|
module.exports = IncrementalPresenter;
|
||||||
|
@ -89,7 +89,7 @@ type Props = {
|
|||||||
* return a row.
|
* return a row.
|
||||||
*/
|
*/
|
||||||
renderRow: (
|
renderRow: (
|
||||||
data: mixed, sectionIdx: number, rowIdx: number, key: string
|
data: mixed, sectionIdx: number, rowIdx: number, key?: string
|
||||||
) => ?ReactElement;
|
) => ?ReactElement;
|
||||||
/**
|
/**
|
||||||
* Rendered when the list is scrolled faster than rows can be rendered.
|
* Rendered when the list is scrolled faster than rows can be rendered.
|
||||||
@ -160,16 +160,6 @@ type Props = {
|
|||||||
*/
|
*/
|
||||||
onMountedRowsWillChange: (firstIdx: number, count: number) => void;
|
onMountedRowsWillChange: (firstIdx: number, count: number) => void;
|
||||||
};
|
};
|
||||||
const defaultProps = {
|
|
||||||
enableDangerousRecycling: false,
|
|
||||||
initialNumToRender: 10,
|
|
||||||
maxNumToRender: 30,
|
|
||||||
numToRenderAhead: 10,
|
|
||||||
viewablePercentThreshold: 50,
|
|
||||||
renderScrollComponent: (props) => <ScrollView {...props} />,
|
|
||||||
disableIncrementalRendering: false,
|
|
||||||
recomputeRowsBatchingPeriod: 100,
|
|
||||||
};
|
|
||||||
class WindowedListView extends React.Component {
|
class WindowedListView extends React.Component {
|
||||||
props: Props;
|
props: Props;
|
||||||
state: {
|
state: {
|
||||||
@ -189,6 +179,18 @@ class WindowedListView extends React.Component {
|
|||||||
_viewableRows: Array<number> = [];
|
_viewableRows: Array<number> = [];
|
||||||
_cellsInProgress: Set<number> = new Set();
|
_cellsInProgress: Set<number> = new Set();
|
||||||
_scrollRef: ?Object;
|
_scrollRef: ?Object;
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
enableDangerousRecycling: false,
|
||||||
|
initialNumToRender: 10,
|
||||||
|
maxNumToRender: 30,
|
||||||
|
numToRenderAhead: 10,
|
||||||
|
viewablePercentThreshold: 50,
|
||||||
|
renderScrollComponent: (props) => <ScrollView {...props} />,
|
||||||
|
disableIncrementalRendering: false,
|
||||||
|
recomputeRowsBatchingPeriod: 100,
|
||||||
|
};
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
invariant(
|
invariant(
|
||||||
@ -495,7 +497,6 @@ class WindowedListView extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowedListView.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
// performance testing id, unique for each component mount cycle
|
// performance testing id, unique for each component mount cycle
|
||||||
let g_perf_update_id = 0;
|
let g_perf_update_id = 0;
|
||||||
@ -530,7 +531,7 @@ type CellProps = {
|
|||||||
* Updates the parent with the latest layout. Only called when incremental rendering is done and triggers the parent
|
* Updates the parent with the latest layout. Only called when incremental rendering is done and triggers the parent
|
||||||
* to re-render this row with includeInLayout true.
|
* to re-render this row with includeInLayout true.
|
||||||
*/
|
*/
|
||||||
onNewLayout: (params: {rowIndex: number, layout: ?Object}) => void;
|
onNewLayout: (params: {rowIndex: number, layout: Object}) => void;
|
||||||
/**
|
/**
|
||||||
* Used to track when rendering is in progress so the parent can avoid wastedful re-renders that are just going to be
|
* Used to track when rendering is in progress so the parent can avoid wastedful re-renders that are just going to be
|
||||||
* invalidated once the cell finishes.
|
* invalidated once the cell finishes.
|
||||||
|
@ -34,6 +34,18 @@ const RCTModalHostView = requireNativeComponent('RCTModalHostView', null);
|
|||||||
* configureScene property.
|
* configureScene property.
|
||||||
*/
|
*/
|
||||||
class Modal extends React.Component {
|
class Modal extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
|
animated: PropTypes.bool,
|
||||||
|
transparent: PropTypes.bool,
|
||||||
|
visible: PropTypes.bool,
|
||||||
|
onRequestClose: Platform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func,
|
||||||
|
onShow: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
visible: true,
|
||||||
|
};
|
||||||
|
|
||||||
render(): ?ReactElement {
|
render(): ?ReactElement {
|
||||||
if (this.props.visible === false) {
|
if (this.props.visible === false) {
|
||||||
return null;
|
return null;
|
||||||
@ -65,18 +77,6 @@ class Modal extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Modal.propTypes = {
|
|
||||||
animated: PropTypes.bool,
|
|
||||||
transparent: PropTypes.bool,
|
|
||||||
visible: PropTypes.bool,
|
|
||||||
onRequestClose: Platform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func,
|
|
||||||
onShow: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
Modal.defaultProps = {
|
|
||||||
visible: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
modal: {
|
modal: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
@ -16,7 +16,7 @@ var NavigationRootContainer = require('NavigationRootContainer');
|
|||||||
|
|
||||||
function createNavigationContainer(
|
function createNavigationContainer(
|
||||||
Component: ReactClass<any>,
|
Component: ReactClass<any>,
|
||||||
): ReactClass {
|
): ReactClass & Object {
|
||||||
class NavigationComponent extends React.Component {
|
class NavigationComponent extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
@ -95,6 +95,9 @@ class NavigationRootContainer extends React.Component<any, Props, State> {
|
|||||||
onNavigate: PropTypes.func,
|
onNavigate: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static getBackAction = getBackAction;
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
@ -108,8 +111,8 @@ class NavigationRootContainer extends React.Component<any, Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount(): void {
|
componentWillMount(): void {
|
||||||
this.handleNavigation = this.handleNavigation.bind(this);
|
(this: any).handleNavigation = this.handleNavigation.bind(this);
|
||||||
this._handleOpenURLEvent = this._handleOpenURLEvent.bind(this);
|
(this: any)._handleOpenURLEvent = this._handleOpenURLEvent.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
@ -121,6 +124,7 @@ class NavigationRootContainer extends React.Component<any, Props, State> {
|
|||||||
AsyncStorage.getItem(this.props.persistenceKey, (err, storedString) => {
|
AsyncStorage.getItem(this.props.persistenceKey, (err, storedString) => {
|
||||||
if (err || !storedString) {
|
if (err || !storedString) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
// $FlowFixMe - navState is missing properties :(
|
||||||
navState: this.props.reducer(null, this.props.initialAction),
|
navState: this.props.reducer(null, this.props.initialAction),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -164,6 +168,7 @@ class NavigationRootContainer extends React.Component<any, Props, State> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
// $FlowFixMe - navState is missing properties :(
|
||||||
navState,
|
navState,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,6 +188,4 @@ class NavigationRootContainer extends React.Component<any, Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationRootContainer.getBackAction = getBackAction;
|
|
||||||
|
|
||||||
module.exports = NavigationRootContainer;
|
module.exports = NavigationRootContainer;
|
||||||
|
@ -112,4 +112,3 @@ export type NavigationSceneRenderer = (
|
|||||||
export type NavigationStyleInterpolator = (
|
export type NavigationStyleInterpolator = (
|
||||||
props: NavigationSceneRendererProps,
|
props: NavigationSceneRendererProps,
|
||||||
) => Object;
|
) => Object;
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ class YellowBox extends React.Component {
|
|||||||
warningMap: Map;
|
warningMap: Map;
|
||||||
};
|
};
|
||||||
_listener: ?EmitterSubscription;
|
_listener: ?EmitterSubscription;
|
||||||
|
dismissWarning: (warning: ?string) => void;
|
||||||
|
|
||||||
constructor(props: mixed, context: mixed) {
|
constructor(props: mixed, context: mixed) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
@ -123,7 +123,6 @@ var ReactNative = Object.assign(Object.create(require('react')), {
|
|||||||
TestModule: require('NativeModules').TestModule,
|
TestModule: require('NativeModules').TestModule,
|
||||||
TestUtils: undefined,
|
TestUtils: undefined,
|
||||||
batchedUpdates: require('ReactUpdates').batchedUpdates,
|
batchedUpdates: require('ReactUpdates').batchedUpdates,
|
||||||
cloneWithProps: require('cloneWithProps'),
|
|
||||||
createFragment: require('ReactFragment').create,
|
createFragment: require('ReactFragment').create,
|
||||||
update: require('update'),
|
update: require('update'),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user