bluejoyq

add promptSearch.js

{
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": "https://s4-47j.anonymous.searchguide.exp.direct",
"packagerNgrokUrl": "https://packager.s4-47j.anonymous.searchguide.exp.direct",
"ngrokPid": 31700
"packagerPort": 19001,
"packagerPid": 23132,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
}
......
import React from 'react';
import { View, ScrollView} from 'react-native';
import { View, ScrollView,Text } from 'react-native';
import {connect} from 'react-redux'
import Icon from 'react-native-vector-icons/FontAwesome';
import SearchBar from '../SearchBar/SearchBar';
import SearchCard from '../SearchCard/SearchCard';
import PromptSearch from '../PromptSearch/PromptSearch'
const Home = ({searchResults}) => {
......@@ -11,9 +12,10 @@ const Home = ({searchResults}) => {
<View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0}}>
<SearchBar />
<ScrollView>
{ searchResults && searchResults.map((searchResult, index) => (
<SearchCard key={index} title={searchResult.title} content={searchResult.passage} url={searchResult.url}/>
))}
{ searchResults.length ? ( searchResults.map((searchResult, index) => (
<SearchCard key={index} title={searchResult.title} content={searchResult.passage} url={searchResult.url}/>)))
: <PromptSearch />
}
</ScrollView>
</View>
......
import React from 'react';
import { View,Text, StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
export default PromptSearch = () => {
return(
<View style={styles.container} >
<Icon name='search' style={styles.icon} size={50} />
<Text style={styles.text}>당신이 궁금해하는</Text>
<Text style={styles.text}>질문을 검색하세요</Text>
<Text style={styles.subtext}>길잡이가 당신의</Text>
<Text style={styles.subtext}>질문을 이해할거에요</Text>
</View>
)
}
const styles = StyleSheet.create({
container: {
height: 270,
width: '100%',
display: 'flex',
alignItems: 'center',
justifyContent:'center',
},
text:{
marginBottom: 10,
fontSize: 30,
fontWeight: 'bold',
color:'#999999',
},
icon: {
marginBottom: 20,
color: '#999999'
},
subtext:{
marginBottom: 10,
fontSize: 20,
fontWeight: 'bold',
color:'#999999',
}
});
\ No newline at end of file
......@@ -5,7 +5,7 @@ import Icon from 'react-native-vector-icons/FontAwesome';
const Rate = () => {
return(
<View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0}}>
<Text >평가</Text>
<Text ></Text>
</View>
)
}
......
......@@ -16,8 +16,8 @@ export const submit = (text) => async (dispatch) => {
try{
/*const response = await sendSearch(text);*/
const response = await readTest(); // 테스트용입니당~
dispatch( { type:SUCCESS, result:response })
//setTimeout(()=>,1000); // 셋타임아웃도 테스트용
//dispatch( { type:SUCCESS, result:response }
setTimeout(()=>dispatch( { type:SUCCESS, result:response }),500); // 셋타임아웃도 테스트용
}
catch(err){
dispatch({ type:FAILURE, result:response })
......