[Flow] Fix or suppress react-native github errors for Flow v0.12.0
This commit is contained in:
Родитель
5d154f1af4
Коммит
b05e99a531
|
@ -34,11 +34,14 @@ var MovieCell = React.createClass({
|
||||||
var criticsScore = this.props.movie.ratings.critics_score;
|
var criticsScore = this.props.movie.ratings.critics_score;
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<TouchableHighlight
|
<TouchableHighlight
|
||||||
onPress={this.props.onSelect}
|
onPress={this.props.onSelect}
|
||||||
onShowUnderlay={this.props.onHighlight}
|
onShowUnderlay={this.props.onHighlight}
|
||||||
onHideUnderlay={this.props.onUnhighlight}>
|
onHideUnderlay={this.props.onUnhighlight}>
|
||||||
<View style={styles.row}>
|
<View style={styles.row}>
|
||||||
|
{/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
|
||||||
|
* omit a property or set it to undefined if it's inside a shape,
|
||||||
|
* even if it isn't required */}
|
||||||
<Image
|
<Image
|
||||||
source={getImageSource(this.props.movie, 'det')}
|
source={getImageSource(this.props.movie, 'det')}
|
||||||
style={styles.cellImage}
|
style={styles.cellImage}
|
||||||
|
|
|
@ -34,6 +34,9 @@ var MovieScreen = React.createClass({
|
||||||
return (
|
return (
|
||||||
<ScrollView contentContainerStyle={styles.contentContainer}>
|
<ScrollView contentContainerStyle={styles.contentContainer}>
|
||||||
<View style={styles.mainSection}>
|
<View style={styles.mainSection}>
|
||||||
|
{/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
|
||||||
|
* omit a property or set it to undefined if it's inside a shape,
|
||||||
|
* even if it isn't required */}
|
||||||
<Image
|
<Image
|
||||||
source={getImageSource(this.props.movie, 'det')}
|
source={getImageSource(this.props.movie, 'det')}
|
||||||
style={styles.detailsImage}
|
style={styles.detailsImage}
|
||||||
|
|
|
@ -28,6 +28,9 @@ var SearchScreen = require('./SearchScreen');
|
||||||
var MoviesApp = React.createClass({
|
var MoviesApp = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
|
/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
|
||||||
|
* omit a property or set it to undefined if it's inside a shape,
|
||||||
|
* even if it isn't required */
|
||||||
<NavigatorIOS
|
<NavigatorIOS
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
initialRoute={{
|
initialRoute={{
|
||||||
|
|
|
@ -159,12 +159,15 @@ var MapViewExample = React.createClass({
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
{/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
|
||||||
|
* omit a property or set it to undefined if it's inside a shape,
|
||||||
|
* even if it isn't required */}
|
||||||
<MapView
|
<MapView
|
||||||
style={styles.map}
|
style={styles.map}
|
||||||
onRegionChange={this._onRegionChange}
|
onRegionChange={this._onRegionChange}
|
||||||
onRegionChangeComplete={this._onRegionChangeComplete}
|
onRegionChangeComplete={this._onRegionChangeComplete}
|
||||||
region={this.state.mapRegion}
|
region={this.state.mapRegion || undefined}
|
||||||
annotations={this.state.annotations}
|
annotations={this.state.annotations || undefined}
|
||||||
/>
|
/>
|
||||||
<MapRegionInput
|
<MapRegionInput
|
||||||
onChange={this._onRegionInputChanged}
|
onChange={this._onRegionInputChanged}
|
||||||
|
|
|
@ -44,6 +44,9 @@ var UIExplorerApp = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
/* $FlowIssue #7363964 - There's a bug in Flow where you cannot
|
||||||
|
* omit a property or set it to undefined if it's inside a shape,
|
||||||
|
* even if it isn't required */
|
||||||
<NavigatorIOS
|
<NavigatorIOS
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
initialRoute={{
|
initialRoute={{
|
||||||
|
|
|
@ -37,9 +37,9 @@ var UIExplorerPage = React.createClass({
|
||||||
var ContentWrapper;
|
var ContentWrapper;
|
||||||
var wrapperProps = {};
|
var wrapperProps = {};
|
||||||
if (this.props.noScroll) {
|
if (this.props.noScroll) {
|
||||||
ContentWrapper = View;
|
ContentWrapper = (View: ReactClass<any, any, any>);
|
||||||
} else {
|
} else {
|
||||||
ContentWrapper = ScrollView;
|
ContentWrapper = (ScrollView: ReactClass<any, any, any>);
|
||||||
wrapperProps.keyboardShouldPersistTaps = true;
|
wrapperProps.keyboardShouldPersistTaps = true;
|
||||||
wrapperProps.keyboardDismissMode = 'interactive';
|
wrapperProps.keyboardDismissMode = 'interactive';
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,7 +299,7 @@ var ScrollView = React.createClass({
|
||||||
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
onResponderRelease: this.scrollResponderHandleResponderRelease,
|
||||||
onResponderReject: this.scrollResponderHandleResponderReject,
|
onResponderReject: this.scrollResponderHandleResponderReject,
|
||||||
};
|
};
|
||||||
|
|
||||||
var ScrollViewClass;
|
var ScrollViewClass;
|
||||||
if (Platform.OS === 'ios') {
|
if (Platform.OS === 'ios') {
|
||||||
ScrollViewClass = RCTScrollView;
|
ScrollViewClass = RCTScrollView;
|
||||||
|
|
|
@ -147,7 +147,7 @@ var NetInfo = {
|
||||||
eventName: ChangeEventName,
|
eventName: ChangeEventName,
|
||||||
handler: Function
|
handler: Function
|
||||||
): void {
|
): void {
|
||||||
_subscriptions[handler] = RCTDeviceEventEmitter.addListener(
|
_subscriptions[String(handler)] = RCTDeviceEventEmitter.addListener(
|
||||||
DEVICE_REACHABILITY_EVENT,
|
DEVICE_REACHABILITY_EVENT,
|
||||||
(appStateData) => {
|
(appStateData) => {
|
||||||
handler(appStateData.network_reachability);
|
handler(appStateData.network_reachability);
|
||||||
|
@ -159,11 +159,11 @@ var NetInfo = {
|
||||||
eventName: ChangeEventName,
|
eventName: ChangeEventName,
|
||||||
handler: Function
|
handler: Function
|
||||||
): void {
|
): void {
|
||||||
if (!_subscriptions[handler]) {
|
if (!_subscriptions[String(handler)]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_subscriptions[handler].remove();
|
_subscriptions[String(handler)].remove();
|
||||||
_subscriptions[handler] = null;
|
_subscriptions[String(handler)] = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
fetch: function(): Promise {
|
fetch: function(): Promise {
|
||||||
|
@ -204,12 +204,12 @@ NetInfo.isConnected = {
|
||||||
eventName: ChangeEventName,
|
eventName: ChangeEventName,
|
||||||
handler: Function
|
handler: Function
|
||||||
): void {
|
): void {
|
||||||
_isConnectedSubscriptions[handler] = (connection) => {
|
_isConnectedSubscriptions[String(handler)] = (connection) => {
|
||||||
handler(_isConnected(connection));
|
handler(_isConnected(connection));
|
||||||
};
|
};
|
||||||
NetInfo.addEventListener(
|
NetInfo.addEventListener(
|
||||||
eventName,
|
eventName,
|
||||||
_isConnectedSubscriptions[handler]
|
_isConnectedSubscriptions[String(handler)]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ NetInfo.isConnected = {
|
||||||
): void {
|
): void {
|
||||||
NetInfo.removeEventListener(
|
NetInfo.removeEventListener(
|
||||||
eventName,
|
eventName,
|
||||||
_isConnectedSubscriptions[handler]
|
_isConnectedSubscriptions[String(handler)]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -66,14 +66,14 @@ class PushNotificationIOS {
|
||||||
'PushNotificationIOS only supports `notification` and `register` events'
|
'PushNotificationIOS only supports `notification` and `register` events'
|
||||||
);
|
);
|
||||||
if (type === 'notification') {
|
if (type === 'notification') {
|
||||||
_notifHandlers[handler] = RCTDeviceEventEmitter.addListener(
|
_notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener(
|
||||||
DEVICE_NOTIF_EVENT,
|
DEVICE_NOTIF_EVENT,
|
||||||
(notifData) => {
|
(notifData) => {
|
||||||
handler(new PushNotificationIOS(notifData));
|
handler(new PushNotificationIOS(notifData));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else if (type === 'register') {
|
} else if (type === 'register') {
|
||||||
_notifHandlers[handler] = RCTDeviceEventEmitter.addListener(
|
_notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener(
|
||||||
NOTIF_REGISTER_EVENT,
|
NOTIF_REGISTER_EVENT,
|
||||||
(registrationInfo) => {
|
(registrationInfo) => {
|
||||||
handler(registrationInfo.deviceToken);
|
handler(registrationInfo.deviceToken);
|
||||||
|
@ -143,11 +143,11 @@ class PushNotificationIOS {
|
||||||
type === 'notification' || type === 'register',
|
type === 'notification' || type === 'register',
|
||||||
'PushNotificationIOS only supports `notification` and `register` events'
|
'PushNotificationIOS only supports `notification` and `register` events'
|
||||||
);
|
);
|
||||||
if (!_notifHandlers[handler]) {
|
if (!_notifHandlers[String(handler)]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_notifHandlers[handler].remove();
|
_notifHandlers[String(handler)].remove();
|
||||||
_notifHandlers[handler] = null;
|
_notifHandlers[String(handler)] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* If none are set, returns false.
|
* If none are set, returns false.
|
||||||
*/
|
*/
|
||||||
function resolveBoxStyle(prefix: String, style: Object): ?Object {
|
function resolveBoxStyle(prefix: string, style: Object): ?Object {
|
||||||
var res = {};
|
var res = {};
|
||||||
var subs = ['top', 'left', 'bottom', 'right'];
|
var subs = ['top', 'left', 'bottom', 'right'];
|
||||||
var set = false;
|
var set = false;
|
||||||
|
|
|
@ -26,7 +26,7 @@ type ReactNativeBaseComponentViewConfig = {
|
||||||
*/
|
*/
|
||||||
var createReactNativeComponentClass = function(
|
var createReactNativeComponentClass = function(
|
||||||
viewConfig: ReactNativeBaseComponentViewConfig
|
viewConfig: ReactNativeBaseComponentViewConfig
|
||||||
): Function { // returning Function is lossy :/
|
): ReactClass<any, any, any> {
|
||||||
var Constructor = function(element) {
|
var Constructor = function(element) {
|
||||||
this._currentElement = element;
|
this._currentElement = element;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ var createReactNativeComponentClass = function(
|
||||||
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
|
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
|
||||||
Constructor.prototype.constructor = Constructor;
|
Constructor.prototype.constructor = Constructor;
|
||||||
|
|
||||||
return Constructor;
|
return ((Constructor: any): ReactClass);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = createReactNativeComponentClass;
|
module.exports = createReactNativeComponentClass;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
var GLOBAL = GLOBAL || this;
|
var GLOBAL = GLOBAL || this;
|
||||||
|
|
||||||
var BridgeProfiling = {
|
var BridgeProfiling = {
|
||||||
profile(profileName: String, args?: any) {
|
profile(profileName: string, args?: any) {
|
||||||
if (GLOBAL.__BridgeProfilingIsProfiling) {
|
if (GLOBAL.__BridgeProfilingIsProfiling) {
|
||||||
if (args) {
|
if (args) {
|
||||||
try {
|
try {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче