Commit 189ff1c4 authored by Solveig Hergot Langås's avatar Solveig Hergot Langås
Browse files

Merge branch 'FixSearch' into 'master'

#14 Keyboard dismissed after search pressed

See merge request !9
parents acfee6e7 c93e64ba
import React, { Component } from 'react'; import React, { Component } from 'react';
import { StyleSheet, Text, View, TextInput, Alert } from 'react-native'; import { Text, View, TextInput, Keyboard, TouchableWithoutFeedback } from 'react-native';
import { Icon } from 'react-native-elements'; import { Icon } from 'react-native-elements';
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { changeSearchword } from '../actions/SearchAction' import { changeSearchword } from '../actions/SearchAction'
...@@ -14,6 +14,7 @@ class SearchBox extends Component { ...@@ -14,6 +14,7 @@ class SearchBox extends Component {
} }
search = () => { search = () => {
Keyboard.dismiss()
if (this.state.searchWord.length === 0){ //search blank, show all places if (this.state.searchWord.length === 0){ //search blank, show all places
word = "all" word = "all"
} else { } else {
...@@ -48,7 +49,7 @@ class SearchBox extends Component { ...@@ -48,7 +49,7 @@ class SearchBox extends Component {
return( return(
<View style = {{flexDirection: "row", margin: 20}}> <View style = {{flexDirection: "row", margin: 20}}>
<TextInput style = {inputfield} autoCorrect = {false} onKeyPress = {(e) => this.handleSearchWord(e)} onSubmitEditing = {() => this.search()} /> <TextInput style = {inputfield} autoCorrect = {false} onKeyPress = {(e) => this.handleSearchWord(e)} onSubmitEditing = {() => this.search()} />
<Icon name = "search" onPress = {() => this.search()}/> <TouchableWithoutFeedback><Icon name = "search" onPress = {() => this.search()}/></TouchableWithoutFeedback>
<Text> {this.props.word} </Text> <Text> {this.props.word} </Text>
</View> </View>
); );
......
...@@ -25,7 +25,7 @@ class HomePage extends Component{ ...@@ -25,7 +25,7 @@ class HomePage extends Component{
<Text style={{fontSize: 28, textAlign: "center", padding: 8}}>Welcome to Dream Destinations</Text> <Text style={{fontSize: 28, textAlign: "center", padding: 8}}>Welcome to Dream Destinations</Text>
<Text style={{fontSize: 20, textAlign: "center", padding: 8}}>Click here to see a wordcloud showing the most popular locations</Text> <Text style={{fontSize: 20, textAlign: "center", padding: 8}}>Click here to see a wordcloud showing the most popular locations</Text>
<Text style={{fontSize: 16, textAlign: "center", padding: 8}}>Below you see the five most popular places</Text> <Text style={{fontSize: 16, textAlign: "center", padding: 8}}>Below you see the five most popular places</Text>
<Card/> <Card />
</View> </View>
/* /*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment