diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..fd62e40 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,70 @@ +[ignore] + +# We fork some components by platform. +.*/*.web.js +.*/*.android.js + +# Some modules have their own node_modules with overlap +.*/node_modules/node-haste/.* + +# Ugh +.*/node_modules/babel.* +.*/node_modules/babylon.* +.*/node_modules/invariant.* + +# Ignore react and fbjs where there are overlaps, but don't ignore +# anything that react-native relies on +.*/node_modules/fbjs/lib/Map.js +.*/node_modules/fbjs/lib/fetch.js +.*/node_modules/fbjs/lib/ExecutionEnvironment.js +.*/node_modules/fbjs/lib/ErrorUtils.js + +# Flow has a built-in definition for the 'react' module which we prefer to use +# over the currently-untyped source +.*/node_modules/react/react.js +.*/node_modules/react/lib/React.js +.*/node_modules/react/lib/ReactDOM.js + +.*/__mocks__/.* +.*/__tests__/.* + +.*/commoner/test/source/widget/share.js + +# Ignore commoner tests +.*/node_modules/commoner/test/.* + +# See https://github.com/facebook/flow/issues/442 +.*/react-tools/node_modules/commoner/lib/reader.js + +# Ignore jest +.*/node_modules/jest-cli/.* + +# Ignore Website +.*/website/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js + +[options] +module.system=haste + +esproposal.class_static_fields=enable +esproposal.class_instance_fields=enable + +munge_underscores=true + +module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy + +[version] +0.21.0 diff --git a/.gitignore b/.gitignore index c9c9720..94fc867 100644 --- a/.gitignore +++ b/.gitignore @@ -1,212 +1,34 @@ -######################### -# .gitignore file for Xcode4 and Xcode5 Source projects +# OSX # -# Apple bugs, waiting for Apple to fix/respond: -# -# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? -# -# Version 2.3 -# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects -# -# 2014 updates: -# - appended non-standard items DISABLED by default (uncomment if you use those tools) -# - removed the edit that an SO.com moderator made without bothering to ask me -# - researched CocoaPods .lock more carefully, thanks to Gokhan Celiker -# 2013 updates: -# - fixed the broken "save personal Schemes" -# - added line-by-line explanations for EVERYTHING (some were missing) -# -# NB: if you are storing "built" products, this WILL NOT WORK, -# and you should use a different .gitignore (or none at all) -# This file is for SOURCE projects, where there are many extra -# files that we want to exclude -# -######################### - -##### -# OS X temporary files that should never be committed -# -# c.f. http://www.westwind.com/reference/os-x/invisibles.html - .DS_Store -# c.f. http://www.westwind.com/reference/os-x/invisibles.html - -.Trashes - -# c.f. http://www.westwind.com/reference/os-x/invisibles.html - -*.swp - -# -# *.lock - this is used and abused by many editors for many different things. -# For the main ones I use (e.g. Eclipse), it should be excluded -# from source-control, but YMMV. -# (lock files are usually local-only file-synchronization on the local FS that should NOT go in git) -# c.f. the "OPTIONAL" section at bottom though, for tool-specific variations! - -*.lock - - -# -# profile - REMOVED temporarily (on double-checking, I can't find it in OS X docs?) -#profile - - -#### -# Xcode temporary files that should never be committed -# -# NB: NIB/XIB files still exist even on Storyboard projects, so we want this... - -*~.nib - - -#### -# Xcode build files - +# Xcode # -# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" - -DerivedData/ - -# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" - build/ - - -##### -# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) -# -# This is complicated: -# -# SOMETIMES you need to put this file in version control. -# Apple designed it poorly - if you use "custom executables", they are -# saved in this file. -# 99% of projects do NOT use those, so they do NOT want to version control this file. -# ..but if you're in the 1%, comment out the line "*.pbxuser" - -# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html - *.pbxuser - -# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html - -*.mode1v3 - -# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html - -*.mode2v3 - -# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file - -*.perspectivev3 - -# NB: also, whitelist the default ones, some projects need to use these !default.pbxuser +*.mode1v3 !default.mode1v3 +*.mode2v3 !default.mode2v3 +*.perspectivev3 !default.perspectivev3 - - -#### -# Xcode 4 - semi-personal settings -# -# -# OPTION 1: --------------------------------- -# throw away ALL personal settings (including custom schemes! -# - unless they are "shared") -# -# NB: this is exclusive with OPTION 2 below xcuserdata - -# OPTION 2: --------------------------------- -# get rid of ALL personal settings, but KEEP SOME OF THEM -# - NB: you must manually uncomment the bits you want to keep -# -# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X, -# or manually install git over the top of the OS X version -# NB: this is exclusive with OPTION 1 above -# -#xcuserdata/**/* - -# (requires option 2 above): Personal Schemes -# -#!xcuserdata/**/xcschemes/* - -#### -# XCode 4 workspaces - more detailed -# -# Workspaces are important! They are a core feature of Xcode - don't exclude them :) -# -# Workspace layout is quite spammy. For reference: -# -# /(root)/ -# /(project-name).xcodeproj/ -# project.pbxproj -# /project.xcworkspace/ -# contents.xcworkspacedata -# /xcuserdata/ -# /(your name)/xcuserdatad/ -# UserInterfaceState.xcuserstate -# /xcsshareddata/ -# /xcschemes/ -# (shared scheme name).xcscheme -# /xcuserdata/ -# /(your name)/xcuserdatad/ -# (private scheme).xcscheme -# xcschememanagement.plist -# -# - -#### -# Xcode 4 - Deprecated classes -# -# Allegedly, if you manually "deprecate" your classes, they get moved here. -# -# We're using source-control, so this is a "feature" that we do not want! - +*.xccheckout *.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace -#### -# OPTIONAL: Some well-known tools that people use side-by-side with Xcode / iOS development -# -# NB: I'd rather not include these here, but gitignore's design is weak and doesn't allow -# modular gitignore: you have to put EVERYTHING in one file. -# -# COCOAPODS: -# -# c.f. http://guides.cocoapods.org/using/using-cocoapods.html#what-is-a-podfilelock -# c.f. http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -#!Podfile.lock -# -# RUBY: -# -# c.f. http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/ +# Android/IJ # -#!Gemfile.lock -# -# IDEA: -# -#.idea -# -# TEXTMATE: -# -# -- UNVERIFIED: c.f. http://stackoverflow.com/a/50283/153422 -# -#tm_build_errors +.idea +.gradle +local.properties -#### -# UNKNOWN: recommended by others, but I can't discover what these files are +# node.js # -# Community suggestions (unverified, no evidence available - DISABLED by default) -# -# 1. Xcode 5 - VCS file -# -# "The data in this file not represent state of your project. -# If you'll leave this file in git - you will have merge conflicts during -# pull your cahnges to other's repo" -# -#*.xccheckout - -# React-Native specific stuff -node_modules \ No newline at end of file +node_modules/ +npm-debug.log diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Navigator.js b/Navigator.js new file mode 100644 index 0000000..3a28ec0 --- /dev/null +++ b/Navigator.js @@ -0,0 +1,96 @@ +/** + * Created by NFIB on 3/28/16. + */ +import React from 'react-native'; +import SearchPage from './SearchPage'; + +var styles = React.StyleSheet.create({ + container: { + flex: 1, + paddingTop:(React.Platform.OS == 'ios' ? 64 : 56), + }, + navBar: { + backgroundColor:'#CCC', + borderBottomColor:'#333', + borderBottomWidth:1 + }, + navTextBack: { + top:22, + fontSize:12, + fontWeight:'bold', + }, + navText: { + top:15, + fontSize:16, + fontWeight:'bold', + } +}); + +var _navigator; // we fill this up upon on first navigation. + +React.BackAndroid.addEventListener('hardwareBackPress', () => { + if (_navigator.getCurrentRoutes().length === 1 ) { + return false; + } + _navigator.pop(); + return true; +}); + +export default class CustomNavigator extends React.Component { + constructor(props) { + super(props); + this.initRoute = { title: 'Property Finder', component: SearchPage, }; + this.routeMapper = { + LeftButton: (route, navigator, index, navState) => { + if (index === 0) { + return null + } + const previousRoute = navState.routeStack[index - 1]; + return ( + navigator.pop()} style={styles.navBack}> + + {previousRoute.title} + + + ) + }, + RightButton: (route, navigator, index, navState) => { + if (route.rightElement) { + return route.rightElement + } + }, + Title: (route, navigator, index, navState) => { + return ( + {route.title} + ) + } + }; + + this.renderScene = (route, navigator) => { + _navigator = navigator; + if (route.component) { + return React.createElement(route.component, { navigator, ...route.passProps }); + } + }; + + this.configScene = () => { + return React.Navigator.SceneConfigs.FloatFromRight; + }; + } + + render() { + return ( + // React.Platform.OS == 'ios' ? + // () : + ( } + />)); + } +} \ No newline at end of file diff --git a/PropertyFinder.xcodeproj/xcshareddata/xcschemes/PropertyFinder.xcscheme b/PropertyFinder.xcodeproj/xcshareddata/xcschemes/PropertyFinder.xcscheme index ad17f20..7348141 100644 --- a/PropertyFinder.xcodeproj/xcshareddata/xcschemes/PropertyFinder.xcscheme +++ b/PropertyFinder.xcodeproj/xcshareddata/xcschemes/PropertyFinder.xcscheme @@ -23,10 +23,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,15 +38,18 @@ ReferencedContainer = "container:PropertyFinder.xcodeproj"> + + @@ -62,10 +65,10 @@ diff --git a/PropertyView.js b/PropertyView.js index 6746956..64cf3c4 100644 --- a/PropertyView.js +++ b/PropertyView.js @@ -11,7 +11,7 @@ var { var styles = StyleSheet.create({ container: { - marginTop: 65 + marginTop: 0 }, heading: { backgroundColor: '#F8F8F8', diff --git a/SearchPage.js b/SearchPage.js index da8e973..a59981e 100644 --- a/SearchPage.js +++ b/SearchPage.js @@ -1,14 +1,12 @@ 'use strict'; var React = require('react-native'); -var SearchResults = require('./SearchResults'); var { StyleSheet, Text, TextInput, View, TouchableHighlight, - ActivityIndicatorIOS, Image, Component } = React; @@ -66,12 +64,12 @@ var styles = StyleSheet.create({ function urlForQueryAndPage(key, value, pageNumber) { var data = { - country: 'uk', - pretty: '1', - encoding: 'json', - listing_type: 'buy', - action: 'search_listings', - page: pageNumber + country: 'uk', + pretty: '1', + encoding: 'json', + listing_type: 'buy', + action: 'search_listings', + page: pageNumber }; data[key] = value; @@ -80,7 +78,7 @@ function urlForQueryAndPage(key, value, pageNumber) { .join('&'); return 'http://api.nestoria.co.uk/api?' + querystring; -}; +} class SearchPage extends Component { @@ -97,21 +95,23 @@ class SearchPage extends Component { this.setState({ isLoading: false }); if (response.application_response_code.substr(0, 1) === '1') { this.props.navigator.push({ - title: 'Results', - component: SearchResults, - passProps: {listings: response.listings} + title: "Results", + component: require('./SearchResults'), + passProps: { listings: response.listings } }); } else { - this.setState({ message: 'Location not recognized please try again.'}); + this.setState({ message: 'Location not recognized please try again.' }); } } _executeQuery(query) { + console.log(query); this.setState({ isLoading: true, message: '' }); fetch(query) .then(response => response.json()) .then(json => this._handleResponse(json.response)) .catch(error => { + console.log(error); this.setState({ isLoading: false, message: 'Something bad happened ' + error @@ -144,11 +144,20 @@ class SearchPage extends Component { } render() { - var spinner = this.state.isLoading ? - ( ; + if (this.state.isLoading) { + if (React.Platform.OS == 'android') { + spinner = + } else { + spinner =