mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
last batch of UIExplorer flowification
This commit is contained in:
parent
23094dbfc3
commit
6daf7d2634
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
[libs]
|
[libs]
|
||||||
Libraries/react-native/react-native-interface.js
|
Libraries/react-native/react-native-interface.js
|
||||||
|
Examples/UIExplorer/ImageMocks.js
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
module.system=haste
|
module.system=haste
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule ImageCapInsetsExample
|
* @providesModule ImageCapInsetsExample
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
35
Examples/UIExplorer/ImageMocks.js
Normal file
35
Examples/UIExplorer/ImageMocks.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
declare module 'image!story-background' {
|
||||||
|
declare var uri: string;
|
||||||
|
declare var isStatic: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'image!uie_comment_highlighted' {
|
||||||
|
declare var uri: string;
|
||||||
|
declare var isStatic: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'image!uie_comment_normal' {
|
||||||
|
declare var uri: string;
|
||||||
|
declare var isStatic: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'image!uie_thumb_normal' {
|
||||||
|
declare var uri: string;
|
||||||
|
declare var isStatic: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'image!uie_thumb_selected' {
|
||||||
|
declare var uri: string;
|
||||||
|
declare var isStatic: boolean;
|
||||||
|
}
|
@ -5,6 +5,8 @@
|
|||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -188,7 +190,7 @@ exports.description = 'Base component to display maps';
|
|||||||
exports.examples = [
|
exports.examples = [
|
||||||
{
|
{
|
||||||
title: 'Map',
|
title: 'Map',
|
||||||
render() { return <MapViewExample />; }
|
render(): ReactElement { return <MapViewExample />; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Map shows user location',
|
title: 'Map shows user location',
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ var TabBarExample = React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderContent: function(color, pageText) {
|
_renderContent: function(color: string, pageText: string) {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.tabContent, {backgroundColor: color}]}>
|
<View style={[styles.tabContent, {backgroundColor: color}]}>
|
||||||
<Text style={styles.tabText}>{pageText}</Text>
|
<Text style={styles.tabText}>{pageText}</Text>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule createExamplePage
|
* @providesModule createExamplePage
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -16,7 +17,19 @@ var UIExplorerPage = require('./UIExplorerPage');
|
|||||||
|
|
||||||
var invariant = require('invariant');
|
var invariant = require('invariant');
|
||||||
|
|
||||||
var createExamplePage = function(title, exampleModule) {
|
class Example extends React.Component {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExampleModule = {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
examples: Array<Example>;
|
||||||
|
};
|
||||||
|
|
||||||
|
var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
||||||
|
: ReactClass<any, any, any> {
|
||||||
invariant(!!exampleModule.examples, 'The module must have examples');
|
invariant(!!exampleModule.examples, 'The module must have examples');
|
||||||
|
|
||||||
var ExamplePage = React.createClass({
|
var ExamplePage = React.createClass({
|
||||||
@ -31,15 +44,17 @@ var createExamplePage = function(title, exampleModule) {
|
|||||||
var originalRenderComponent = React.renderComponent;
|
var originalRenderComponent = React.renderComponent;
|
||||||
var originalRender = React.render;
|
var originalRender = React.render;
|
||||||
var renderedComponent;
|
var renderedComponent;
|
||||||
React.render = React.renderComponent = function(element, container) {
|
// TODO remove typecasts when Flow bug #6560135 is fixed
|
||||||
|
// and workaround is removed from react-native.js
|
||||||
|
(React: Object).render = (React: Object).renderComponent = function(element, container) {
|
||||||
renderedComponent = element;
|
renderedComponent = element;
|
||||||
};
|
};
|
||||||
var result = example.render(null);
|
var result = example.render(null);
|
||||||
if (result) {
|
if (result) {
|
||||||
renderedComponent = result;
|
renderedComponent = result;
|
||||||
}
|
}
|
||||||
React.renderComponent = originalRenderComponent;
|
(React: Object).renderComponent = originalRenderComponent;
|
||||||
React.render = originalRender;
|
(React: Object).render = originalRender;
|
||||||
return (
|
return (
|
||||||
<UIExplorerBlock
|
<UIExplorerBlock
|
||||||
key={i}
|
key={i}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user