From 7a8398b9560ac68642fe5e44138bc6c01501db0a Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 1 Jul 2015 12:51:59 -0700 Subject: [PATCH] [Flow] Update flowconfig's version req to 0.13.1, fix Movies example typechecking Summary: This should fix tests. Closes https://github.com/facebook/react-native/pull/1819 Github Author: James Ide Test Plan: Run Travis CI tests. Also run the movies app and verify that there are no invariant violations. --- Examples/Movies/SearchScreen.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Examples/Movies/SearchScreen.js b/Examples/Movies/SearchScreen.js index 21819df46..c0877d978 100644 --- a/Examples/Movies/SearchScreen.js +++ b/Examples/Movies/SearchScreen.js @@ -26,6 +26,8 @@ var { } = React; var TimerMixin = require('react-timer-mixin'); +var invariant = require('invariant'); + var MovieCell = require('./MovieCell'); var MovieScreen = require('./MovieScreen'); @@ -73,18 +75,16 @@ var SearchScreen = React.createClass({ this.searchMovies(''); }, - _urlForQueryAndPage: function(query: string, pageNumber: ?number): string { + _urlForQueryAndPage: function(query: string, pageNumber: number): string { var apiKey = API_KEYS[this.state.queryNumber % API_KEYS.length]; if (query) { return ( - // $FlowFixMe(>=0.13.0) - pageNumber may be null or undefined API_URL + 'movies.json?apikey=' + apiKey + '&q=' + encodeURIComponent(query) + '&page_limit=20&page=' + pageNumber ); } else { // With no query, load latest movies return ( - // $FlowFixMe(>=0.13.0) - pageNumber may be null or undefined API_URL + 'lists/movies/in_theaters.json?apikey=' + apiKey + '&page_limit=20&page=' + pageNumber ); @@ -176,6 +176,7 @@ var SearchScreen = React.createClass({ }); var page = resultsCache.nextPageNumberForQuery[query]; + invariant(page != null, 'Next page number for "%s" is missing', query); fetch(this._urlForQueryAndPage(query, page)) .then((response) => response.json()) .catch((error) => {