Skip to content

Commit

Permalink
[Flow] Fix or suppress react-native github errors for Flow v0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gabelevi authored and sahrens committed Jun 12, 2015
1 parent 78db5ca commit 1acca01
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 22 deletions.
5 changes: 4 additions & 1 deletion Examples/Movies/MovieCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ var MovieCell = React.createClass({
var criticsScore = this.props.movie.ratings.critics_score;
return (
<View>
<TouchableHighlight
<TouchableHighlight
onPress={this.props.onSelect}
onShowUnderlay={this.props.onHighlight}
onHideUnderlay={this.props.onUnhighlight}>
<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
source={getImageSource(this.props.movie, 'det')}
style={styles.cellImage}
Expand Down
3 changes: 3 additions & 0 deletions Examples/Movies/MovieScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ var MovieScreen = React.createClass({
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<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
source={getImageSource(this.props.movie, 'det')}
style={styles.detailsImage}
Expand Down
3 changes: 3 additions & 0 deletions Examples/Movies/MoviesApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ var SearchScreen = require('./SearchScreen');
var MoviesApp = React.createClass({
render: function() {
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
style={styles.container}
initialRoute={{
Expand Down
7 changes: 5 additions & 2 deletions Examples/UIExplorer/MapViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ var MapViewExample = React.createClass({
render() {
return (
<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
style={styles.map}
onRegionChange={this._onRegionChange}
onRegionChangeComplete={this._onRegionChangeComplete}
region={this.state.mapRegion}
annotations={this.state.annotations}
region={this.state.mapRegion || undefined}
annotations={this.state.annotations || undefined}
/>
<MapRegionInput
onChange={this._onRegionInputChanged}
Expand Down
3 changes: 3 additions & 0 deletions Examples/UIExplorer/UIExplorerApp.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var UIExplorerApp = React.createClass({
);
}
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
style={styles.container}
initialRoute={{
Expand Down
4 changes: 2 additions & 2 deletions Examples/UIExplorer/UIExplorerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ var UIExplorerPage = React.createClass({
var ContentWrapper;
var wrapperProps = {};
if (this.props.noScroll) {
ContentWrapper = View;
ContentWrapper = (View: ReactClass<any, any, any>);
} else {
ContentWrapper = ScrollView;
ContentWrapper = (ScrollView: ReactClass<any, any, any>);
wrapperProps.keyboardShouldPersistTaps = true;
wrapperProps.keyboardDismissMode = 'interactive';
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ var ScrollView = React.createClass({
onResponderRelease: this.scrollResponderHandleResponderRelease,
onResponderReject: this.scrollResponderHandleResponderReject,
};

var ScrollViewClass;
if (Platform.OS === 'ios') {
ScrollViewClass = RCTScrollView;
Expand Down
14 changes: 7 additions & 7 deletions Libraries/Network/NetInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var NetInfo = {
eventName: ChangeEventName,
handler: Function
): void {
_subscriptions[handler] = RCTDeviceEventEmitter.addListener(
_subscriptions[String(handler)] = RCTDeviceEventEmitter.addListener(
DEVICE_REACHABILITY_EVENT,
(appStateData) => {
handler(appStateData.network_reachability);
Expand All @@ -159,11 +159,11 @@ var NetInfo = {
eventName: ChangeEventName,
handler: Function
): void {
if (!_subscriptions[handler]) {
if (!_subscriptions[String(handler)]) {
return;
}
_subscriptions[handler].remove();
_subscriptions[handler] = null;
_subscriptions[String(handler)].remove();
_subscriptions[String(handler)] = null;
},

fetch: function(): Promise {
Expand Down Expand Up @@ -204,12 +204,12 @@ NetInfo.isConnected = {
eventName: ChangeEventName,
handler: Function
): void {
_isConnectedSubscriptions[handler] = (connection) => {
_isConnectedSubscriptions[String(handler)] = (connection) => {
handler(_isConnected(connection));
};
NetInfo.addEventListener(
eventName,
_isConnectedSubscriptions[handler]
_isConnectedSubscriptions[String(handler)]
);
},

Expand All @@ -219,7 +219,7 @@ NetInfo.isConnected = {
): void {
NetInfo.removeEventListener(
eventName,
_isConnectedSubscriptions[handler]
_isConnectedSubscriptions[String(handler)]
);
},

Expand Down
10 changes: 5 additions & 5 deletions Libraries/PushNotificationIOS/PushNotificationIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class PushNotificationIOS {
'PushNotificationIOS only supports `notification` and `register` events'
);
if (type === 'notification') {
_notifHandlers[handler] = RCTDeviceEventEmitter.addListener(
_notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener(
DEVICE_NOTIF_EVENT,
(notifData) => {
handler(new PushNotificationIOS(notifData));
}
);
} else if (type === 'register') {
_notifHandlers[handler] = RCTDeviceEventEmitter.addListener(
_notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener(
NOTIF_REGISTER_EVENT,
(registrationInfo) => {
handler(registrationInfo.deviceToken);
Expand Down Expand Up @@ -143,11 +143,11 @@ class PushNotificationIOS {
type === 'notification' || type === 'register',
'PushNotificationIOS only supports `notification` and `register` events'
);
if (!_notifHandlers[handler]) {
if (!_notifHandlers[String(handler)]) {
return;
}
_notifHandlers[handler].remove();
_notifHandlers[handler] = null;
_notifHandlers[String(handler)].remove();
_notifHandlers[String(handler)] = null;
}


Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/InspectorOverlay/resolveBoxStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* If none are set, returns false.
*/
function resolveBoxStyle(prefix: String, style: Object): ?Object {
function resolveBoxStyle(prefix: string, style: Object): ?Object {
var res = {};
var subs = ['top', 'left', 'bottom', 'right'];
var set = false;
Expand Down
4 changes: 2 additions & 2 deletions Libraries/ReactNative/createReactNativeComponentClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ReactNativeBaseComponentViewConfig = {
*/
var createReactNativeComponentClass = function(
viewConfig: ReactNativeBaseComponentViewConfig
): Function { // returning Function is lossy :/
): ReactClass<any, any, any> {
var Constructor = function(element) {
this._currentElement = element;

Expand All @@ -39,7 +39,7 @@ var createReactNativeComponentClass = function(
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
Constructor.prototype.constructor = Constructor;

return Constructor;
return ((Constructor: any): ReactClass);
};

module.exports = createReactNativeComponentClass;
2 changes: 1 addition & 1 deletion Libraries/Utilities/BridgeProfiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var GLOBAL = GLOBAL || this;

var BridgeProfiling = {
profile(profileName: String, args?: any) {
profile(profileName: string, args?: any) {
if (GLOBAL.__BridgeProfilingIsProfiling) {
if (args) {
try {
Expand Down

0 comments on commit 1acca01

Please sign in to comment.