bluejoyq

working for loading animation while searching

...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
2 "devToolsPort": 19002, 2 "devToolsPort": 19002,
3 "expoServerPort": 19000, 3 "expoServerPort": 19000,
4 "packagerPort": 19001, 4 "packagerPort": 19001,
5 - "packagerPid": 4420, 5 + "packagerPid": 19948,
6 "expoServerNgrokUrl": "https://ep-ukj.anonymous.searchguide.exp.direct", 6 "expoServerNgrokUrl": "https://ep-ukj.anonymous.searchguide.exp.direct",
7 "packagerNgrokUrl": "https://packager.ep-ukj.anonymous.searchguide.exp.direct", 7 "packagerNgrokUrl": "https://packager.ep-ukj.anonymous.searchguide.exp.direct",
8 - "ngrokPid": 26692 8 + "ngrokPid": 12884
9 } 9 }
......
1 import React from 'react'; 1 import React from 'react';
2 +import {View,ActivityIndicator,StyleSheet} from 'react-native'
2 import AppContainer from './components/AppContainer/AppContainer'; 3 import AppContainer from './components/AppContainer/AppContainer';
3 -import SafeAreaView from 'react-native-safe-area-view'; 4 +
4 -import SearchBar from './components/SearchBar/SearchBar';
5 5
6 export default class App extends React.Component { 6 export default class App extends React.Component {
7 constructor(props){ 7 constructor(props){
8 super(props); 8 super(props);
9 this.state = { 9 this.state = {
10 - 10 + loading:true
11 }; 11 };
12 } 12 }
13 +
13 render(){ 14 render(){
14 - return ( 15 + return (
15 - <> 16 + <>
16 - <SearchBar /> 17 + {this.state.loading ? <View><ActivityIndicator size="large" color="#0000ff" /></View> : null}
17 - <SafeAreaView style={{flex: 1, backgroundColor:'#eee'}}> 18 + <AppContainer />
18 - <AppContainer /> 19 + </>
19 - </SafeAreaView> 20 + )
20 - </>
21 - )
22 } 21 }
23 -}
...\ No newline at end of file ...\ No newline at end of file
22 +}
23 +
24 +const styles = StyleSheet.create({
25 + container: {
26 + flex: 1,
27 + justifyContent: 'center',
28 + },
29 +});
...\ No newline at end of file ...\ No newline at end of file
......
1 module.exports = function(api) { 1 module.exports = function(api) {
2 api.cache(true); 2 api.cache(true);
3 return { 3 return {
4 - presets: ['babel-preset-expo'], 4 + presets: ['babel-preset-expo','module:metro-react-native-babel-preset','module:react-native-dotenv'],
5 env: { 5 env: {
6 production: { 6 production: {
7 plugins: ['react-native-paper/babel'], 7 plugins: ['react-native-paper/babel'],
......
1 import React from 'react'; 1 import React from 'react';
2 +import { DARK_MAIN,LIGHT_MAIN, WHITE_MAIN} from 'react-native-dotenv';
2 import {createAppContainer} from 'react-navigation'; 3 import {createAppContainer} from 'react-navigation';
3 import {createMaterialTopTabNavigator} from 'react-navigation-tabs'; 4 import {createMaterialTopTabNavigator} from 'react-navigation-tabs';
4 import Home from '../Home/Home'; 5 import Home from '../Home/Home';
5 import Rate from '../Rate/Rate'; 6 import Rate from '../Rate/Rate';
6 7
8 +
7 const AppTabNavigator = createMaterialTopTabNavigator ( 9 const AppTabNavigator = createMaterialTopTabNavigator (
8 { 10 {
9 Home: Home, 11 Home: Home,
...@@ -13,13 +15,13 @@ const AppTabNavigator = createMaterialTopTabNavigator ( ...@@ -13,13 +15,13 @@ const AppTabNavigator = createMaterialTopTabNavigator (
13 initialRouteName: 'Home', 15 initialRouteName: 'Home',
14 tabBarPosition: 'bottom', 16 tabBarPosition: 'bottom',
15 tabBarOptions:{ 17 tabBarOptions:{
16 - activeTintColor: '#f0edf6', 18 + activeTintColor: WHITE_MAIN,
17 - inactiveTintColor: '#226557', 19 + inactiveTintColor: DARK_MAIN,
18 indicatorStyle: { 20 indicatorStyle: {
19 - backgroundColor: '#f0edf6', 21 + backgroundColor: WHITE_MAIN,
20 }, 22 },
21 style:{ 23 style:{
22 - backgroundColor:'#3BAD87', 24 + backgroundColor:LIGHT_MAIN,
23 allowFontScaling : 'true' 25 allowFontScaling : 'true'
24 }, 26 },
25 showIcon: true, 27 showIcon: true,
......
1 import React from 'react'; 1 import React from 'react';
2 -import { View, Text} from 'react-native'; 2 +import { View} from 'react-native';
3 import Icon from 'react-native-vector-icons/FontAwesome'; 3 import Icon from 'react-native-vector-icons/FontAwesome';
4 +import SearchBar from '../SearchBar/SearchBar';
5 +import SearchCard from '../SearchCard/SearchCard';
6 +
4 7
5 class Home extends React.Component { 8 class Home extends React.Component {
6 constructor(props) { 9 constructor(props) {
7 super(props); 10 super(props);
8 this.state = { 11 this.state = {
9 -
10 } 12 }
11 } 13 }
12 static navigationOptions={ 14 static navigationOptions={
...@@ -16,9 +18,11 @@ class Home extends React.Component { ...@@ -16,9 +18,11 @@ class Home extends React.Component {
16 18
17 render() { 19 render() {
18 return( 20 return(
19 - <View> 21 + <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0}}>
20 - <Text>검색</Text> 22 + <SearchBar />
23 + <SearchCard title={'네이버- 지식인...인간사냥꾼 니달리를ㄴㄴㅁ'} content={'문도 가고 싶은 데로 간다!'} url={'https://www.naver.com'}/>
21 </View> 24 </View>
25 +
22 ) 26 )
23 } 27 }
24 28
......
...@@ -17,7 +17,7 @@ class Rate extends React.Component { ...@@ -17,7 +17,7 @@ class Rate extends React.Component {
17 17
18 render() { 18 render() {
19 return( 19 return(
20 - <View > 20 + <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0}}>
21 <Text >평가</Text> 21 <Text >평가</Text>
22 </View> 22 </View>
23 ) 23 )
......
1 import React from 'react'; 1 import React from 'react';
2 import {View,ScrollView} from 'react-native'; 2 import {View,ScrollView} from 'react-native';
3 -import { Searchbar } from 'react-native-paper'; 3 +import { Searchbar, Divider, Text } from 'react-native-paper';
4 import Icon from 'react-native-vector-icons/FontAwesome'; 4 import Icon from 'react-native-vector-icons/FontAwesome';
5 5
6 +
6 export default class SearchBar extends React.Component { 7 export default class SearchBar extends React.Component {
7 - state = { 8 + constructor(props){
8 - firstQuery: '', 9 + super(props);
9 - }; 10 + this.state = {
11 + query: '',
12 + };
13 + }
14 +
15 + queryChange=(query)=>{
16 + this.setState({ query: query });
17 + }
18 +
19 + submit=()=>{
20 + alert(this.state.query);
21 + this.setState({query:''});
22 + }
10 23
11 render(){ 24 render(){
12 return( 25 return(
13 <> 26 <>
14 - <View style={{margin:0,padding:0}}> 27 + <View>
15 <Searchbar 28 <Searchbar
16 placeholder="검색할 질문을 입력하세요." 29 placeholder="검색할 질문을 입력하세요."
17 - onChangeText={query => { this.setState({ firstQuery: query }); }} 30 + onChangeText={this.queryChange}
18 - value={this.state.firstQuery} 31 + value={this.state.query}
32 + icon='microphone'
33 + onIconPress={()=>{alert("원래는 음성 인식 창!")}}
34 + onSubmitEditing={this.submit}
19 /> 35 />
20 </View> 36 </View>
21 </> 37 </>
......
1 +import React from 'react';
2 +import { DARK_MAIN,LIGHT_MAIN, WHITE_MAIN} from 'react-native-dotenv';
3 +import { Avatar, Button, Card, Title, Paragraph } from 'react-native-paper';
4 +import {Linking } from 'react-native';
5 +
6 +const MyComponent = (props) => (
7 + <Card style={{margin:10}}>
8 + <Card.Title title={props.title}
9 + left={ (props) => (
10 + <Avatar.Icon {...props} icon="folder" color={WHITE_MAIN}style={{backgroundColor:LIGHT_MAIN}} /> ) }
11 + />
12 + <Card.Content>
13 + <Paragraph>{props.content}</Paragraph>
14 + </Card.Content>
15 + <Card.Actions style={{flexDirection:'row-reverse'}}>
16 + <Button mode='contained' color= {LIGHT_MAIN} labelStyle={{color:WHITE_MAIN}} onPress={()=>{Linking.openURL(props.url)}}>
17 + 자세히보기
18 + </Button>
19 + </Card.Actions>
20 + </Card>
21 +);
22 +
23 +export default MyComponent;
...\ No newline at end of file ...\ No newline at end of file
...@@ -1603,6 +1603,15 @@ ...@@ -1603,6 +1603,15 @@
1603 "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", 1603 "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
1604 "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" 1604 "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
1605 }, 1605 },
1606 + "babel-plugin-dotenv": {
1607 + "version": "0.1.1",
1608 + "resolved": "https://registry.npmjs.org/babel-plugin-dotenv/-/babel-plugin-dotenv-0.1.1.tgz",
1609 + "integrity": "sha1-nI+upnp8A0/n6UCZGHqy51c0ALw=",
1610 + "dev": true,
1611 + "requires": {
1612 + "dotenv": "^2.0.0"
1613 + }
1614 + },
1606 "babel-plugin-dynamic-import-node": { 1615 "babel-plugin-dynamic-import-node": {
1607 "version": "2.3.0", 1616 "version": "2.3.0",
1608 "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", 1617 "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz",
...@@ -2355,6 +2364,12 @@ ...@@ -2355,6 +2364,12 @@
2355 "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", 2364 "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz",
2356 "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" 2365 "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg="
2357 }, 2366 },
2367 + "dotenv": {
2368 + "version": "2.0.0",
2369 + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-2.0.0.tgz",
2370 + "integrity": "sha1-vXWcNXqqcDZeAclrewvsCKbg2Uk=",
2371 + "dev": true
2372 + },
2358 "ee-first": { 2373 "ee-first": {
2359 "version": "1.1.1", 2374 "version": "1.1.1",
2360 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 2375 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
...@@ -5020,6 +5035,15 @@ ...@@ -5020,6 +5035,15 @@
5020 "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", 5035 "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
5021 "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" 5036 "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ="
5022 }, 5037 },
5038 + "path": {
5039 + "version": "0.12.7",
5040 + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
5041 + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
5042 + "requires": {
5043 + "process": "^0.11.1",
5044 + "util": "^0.10.3"
5045 + }
5046 + },
5023 "path-browserify": { 5047 "path-browserify": {
5024 "version": "1.0.0", 5048 "version": "1.0.0",
5025 "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.0.tgz", 5049 "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.0.tgz",
...@@ -5494,6 +5518,15 @@ ...@@ -5494,6 +5518,15 @@
5494 "resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-3.0.1.tgz", 5518 "resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-3.0.1.tgz",
5495 "integrity": "sha512-vbcYxPZlpF5f39GAEUF8kuGQqCNeD3E6zEdvtOq8oCGZunHXlWlKgAS6dgBKCvsHvXgHuMtpvs39VgOp8DaKig==" 5519 "integrity": "sha512-vbcYxPZlpF5f39GAEUF8kuGQqCNeD3E6zEdvtOq8oCGZunHXlWlKgAS6dgBKCvsHvXgHuMtpvs39VgOp8DaKig=="
5496 }, 5520 },
5521 + "react-native-dotenv": {
5522 + "version": "0.2.0",
5523 + "resolved": "https://registry.npmjs.org/react-native-dotenv/-/react-native-dotenv-0.2.0.tgz",
5524 + "integrity": "sha1-MRVRy2o1o9z+3mSL3tVcDj7OV50=",
5525 + "dev": true,
5526 + "requires": {
5527 + "babel-plugin-dotenv": "0.1.1"
5528 + }
5529 + },
5497 "react-native-gesture-handler": { 5530 "react-native-gesture-handler": {
5498 "version": "1.3.0", 5531 "version": "1.3.0",
5499 "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.3.0.tgz", 5532 "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.3.0.tgz",
...@@ -6970,6 +7003,21 @@ ...@@ -6970,6 +7003,21 @@
6970 "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", 7003 "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
6971 "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" 7004 "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ=="
6972 }, 7005 },
7006 + "util": {
7007 + "version": "0.10.4",
7008 + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
7009 + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
7010 + "requires": {
7011 + "inherits": "2.0.3"
7012 + },
7013 + "dependencies": {
7014 + "inherits": {
7015 + "version": "2.0.3",
7016 + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
7017 + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
7018 + }
7019 + }
7020 + },
6973 "util-deprecate": { 7021 "util-deprecate": {
6974 "version": "1.0.2", 7022 "version": "1.0.2",
6975 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 7023 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
12 "expo": "^35.0.0", 12 "expo": "^35.0.0",
13 "expo-permissions": "~7.0.0", 13 "expo-permissions": "~7.0.0",
14 "expo-speech": "~7.0.0", 14 "expo-speech": "~7.0.0",
15 + "path": "^0.12.7",
15 "react": "16.8.3", 16 "react": "16.8.3",
16 "react-dom": "16.8.3", 17 "react-dom": "16.8.3",
17 "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz", 18 "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
...@@ -26,7 +27,8 @@ ...@@ -26,7 +27,8 @@
26 "react-navigation-tabs": "^2.5.6" 27 "react-navigation-tabs": "^2.5.6"
27 }, 28 },
28 "devDependencies": { 29 "devDependencies": {
29 - "babel-preset-expo": "^7.1.0" 30 + "babel-preset-expo": "^7.1.0",
31 + "react-native-dotenv": "^0.2.0"
30 }, 32 },
31 "private": true 33 "private": true
32 } 34 }
......