Skip to content

Commit

Permalink
fix dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Kien Tran committed Oct 9, 2018
1 parent 6a356f5 commit a81fca3
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 37 deletions.
9 changes: 9 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}
84 changes: 49 additions & 35 deletions weather/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,72 @@
* @flow
*/

import React from 'react';
import { Component } from 'react'
import { Platform, StyleSheet, Text, View, Image, SafeAreaView, Alert, FlatList } from 'react-native';
import { Card, ListItem, Button, Icon, SearchBar } from 'react-native-elements'
import { Location } from 'weather-domain'
import { DefaultLocationRepository } from 'weather-repositories'
import * as Rx from 'rxjs'
import { map, throttle, throttleTime } from 'rxjs/operators'
import {SearchLocationList, SearchLocationListDataItem} from 'weather-ui';

type Props = {};
type State = {
locations: SearchLocationListDataItem[]
};
export default class App extends Component<Props,State> {
import React from "react";
import { Component } from "react";
import { Alert, FlatList, Image, Platform, SafeAreaView, StyleSheet, Text, View } from "react-native";
import { Button, Card, Icon, ListItem, SearchBar } from "react-native-elements";
import * as Rx from "rxjs";
import { map, throttle, throttleTime } from "rxjs/operators";
import { Location } from "weather-domain";
import { DefaultLocationRepository } from "weather-repositories";
import {SearchLocationList, SearchLocationListDataItem} from "weather-ui";

class Props {}

// tslint:disable-next-line:max-classes-per-file
interface IState {
locations: SearchLocationListDataItem[];
}

// tslint:disable-next-line:max-classes-per-file
export default class App extends Component<Props, IState> {

public state = {
locations: [],
};
constructor(props: Props) {
super(props);
}

state = {
locations: []
}
onChangeText = (text) => {

var repository = new DefaultLocationRepository()
public onChangeText = (text) => {
const repository = new DefaultLocationRepository();
repository.searchCity(text)
.pipe(throttleTime(1000))
.subscribe(
(results:[Location]) => {
console.log(results)
const dataItems = results.map((location:Location) => {
return new SearchLocationListDataItem(location.name)
})
(results: [Location]) => {
const dataItems = results.map((location: Location) => {
return new SearchLocationListDataItem(location.name);
});
this.setState({
locations: dataItems
})
}
)
locations: dataItems,
});
},
);
}

public onClear = () => {

// alert("onClear");
this.onChangeText("");
}
public onCancel = () => {

// this.onChangeText("");
}

render() {
public render() {
return (
<SafeAreaView>
<SearchBar
platform="ios"
onChangeText={this.onChangeText}
placeholder='Enter location'
placeholder="Enter location"
onClear={this.onClear}
onCancel={this.onCancel}
></SearchBar>
<SearchLocationList
items={this.state.locations}
/>
</SafeAreaView>
)
);
}
}
}
3 changes: 2 additions & 1 deletion weather/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"dependencies": {
"react": "^16.4.15",
"react-native": "0.57.1",
"react-native-elements": "1.0.0-beta5",
"react-native-elements": "^1.0.0-beta5",
"react-native-vector-icons": "6.0.1",
"rxjs": "^6.3.3",
"tslint": "^5.11.0",
"weather-domain": "file:../domain",
"weather-repositories": "file:../repositories",
"weather-ui": "^0.0.9"
Expand Down
7 changes: 6 additions & 1 deletion weather/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
"rulesDirectory": [],
"linterOptions": {
"exclude": [
"node_modules"
]
}
}

0 comments on commit a81fca3

Please sign in to comment.