mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 07:35:25 +00:00
more UIExplorer flow
This commit is contained in:
parent
a6b154332b
commit
d6bb48d972
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -150,7 +151,7 @@ var NavigatorIOSExample = React.createClass({
|
||||
});
|
||||
},
|
||||
|
||||
_renderRow: function(title, onPress) {
|
||||
_renderRow: function(title: string, onPress: Function) {
|
||||
return (
|
||||
<View>
|
||||
<TouchableHighlight onPress={onPress}>
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -120,16 +121,16 @@ exports.examples = [
|
||||
{
|
||||
title: 'NetInfo.isConnected',
|
||||
description: 'Asyncronously load and observe connectivity',
|
||||
render() { return <IsConnected />; }
|
||||
render(): ReactElement { return <IsConnected />; }
|
||||
},
|
||||
{
|
||||
title: 'NetInfo.reachabilityIOS',
|
||||
description: 'Asyncronously load and observe iOS reachability',
|
||||
render() { return <ReachabilityCurrent />; }
|
||||
render(): ReactElement { return <ReachabilityCurrent />; }
|
||||
},
|
||||
{
|
||||
title: 'NetInfo.reachabilityIOS',
|
||||
description: 'Observed updates to iOS reachability',
|
||||
render() { return <ReachabilitySubscription />; }
|
||||
render(): ReactElement { return <ReachabilitySubscription />; }
|
||||
},
|
||||
];
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -105,7 +106,7 @@ exports.description = 'Render lists of selectable options with UIPickerView.';
|
||||
exports.examples = [
|
||||
{
|
||||
title: '<PickerIOS>',
|
||||
render: function() {
|
||||
render: function(): ReactElement {
|
||||
return <PickerExample />;
|
||||
},
|
||||
}];
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -50,6 +51,6 @@ exports.description = 'Slider input for numeric values';
|
||||
exports.examples = [
|
||||
{
|
||||
title: 'SliderIOS',
|
||||
render() { return <SliderExample />; }
|
||||
render(): ReactElement { return <SliderExample />; }
|
||||
}
|
||||
];
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -118,22 +119,22 @@ exports.description = 'Native boolean input';
|
||||
exports.examples = [
|
||||
{
|
||||
title: 'Switches can be set to true or false',
|
||||
render() { return <BasicSwitchExample />; }
|
||||
render(): ReactElement { return <BasicSwitchExample />; }
|
||||
},
|
||||
{
|
||||
title: 'Switches can be disabled',
|
||||
render() { return <DisabledSwitchExample />; }
|
||||
render(): ReactElement { return <DisabledSwitchExample />; }
|
||||
},
|
||||
{
|
||||
title: 'Custom colors can be provided',
|
||||
render() { return <ColorSwitchExample />; }
|
||||
render(): ReactElement { return <ColorSwitchExample />; }
|
||||
},
|
||||
{
|
||||
title: 'Change events can be detected',
|
||||
render() { return <EventSwitchExample />; }
|
||||
render(): ReactElement { return <EventSwitchExample />; }
|
||||
},
|
||||
{
|
||||
title: 'Switches are controlled components',
|
||||
render() { return <SwitchIOS />; }
|
||||
render(): ReactElement { return <SwitchIOS />; }
|
||||
}
|
||||
];
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -199,7 +200,7 @@ exports.examples = [
|
||||
},
|
||||
}, {
|
||||
title: 'Toggling Attributes',
|
||||
render: function() {
|
||||
render: function(): ReactElement {
|
||||
return <AttributeToggler />;
|
||||
},
|
||||
}, {
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -164,7 +165,7 @@ exports.examples = [
|
||||
},
|
||||
{
|
||||
title: 'Event handling',
|
||||
render: () => <TextEventsExample />,
|
||||
render: function(): ReactElement { return <TextEventsExample /> },
|
||||
},
|
||||
{
|
||||
title: 'Colored input text',
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -31,6 +32,12 @@ var Button = React.createClass({
|
||||
var TimerTester = React.createClass({
|
||||
mixins: [TimerMixin],
|
||||
|
||||
_ii: 0,
|
||||
_iters: 0,
|
||||
_start: 0,
|
||||
_timerFn: (null : ?(() => any)),
|
||||
_handle: (null : any),
|
||||
|
||||
render: function() {
|
||||
var args = 'fn' + (this.props.dt !== undefined ? ', ' + this.props.dt : '');
|
||||
return (
|
||||
@ -71,7 +78,7 @@ var TimerTester = React.createClass({
|
||||
'Elapsed time: ' + e + ' ms\n' + (e / this._ii) + ' ms / iter';
|
||||
console.log(msg);
|
||||
AlertIOS.alert(msg);
|
||||
this._start = null;
|
||||
this._start = 0;
|
||||
this.forceUpdate(() => { this._ii = 0; });
|
||||
return;
|
||||
}
|
||||
@ -153,7 +160,7 @@ exports.examples = [
|
||||
title: 'this.setInterval(fn, t)',
|
||||
description: 'Execute function fn every t milliseconds until cancelled ' +
|
||||
'or component is unmounted.',
|
||||
render: function() {
|
||||
render: function(): ReactElement {
|
||||
var IntervalExample = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -53,14 +54,14 @@ exports.examples = [
|
||||
},
|
||||
}, {
|
||||
title: '<Text onPress={fn}> with highlight',
|
||||
render: function() {
|
||||
render: function(): ReactElement {
|
||||
return <TextOnPressBox />;
|
||||
},
|
||||
}, {
|
||||
title: 'Touchable feedback events',
|
||||
description: '<Touchable*> components accept onPress, onPressIn, ' +
|
||||
'onPressOut, and onLongPress as props.',
|
||||
render: function() {
|
||||
render: function(): ReactElement {
|
||||
return <TouchableFeedbackEvents />;
|
||||
},
|
||||
}];
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule UIExplorerApp
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule UIExplorerBlock
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -19,7 +20,7 @@ var UIExplorerBlock = React.createClass({
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {description: null};
|
||||
return {description: (null: ?string)};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule UIExplorerPage
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule UIExplorerTitle
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -35,6 +36,8 @@ var WebViewExample = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
inputText: '',
|
||||
|
||||
handleTextInputChange: function(event) {
|
||||
this.inputText = event.nativeEvent.text;
|
||||
},
|
||||
@ -259,6 +262,6 @@ exports.description = 'Base component to display web content';
|
||||
exports.examples = [
|
||||
{
|
||||
title: 'WebView',
|
||||
render() { return <WebViewExample />; }
|
||||
render(): ReactElement { return <WebViewExample />; }
|
||||
}
|
||||
];
|
||||
|
@ -21,7 +21,7 @@ var StatusBarIOS = {
|
||||
slide: RCTStatusBarManager.Animation.slide,
|
||||
},
|
||||
|
||||
setStyle(style: number, animated: boolean) {
|
||||
setStyle(style: number, animated?: boolean) {
|
||||
animated = animated || false;
|
||||
RCTStatusBarManager.setStyle(style, animated);
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ class AlertIOS {
|
||||
*/
|
||||
static alert(
|
||||
title: ?string,
|
||||
message: ?string,
|
||||
message?: ?string,
|
||||
buttons?: Array<{
|
||||
text: ?string;
|
||||
onPress: ?Function;
|
||||
|
Loading…
x
Reference in New Issue
Block a user