explicit type args in react-native-github

Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
This commit is contained in:
Basil Hosmer 2016-05-24 18:20:12 -07:00 committed by Facebook Github Bot 9
parent caa2baee9d
commit ac5636dd59
67 changed files with 149 additions and 153 deletions

View File

@ -61,6 +61,6 @@ exports.description = 'Interface to show iOS\' accessibility samples';
exports.examples = [
{
title: 'Accessibility elements',
render(): ReactElement { return <AccessibilityIOSExample />; }
render(): ReactElement<any> { return <AccessibilityIOSExample />; }
},
];

View File

@ -198,27 +198,27 @@ exports.description = 'Interface to show iOS\' action sheets';
exports.examples = [
{
title: 'Show Action Sheet',
render(): ReactElement { return <ActionSheetExample />; }
render(): ReactElement<any> { return <ActionSheetExample />; }
},
{
title: 'Show Action Sheet with tinted buttons',
render(): ReactElement { return <ActionSheetTintExample />; }
render(): ReactElement<any> { return <ActionSheetTintExample />; }
},
{
title: 'Show Share Action Sheet',
render(): ReactElement {
render(): ReactElement<any> {
return <ShareActionSheetExample url="https://code.facebook.com" />;
}
},
{
title: 'Share Local Image',
render(): ReactElement {
render(): ReactElement<any> {
return <ShareActionSheetExample url="bunny.png" />;
}
},
{
title: 'Share Screenshot',
render(): ReactElement {
render(): ReactElement<any> {
return <ShareScreenshotExample />;
}
}

View File

@ -142,7 +142,7 @@ exports.examples = [
},
{
title: 'Start/stop',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <ToggleAnimatingActivityIndicator />;
}
},

View File

@ -31,7 +31,7 @@ exports.description = 'Example of using the ad support API.';
exports.examples = [
{
title: 'Ad Support IOS',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <AdSupportIOSExample />;
},
}

View File

@ -38,7 +38,7 @@ exports.examples = [{
},
{
title: 'Prompt Options',
render(): ReactElement {
render(): ReactElement<any> {
return <PromptOptions />;
}
},

View File

@ -82,7 +82,7 @@ class Circle extends React.Component {
});
}
render(): ReactElement {
render(): ReactElement<any> {
if (this.state.panResponder) {
var handlers = this.state.panResponder.panHandlers;
var dragStyle = { // Used to position while dragging
@ -183,7 +183,7 @@ class AnExApp extends React.Component {
this._onMove = this._onMove.bind(this);
}
render(): ReactElement {
render(): ReactElement<any> {
var circles = this.state.keys.map((key, idx) => {
if (key === this.state.activeKey) {
return <Circle key={key + 'd'} dummy={true} />;

View File

@ -89,7 +89,7 @@ class AnExBobble extends React.Component {
});
}
render(): ReactElement {
render(): ReactElement<any> {
return (
<View style={styles.bobbleContainer}>
{this.state.bobbles.map((_, i) => {

View File

@ -45,7 +45,7 @@ class AnExSet extends React.Component {
openColor: randColor(),
};
}
render(): ReactElement {
render(): ReactElement<any> {
var backgroundColor = this.props.openVal ?
this.props.openVal.interpolate({
inputRange: [0, 1],

View File

@ -90,7 +90,7 @@ class AnExTilt extends React.Component {
this._startBurnsZoom();
}
render(): ReactElement {
render(): ReactElement<any> {
return (
<Animated.View
{...this.state.tiltPanResponder.panHandlers}

View File

@ -72,10 +72,10 @@ exports.examples = [
{
title: 'Subscribed AppState:',
description: 'This changes according to the current state, so you can only ever see it rendered as "active"',
render(): ReactElement { return <AppStateSubscription showCurrentOnly={true} />; }
render(): ReactElement<any> { return <AppStateSubscription showCurrentOnly={true} />; }
},
{
title: 'Previous states:',
render(): ReactElement { return <AppStateSubscription showCurrentOnly={false} />; }
render(): ReactElement<any> { return <AppStateSubscription showCurrentOnly={false} />; }
},
];

View File

@ -85,15 +85,15 @@ exports.examples = [
{
title: 'Subscribed AppStateIOS:',
description: 'This changes according to the current state, so you can only ever see it rendered as "active"',
render(): ReactElement { return <AppStateSubscription showCurrentOnly={true} />; }
render(): ReactElement<any> { return <AppStateSubscription showCurrentOnly={true} />; }
},
{
title: 'Previous states:',
render(): ReactElement { return <AppStateSubscription showCurrentOnly={false} />; }
render(): ReactElement<any> { return <AppStateSubscription showCurrentOnly={false} />; }
},
{
title: 'Memory Warnings',
description: 'In the simulator, hit Shift+Command+M to simulate a memory warning.',
render(): ReactElement { return <AppStateSubscription showMemoryWarnings={true} />; }
render(): ReactElement<any> { return <AppStateSubscription showMemoryWarnings={true} />; }
},
];

View File

@ -115,6 +115,6 @@ exports.description = 'Asynchronous local disk storage.';
exports.examples = [
{
title: 'Basics - getItem, setItem, removeItem',
render(): ReactElement { return <BasicStorageExample />; }
render(): ReactElement<any> { return <BasicStorageExample />; }
},
];

View File

@ -137,6 +137,6 @@ exports.description = 'Example component that uses CameraRoll to list user\'s ph
exports.examples = [
{
title: 'Photos',
render(): ReactElement { return <CameraRollExample />; }
render(): ReactElement<any> { return <CameraRollExample />; }
}
];

View File

@ -132,7 +132,7 @@ exports.description = 'Select dates and times using the native UIDatePicker.';
exports.examples = [
{
title: '<DatePickerIOS>',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <DatePickerExample />;
},
}];

View File

@ -32,7 +32,7 @@ exports.description = 'Examples of using the Geolocation API.';
exports.examples = [
{
title: 'navigator.geolocation',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <GeolocationExample />;
},
}

View File

@ -160,12 +160,12 @@ exports.title = 'Layout Animation';
exports.description = 'Layout animation';
exports.examples = [{
title: 'Add and remove views',
render(): ReactElement {
render(): ReactElement<any> {
return <AddRemoveExample />;
},
}, {
title: 'Cross fade views',
render(): ReactElement {
render(): ReactElement<any> {
return <CrossFadeExample />;
},
}];

View File

@ -158,7 +158,7 @@ exports.description = 'Examples that show how Layout events can be used to ' +
exports.examples = [
{
title: 'LayoutEventExample',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <LayoutEventExample />;
},
}];

View File

@ -131,7 +131,7 @@ var ListViewPagingExample = React.createClass({
};
},
renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement {
renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement<any> {
return (<Thumb text={rowData}/>);
},

View File

@ -282,7 +282,7 @@ class ExampleMainView extends React.Component {
);
}
_renderScene(): ReactElement {
_renderScene(): ReactElement<any> {
const {navigationState} = this.props;
const childState = navigationState.routes[navigationState.index];
return (

View File

@ -162,22 +162,22 @@ exports.examples = [
{
title: 'NetInfo.isConnected',
description: 'Asynchronously load and observe connectivity',
render(): ReactElement { return <IsConnected />; }
render(): ReactElement<any> { return <IsConnected />; }
},
{
title: 'NetInfo.update',
description: 'Asynchronously load and observe connectionInfo',
render(): ReactElement { return <ConnectionInfoCurrent />; }
render(): ReactElement<any> { return <ConnectionInfoCurrent />; }
},
{
title: 'NetInfo.updateHistory',
description: 'Observed updates to connectionInfo',
render(): ReactElement { return <ConnectionInfoSubscription />; }
render(): ReactElement<any> { return <ConnectionInfoSubscription />; }
},
{
platform: 'android',
title: 'NetInfo.isConnectionExpensive (Android)',
description: 'Asynchronously check isConnectionExpensive',
render(): ReactElement { return <IsConnectionExpensive />; }
render(): ReactElement<any> { return <IsConnectionExpensive />; }
},
];

View File

@ -144,13 +144,13 @@ exports.description = 'Render lists of selectable options with UIPickerView.';
exports.examples = [
{
title: '<PickerIOS>',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <PickerExample />;
},
},
{
title: '<PickerIOS> with custom styling',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <PickerStyleExample />;
},
}];

View File

@ -162,7 +162,7 @@ exports.description = 'Apple PushNotification and badge value';
exports.examples = [
{
title: 'Badge Number',
render(): ReactElement {
render(): ReactElement<any> {
PushNotificationIOS.requestPermissions();
return (
@ -181,13 +181,13 @@ exports.examples = [
},
{
title: 'Push Notifications',
render(): ReactElement {
render(): ReactElement<any> {
return <NotificationExample />;
}
},
{
title: 'Notifications Permissions',
render(): ReactElement {
render(): ReactElement<any> {
return <NotificationPermissionExample />;
}
}];

View File

@ -83,7 +83,7 @@ exports.description = 'Examples that show useful methods when embedding React Na
exports.examples = [
{
title: 'Updating app properties in runtime',
render(): ReactElement {
render(): ReactElement<any> {
return (
<AppPropertiesUpdateExample/>
);
@ -91,7 +91,7 @@ exports.examples = [
},
{
title: 'RCTRootView\'s size flexibility',
render(): ReactElement {
render(): ReactElement<any> {
return (
<RootViewSizeFlexibilityExample/>
);

View File

@ -145,26 +145,26 @@ exports.description = 'Native segmented control';
exports.examples = [
{
title: 'Segmented controls can have values',
render(): ReactElement { return <BasicSegmentedControlExample />; }
render(): ReactElement<any> { return <BasicSegmentedControlExample />; }
},
{
title: 'Segmented controls can have a pre-selected value',
render(): ReactElement { return <PreSelectedSegmentedControlExample />; }
render(): ReactElement<any> { return <PreSelectedSegmentedControlExample />; }
},
{
title: 'Segmented controls can be momentary',
render(): ReactElement { return <MomentarySegmentedControlExample />; }
render(): ReactElement<any> { return <MomentarySegmentedControlExample />; }
},
{
title: 'Segmented controls can be disabled',
render(): ReactElement { return <DisabledSegmentedControlExample />; }
render(): ReactElement<any> { return <DisabledSegmentedControlExample />; }
},
{
title: 'Custom colors can be provided',
render(): ReactElement { return <ColorSegmentedControlExample />; }
render(): ReactElement<any> { return <ColorSegmentedControlExample />; }
},
{
title: 'Change events can be detected',
render(): ReactElement { return <EventSegmentedControlExample />; }
render(): ReactElement<any> { return <EventSegmentedControlExample />; }
}
];

View File

@ -94,19 +94,19 @@ exports.description = 'Slider input for numeric values';
exports.examples = [
{
title: 'Default settings',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample />;
}
},
{
title: 'Initial value: 0.5',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample value={0.5} />;
}
},
{
title: 'minimumValue: -1, maximumValue: 2',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumValue={-1}
@ -117,13 +117,13 @@ exports.examples = [
},
{
title: 'step: 0.25',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample step={0.25} />;
}
},
{
title: 'onSlidingComplete',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SlidingCompleteExample />
);
@ -132,7 +132,7 @@ exports.examples = [
{
title: 'Custom min/max track tint color',
platform: 'ios',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackTintColor={'red'}
@ -144,21 +144,21 @@ exports.examples = [
{
title: 'Custom thumb image',
platform: 'ios',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample thumbImage={require('./uie_thumb_big.png')} />;
}
},
{
title: 'Custom track image',
platform: 'ios',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample trackImage={require('./slider.png')} />;
}
},
{
title: 'Custom min/max track image',
platform: 'ios',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackImage={require('./slider-left.png')}

View File

@ -64,13 +64,13 @@ exports.description = 'Slider input for numeric values';
exports.examples = [
{
title: 'Default settings',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample />;
}
},
{
title: 'minimumValue: -1, maximumValue: 2',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumValue={-1}
@ -81,13 +81,13 @@ exports.examples = [
},
{
title: 'step: 0.25',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample step={0.25} />;
}
},
{
title: 'Custom min/max track tint color',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackTintColor={'red'}
@ -98,19 +98,19 @@ exports.examples = [
},
{
title: 'Custom thumb image',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample thumbImage={require('./uie_thumb_big.png')} />;
}
},
{
title: 'Custom track image',
render(): ReactElement {
render(): ReactElement<any> {
return <SliderExample trackImage={require('./slider.png')} />;
}
},
{
title: 'Custom min/max track image',
render(): ReactElement {
render(): ReactElement<any> {
return (
<SliderExample
minimumTrackImage={require('./slider-left.png')}

View File

@ -69,6 +69,6 @@ exports.description = 'API to capture images from the screen.';
exports.examples = [
{
title: 'Take screenshot',
render(): ReactElement { return <ScreenshotExample />; }
render(): ReactElement<any> { return <ScreenshotExample />; }
},
];

View File

@ -130,26 +130,26 @@ var EventSwitchExample = React.createClass({
var examples = [
{
title: 'Switches can be set to true or false',
render(): ReactElement { return <BasicSwitchExample />; }
render(): ReactElement<any> { return <BasicSwitchExample />; }
},
{
title: 'Switches can be disabled',
render(): ReactElement { return <DisabledSwitchExample />; }
render(): ReactElement<any> { return <DisabledSwitchExample />; }
},
{
title: 'Change events can be detected',
render(): ReactElement { return <EventSwitchExample />; }
render(): ReactElement<any> { return <EventSwitchExample />; }
},
{
title: 'Switches are controlled components',
render(): ReactElement { return <Switch />; }
render(): ReactElement<any> { return <Switch />; }
}
];
if (Platform.OS === 'ios') {
examples.push({
title: 'Custom colors can be provided',
render(): ReactElement { return <ColorSwitchExample />; }
render(): ReactElement<any> { return <ColorSwitchExample />; }
});
}

View File

@ -351,7 +351,7 @@ exports.examples = [
},
}, {
title: 'Toggling Attributes',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <AttributeToggler />;
},
}, {

View File

@ -532,7 +532,7 @@ exports.examples = [
},
{
title: 'Event handling',
render: function(): ReactElement { return <TextEventsExample />; },
render: function(): ReactElement<any> { return <TextEventsExample />; },
},
{
title: 'Colored input text',
@ -630,7 +630,7 @@ exports.examples = [
},
{
title: 'Blur on submit',
render: function(): ReactElement { return <BlurOnSubmitExample />; },
render: function(): ReactElement<any> { return <BlurOnSubmitExample />; },
},
{
title: 'Multiline blur on submit',

View File

@ -149,7 +149,7 @@ exports.examples = [
title: 'this.setInterval(fn, t)',
description: 'Execute function fn every t milliseconds until cancelled ' +
'or component is unmounted.',
render: function(): ReactElement {
render: function(): ReactElement<any> {
var IntervalExample = React.createClass({
getInitialState: function() {
return {

View File

@ -71,14 +71,14 @@ exports.examples = [
},
}, {
title: '<Text onPress={fn}> with highlight',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <TextOnPressBox />;
},
}, {
title: 'Touchable feedback events',
description: '<Touchable*> components accept onPress, onPressIn, ' +
'onPressOut, and onLongPress as props.',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <TouchableFeedbackEvents />;
},
}, {
@ -86,13 +86,13 @@ exports.examples = [
description: '<Touchable*> components also accept delayPressIn, ' +
'delayPressOut, and delayLongPress as props. These props impact the ' +
'timing of feedback events.',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <TouchableDelayEvents />;
},
}, {
title: '3D Touch / Force Touch',
description: 'iPhone 6s and 6s plus support 3D touch, which adds a force property to touches',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <ForceTouchExample />;
},
platform: 'ios',
@ -100,14 +100,14 @@ exports.examples = [
title: 'Touchable Hit Slop',
description: '<Touchable*> components accept hitSlop prop which extends the touch area ' +
'without changing the view bounds.',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <TouchableHitSlop />;
},
}, {
title: 'Disabled Touchable*',
description: '<Touchable*> components accept disabled prop which prevents ' +
'any interaction with component',
render: function(): ReactElement {
render: function(): ReactElement<any> {
return <TouchableDisabled />;
},
}];

View File

@ -208,7 +208,7 @@ exports.examples = [
{
title: 'Perspective',
description: 'perspective: 850, rotateX: Animated.timing(0 -> 360)',
render(): ReactElement { return <Flip />; }
render(): ReactElement<any> { return <Flip />; }
},
{
title: 'Translate, Rotate, Scale',

View File

@ -46,6 +46,6 @@ exports.description = 'Transparent view receiving touch events';
exports.examples = [
{
title: 'TransparentHitTestExample',
render(): ReactElement { return <TransparentHitTestExample />; }
render(): ReactElement<any> { return <TransparentHitTestExample />; }
}
];

View File

@ -140,7 +140,7 @@ class UIExplorerApp extends React.Component {
);
}
_renderOverlay(props: NavigationSceneRendererProps): ReactElement {
_renderOverlay(props: NavigationSceneRendererProps): ReactElement<any> {
return (
<NavigationHeader
{...props}
@ -149,7 +149,7 @@ class UIExplorerApp extends React.Component {
);
}
_renderTitleComponent(props: NavigationSceneRendererProps): ReactElement {
_renderTitleComponent(props: NavigationSceneRendererProps): ReactElement<any> {
return (
<NavigationHeader.Title>
{UIExplorerStateTitleMap(props.scene.route)}
@ -157,7 +157,7 @@ class UIExplorerApp extends React.Component {
);
}
_renderScene(props: NavigationSceneRendererProps): ?ReactElement {
_renderScene(props: NavigationSceneRendererProps): ?ReactElement<any> {
const state = props.scene.route;
if (state.key === 'AppList') {
return (

View File

@ -62,7 +62,7 @@ class UIExplorerExampleList extends React.Component {
example;
}
render(): ?ReactElement {
render(): ?ReactElement<any> {
const filterText = this.props.filter || '';
const filterRegex = new RegExp(String(filterText), 'i');
const filter = (example) => filterRegex.test(example.module.title);
@ -88,7 +88,7 @@ class UIExplorerExampleList extends React.Component {
);
}
_renderTitleRow(): ?ReactElement {
_renderTitleRow(): ?ReactElement<any> {
if (!this.props.displayTitleRow) {
return null;
}
@ -104,7 +104,7 @@ class UIExplorerExampleList extends React.Component {
);
}
_renderTextInput(): ?ReactElement {
_renderTextInput(): ?ReactElement<any> {
if (this.props.disableSearch) {
return null;
}
@ -126,7 +126,7 @@ class UIExplorerExampleList extends React.Component {
);
}
_renderSectionHeader(data: any, section: string): ?ReactElement {
_renderSectionHeader(data: any, section: string): ?ReactElement<any> {
return (
<Text style={styles.sectionHeader}>
{section.toUpperCase()}
@ -134,7 +134,7 @@ class UIExplorerExampleList extends React.Component {
);
}
_renderExampleRow(example: {key: string, module: Object}): ?ReactElement {
_renderExampleRow(example: {key: string, module: Object}): ?ReactElement<any> {
return this._renderRow(
example.module.title,
example.module.description,
@ -143,7 +143,7 @@ class UIExplorerExampleList extends React.Component {
);
}
_renderRow(title: string, description: string, key: ?string, handler: ?Function): ?ReactElement {
_renderRow(title: string, description: string, key: ?string, handler: ?Function): ?ReactElement<any> {
return (
<View key={key || title}>
<TouchableHighlight onPress={handler}>

View File

@ -43,7 +43,7 @@ const WS_STATES = [
];
class Button extends React.Component {
render(): ReactElement {
render(): ReactElement<any> {
const label = <Text style={styles.buttonLabel}>{this.props.label}</Text>;
if (this.props.disabled) {
return (
@ -63,7 +63,7 @@ class Button extends React.Component {
}
class Row extends React.Component {
render(): ReactElement {
render(): ReactElement<any> {
return (
<View style={styles.row}>
<Text>{this.props.label}</Text>
@ -162,7 +162,7 @@ class WebSocketExample extends React.Component<any, any, State> {
this.setState({outgoingMessage: ''});
};
render(): ReactElement {
render(): ReactElement<any> {
const socketState = WS_STATES[this.state.socketState || -1];
const canConnect =
!this.state.socket ||

View File

@ -336,15 +336,15 @@ exports.description = 'Base component to display web content';
exports.examples = [
{
title: 'Simple Browser',
render(): ReactElement { return <WebViewExample />; }
render(): ReactElement<any> { return <WebViewExample />; }
},
{
title: 'Scale Page to Fit',
render(): ReactElement { return <ScaledWebView/>; }
render(): ReactElement<any> { return <ScaledWebView/>; }
},
{
title: 'Bundled HTML',
render(): ReactElement {
render(): ReactElement<any> {
return (
<WebView
style={{
@ -359,7 +359,7 @@ exports.examples = [
},
{
title: 'Static HTML',
render(): ReactElement {
render(): ReactElement<any> {
return (
<WebView
style={{
@ -374,7 +374,7 @@ exports.examples = [
},
{
title: 'POST Test',
render(): ReactElement {
render(): ReactElement<any> {
return (
<WebView
style={{

View File

@ -47,7 +47,7 @@ var PromiseTest = React.createClass({
.catch(() => this.shouldReject = true);
},
async testShouldSucceedAsync() : Promise {
async testShouldSucceedAsync() : Promise<any> {
try {
await TestModule.shouldResolve();
this.shouldSucceedAsync = true;
@ -56,7 +56,7 @@ var PromiseTest = React.createClass({
}
},
async testShouldThrowAsync() : Promise {
async testShouldThrowAsync() : Promise<any> {
try {
await TestModule.shouldReject();
this.shouldThrowAsync = false;
@ -65,7 +65,7 @@ var PromiseTest = React.createClass({
}
},
render() : ReactElement {
render() : ReactElement<any> {
return <View />;
}

View File

@ -23,7 +23,7 @@ var StaticRenderer = React.createClass({
return nextProps.shouldUpdate;
},
render: function(): ReactElement {
render: function(): ReactElement<any> {
return this.props.render();
},
});

View File

@ -321,7 +321,7 @@ const StatusBar = React.createClass({
});
},
render(): ?ReactElement {
render(): ?ReactElement<any> {
return null;
},
});

View File

@ -125,7 +125,7 @@ var TouchableBounce = React.createClass({
return 0;
},
render: function(): ReactElement {
render: function(): ReactElement<any> {
return (
<Animated.View
style={[{transform: [{scale: this.state.scale}]}, this.props.style]}

View File

@ -149,7 +149,7 @@ const TouchableWithoutFeedback = React.createClass({
return this.props.delayPressOut || 0;
},
render: function(): ReactElement {
render: function(): ReactElement<any> {
// Note(avik): remove dynamic typecast once Flow has been upgraded
const child = onlyChild(this.props.children);
let children = child.props.children;

View File

@ -79,7 +79,7 @@ class SceneView extends React.Component<any, SceneViewProps, any> {
);
}
render(): ?ReactElement {
render(): ?ReactElement<any> {
return this.props.sceneRenderer(this.props.sceneRendererProps);
}
}
@ -107,7 +107,7 @@ class NavigationCard extends React.Component<any, Props, any> {
);
}
render(): ReactElement {
render(): ReactElement<any> {
const {
panHandlers,
pointerEvents,
@ -156,13 +156,9 @@ const styles = StyleSheet.create({
NavigationCard = NavigationPointerEventsContainer.create(NavigationCard);
// $FlowFixMe: Figure out how to declare these properties on the container class
NavigationCard.CardStackPanResponder = NavigationCardStackPanResponder;
// $FlowFixMe
NavigationCard.CardStackStyleInterpolator = NavigationCardStackStyleInterpolator;
// $FlowFixMe
NavigationCard.PagerPanResponder = NavigationPagerPanResponder;
// $FlowFixMe
NavigationCard.PagerStyleInterpolator = NavigationPagerStyleInterpolator;
module.exports = NavigationCard;

View File

@ -116,7 +116,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
);
}
render(): ReactElement {
render(): ReactElement<any> {
return (
<NavigationAnimatedView
navigationState={this.props.navigationState}
@ -129,7 +129,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
);
}
_renderScene(props: NavigationSceneRendererProps): ReactElement {
_renderScene(props: NavigationSceneRendererProps): ReactElement<any> {
const isVertical = this.props.direction === 'vertical';
const style = isVertical ?

View File

@ -119,7 +119,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
);
}
render(): ReactElement {
render(): ReactElement<any> {
const { scenes, style, viewProps } = this.props;
const scenesProps = scenes.map(scene => {
@ -137,7 +137,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
);
}
_renderLeft(props: NavigationSceneRendererProps): ?ReactElement {
_renderLeft(props: NavigationSceneRendererProps): ?ReactElement<any> {
return this._renderSubView(
props,
'left',
@ -146,7 +146,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
);
}
_renderTitle(props: NavigationSceneRendererProps): ?ReactElement {
_renderTitle(props: NavigationSceneRendererProps): ?ReactElement<any> {
return this._renderSubView(
props,
'title',
@ -155,7 +155,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
);
}
_renderRight(props: NavigationSceneRendererProps): ?ReactElement {
_renderRight(props: NavigationSceneRendererProps): ?ReactElement<any> {
return this._renderSubView(
props,
'right',
@ -169,7 +169,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
name: SubViewName,
renderer: NavigationSceneRenderer,
styleInterpolator: NavigationStyleInterpolator,
): ?ReactElement {
): ?ReactElement<any> {
const {
scene,
navigationState,

View File

@ -38,7 +38,7 @@ const {
} = ReactNative;
type Props = {
children: ReactElement;
children: ReactElement<any>;
style: any;
textStyle: any;
viewProps: any;

View File

@ -52,7 +52,7 @@ const MIN_POSITION_OFFSET = 0.01;
*/
function create(
Component: ReactClass<any>,
): ReactClass {
): ReactClass<any> {
class Container extends React.Component<any, Props, any> {
@ -86,7 +86,7 @@ function create(
this._bindPosition(nextProps);
}
render(): ReactElement {
render(): ReactElement<any> {
this._pointerEvents = this._computePointerEvents();
return (
<Component

View File

@ -152,7 +152,7 @@ class Incremental extends React.Component<DefaultProps, Props, State> {
}).done();
}
render(): ?ReactElement {
render(): ?ReactElement<any> {
if (this._rendered || // Make sure that once we render once, we stay rendered even if incrementalGroupEnabled gets flipped.
!this.context.incrementalGroupEnabled ||
this.state.doIncrementalRender) {

View File

@ -124,7 +124,7 @@ class IncrementalExample extends React.Component {
console.log('onDone:', stats);
}, 0);
}
render(): ReactElement {
render(): ReactElement<any> {
return (
<IncrementalGroup
disabled={false}

View File

@ -65,7 +65,7 @@ class IncrementalGroup extends React.Component {
};
}
render(): ReactElement {
render(): ReactElement<any> {
return (
<Incremental
onDone={this.props.onDone}

View File

@ -79,7 +79,7 @@ const SwipeableListView = React.createClass({
}
},
render(): ReactElement {
render(): ReactElement<any> {
return (
<ListView
{...this.props}
@ -114,7 +114,7 @@ const SwipeableListView = React.createClass({
}
},
_renderRow(rowData: Object, sectionID: string, rowID: string): ReactElement {
_renderRow(rowData: Object, sectionID: string, rowID: string): ReactElement<any> {
const slideoutView = this.props.renderQuickActions(rowData, sectionID, rowID);
// If renderRowSlideout is unspecified or returns falsey, don't allow swipe

View File

@ -43,7 +43,7 @@ const SwipeableQuickActionButton = React.createClass({
textStyle: Text.propTypes.style,
},
render(): ?ReactElement {
render(): ?ReactElement<any> {
if (!this.props.imageSource && !this.props.text) {
return null;
}

View File

@ -34,7 +34,7 @@ const SwipeableQuickActions = React.createClass({
style: View.propTypes.style,
},
render(): ReactElement {
render(): ReactElement<any> {
const children = this.props.children;
let buttons = [];

View File

@ -115,7 +115,7 @@ const SwipeableRow = React.createClass({
}
},
render(): ReactElement {
render(): ReactElement<any> {
// The view hidden behind the main view
let slideOutView;
if (this.state.isSwipeableViewRendered) {

View File

@ -91,15 +91,15 @@ type Props = {
*/
renderRow: (
rowData: any, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement;
) => ?ReactElement<any>;
/**
* Rendered when the list is scrolled faster than rows can be rendered.
*/
renderWindowBoundaryIndicator?: () => ?ReactElement;
renderWindowBoundaryIndicator?: () => ?ReactElement<any>;
/**
* Always rendered at the bottom of all the rows.
*/
renderFooter?: () => ?ReactElement;
renderFooter?: () => ?ReactElement<any>;
/**
* Pipes through normal onScroll events from the underlying `ScrollView`.
*/
@ -139,7 +139,7 @@ type Props = {
* A function that returns the scrollable component in which the list rows
* are rendered. Defaults to returning a ScrollView with the given props.
*/
renderScrollComponent: (props: ?Object) => ReactElement;
renderScrollComponent: (props: ?Object) => ReactElement<any>;
/**
* Use to disable incremental rendering when not wanted, e.g. to speed up initial render.
*/
@ -430,7 +430,7 @@ class WindowedListView extends React.Component {
this._firstVisible = newFirstVisible;
this._lastVisible = newLastVisible;
}
render(): ReactElement {
render(): ReactElement<any> {
const {firstRow, lastRow} = this.state;
const rowFrames = this._rowFrames;
const rows = [];
@ -574,7 +574,7 @@ type CellProps = {
*/
renderRow: (
rowData: mixed, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement;
) => ?ReactElement<any>;
/**
* Index of the row, passed through to other callbacks.
*/

View File

@ -86,7 +86,7 @@ var InteractionManager = {
/**
* Schedule a function to run after all interactions have completed.
*/
runAfterInteractions(task: ?Task): Promise {
runAfterInteractions(task: ?Task): Promise<any> {
return new Promise(resolve => {
_scheduleUpdate();
if (task) {

View File

@ -19,7 +19,7 @@ type SimpleTask = {
};
type PromiseTask = {
name: string;
gen: () => Promise;
gen: () => Promise<any>;
};
export type Task = Function | SimpleTask | PromiseTask;

View File

@ -52,7 +52,7 @@ class Modal extends React.Component {
visible: true,
};
render(): ?ReactElement {
render(): ?ReactElement<any> {
if (this.props.visible === false) {
return null;
}

View File

@ -160,7 +160,7 @@ class NavigationAnimatedView
}
}
render(): ReactElement {
render(): ReactElement<any> {
const overlay = this._renderOverlay();
const scenes = this._renderScenes();
return (
@ -175,11 +175,11 @@ class NavigationAnimatedView
);
}
_renderScenes(): Array<?ReactElement> {
_renderScenes(): Array<?ReactElement<any>> {
return this.state.scenes.map(this._renderScene, this);
}
_renderScene(scene: NavigationScene): ?ReactElement {
_renderScene(scene: NavigationScene): ?ReactElement<any> {
const {
navigationState,
onNavigate,
@ -203,7 +203,7 @@ class NavigationAnimatedView
});
}
_renderOverlay(): ?ReactElement {
_renderOverlay(): ?ReactElement<any> {
if (this.props.renderOverlay) {
const {
navigationState,

View File

@ -162,7 +162,7 @@ class NavigationTransitioner extends React.Component<any, Props, State> {
Animated.parallel(animations).start(this._onTransitionEnd);
}
render(): ReactElement {
render(): ReactElement<any> {
const overlay = this._renderOverlay();
const scenes = this._renderScenes();
return (
@ -177,11 +177,11 @@ class NavigationTransitioner extends React.Component<any, Props, State> {
);
}
_renderScenes(): Array<?ReactElement> {
_renderScenes(): Array<?ReactElement<any>> {
return this.state.scenes.map(this._renderScene, this);
}
_renderScene(scene: NavigationScene): ?ReactElement {
_renderScene(scene: NavigationScene): ?ReactElement<any> {
const {
navigationState,
onNavigate,
@ -205,7 +205,7 @@ class NavigationTransitioner extends React.Component<any, Props, State> {
});
}
_renderOverlay(): ?ReactElement {
_renderOverlay(): ?ReactElement<any> {
if (this.props.renderOverlay) {
const {
navigationState,

View File

@ -109,7 +109,7 @@ export type NavigationAnimationSetter = (
export type NavigationRenderer = (
navigationState: ?NavigationRoute,
onNavigate: NavigationActionCaller,
) => ReactElement;
) => ReactElement<any>;
export type NavigationReducer = (
state: ?NavigationRoute,
@ -118,7 +118,7 @@ export type NavigationReducer = (
export type NavigationSceneRenderer = (
props: NavigationSceneRendererProps,
) => ?ReactElement;
) => ?ReactElement<any>;
export type NavigationStyleInterpolator = (
props: NavigationSceneRendererProps,

View File

@ -207,7 +207,7 @@ const NetInfo = {
* Returns a promise that resolves with one of the connectivity types listed
* above.
*/
fetch(): Promise {
fetch(): Promise<any> {
return RCTNetInfo.getCurrentConnectivity().then(resp => resp.network_info);
},
@ -248,14 +248,14 @@ const NetInfo = {
_isConnectedSubscriptions.delete(handler);
},
fetch(): Promise {
fetch(): Promise<any> {
return NetInfo.fetch().then(
(connection) => _isConnected(connection)
);
},
},
isConnectionExpensive(): Promise {
isConnectionExpensive(): Promise<any> {
return deprecatedCallback(
Platform.OS === 'android' ? RCTNetInfo.isConnectionMetered() : Promise.reject(new Error('Currently not supported on iOS')),
Array.prototype.slice.call(arguments),

View File

@ -177,7 +177,7 @@ const WarningInspector = ({
class YellowBox extends React.Component {
state: {
inspecting: ?string;
warningMap: Map;
warningMap: Map<any, any>;
};
_listener: ?EmitterSubscription;
dismissWarning: (warning: ?string) => void;

View File

@ -144,7 +144,7 @@ const Text = React.createClass({
touchableHandlePress: (null: ?Function),
touchableHandleLongPress: (null: ?Function),
touchableGetPressRectOffset: (null: ?Function),
render(): ReactElement {
render(): ReactElement<any> {
let newProps = this.props;
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
if (!this._handlers) {

View File

@ -37,7 +37,7 @@ const _takeSnapshot = UIManager.takeSnapshot;
* @platform ios
*/
UIManager.takeSnapshot = async function(
view ?: 'window' | ReactElement | number,
view ?: 'window' | ReactElement<any> | number,
options ?: {
width ?: number;
height ?: number;

View File

@ -14,7 +14,7 @@
'use strict';
module.exports = function(promise: Promise, callbacks: Array<Function>, type: string, warning: string): Promise {
module.exports = function(promise: Promise<any>, callbacks: Array<Function>, type: string, warning: string): Promise<any> {
if (callbacks.length === 0) {
return promise;
}