bluejoyq

add toggle loading and edit alert message

...@@ -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": 19948, 5 + "packagerPid": 18100,
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": 12884 8 + "ngrokPid": 20760
9 } 9 }
......
1 import React from 'react'; 1 import React from 'react';
2 -import {View,ActivityIndicator,StyleSheet} from 'react-native' 2 +import {View,Text,StyleSheet} from 'react-native'
3 import AppContainer from './components/AppContainer/AppContainer'; 3 import AppContainer from './components/AppContainer/AppContainer';
4 - 4 +import Loading from './components/Loading/Loading';
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 - loading:true 10 + loading:false
11 }; 11 };
12 } 12 }
13 13
14 + toggleLoading=()=>{
15 + this.setState({loading:true});
16 + }
17 +
14 render(){ 18 render(){
15 return ( 19 return (
16 <> 20 <>
17 - {this.state.loading ? <View><ActivityIndicator size="large" color="#0000ff" /></View> : null} 21 + {this.state.loading ? <Loading/> : null}
18 - <AppContainer /> 22 + <AppContainer toggleLoading={this.toggleLoading}/>
19 </> 23 </>
20 ) 24 )
21 } 25 }
......
...@@ -6,10 +6,13 @@ import Home from '../Home/Home'; ...@@ -6,10 +6,13 @@ import Home from '../Home/Home';
6 import Rate from '../Rate/Rate'; 6 import Rate from '../Rate/Rate';
7 7
8 8
9 +const HomeScreen = (props) => (<Home toggleLoading={props.toggleLoading} />);
10 +const RateScreen = (props) => (<Rate toggleLoading={props.toggleLoading} />);
11 +
9 const AppTabNavigator = createMaterialTopTabNavigator ( 12 const AppTabNavigator = createMaterialTopTabNavigator (
10 { 13 {
11 - Home: Home, 14 + Home: HomeScreen,
12 - Rate: Rate 15 + Rate: RateScreen
13 }, 16 },
14 { 17 {
15 initialRouteName: 'Home', 18 initialRouteName: 'Home',
......
1 +import React from 'react';
2 +import {View,ActivityIndicator,StyleSheet,Dimensions, Modal} from 'react-native'
3 +
4 +const Loading = () => {
5 + return (
6 + <Modal transparent={true} animationType={'none'}>
7 + <View style={styles.container}><ActivityIndicator size={80} color="#ffffff" /></View>
8 + </Modal>
9 + )
10 +}
11 +
12 +const styles = StyleSheet.create({
13 + container: {
14 + zIndex: 2,
15 + height: Dimensions.get('window').height,
16 + width: '100%',
17 + display: 'flex',
18 + alignItems: 'center',
19 + justifyContent:'center',
20 + backgroundColor: 'rgba(15,15,15,0.7)',
21 + paddingBottom: 50,
22 + },
23 +});
24 +
25 +
26 +export default Loading;
...\ No newline at end of file ...\ No newline at end of file
1 import React from 'react'; 1 import React from 'react';
2 -import {View,ScrollView} from 'react-native'; 2 +import {View,ScrollView,Alert} from 'react-native';
3 import { Searchbar, Divider, Text } 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
...@@ -21,6 +21,16 @@ export default class SearchBar extends React.Component { ...@@ -21,6 +21,16 @@ export default class SearchBar extends React.Component {
21 this.setState({query:''}); 21 this.setState({query:''});
22 } 22 }
23 23
24 + voiceRecognition=()=>{
25 + Alert.alert(
26 + '음성 인식',
27 + '아직 구현 못함',
28 + [
29 + {text: '확인', onPress: () => {}},
30 + ],
31 + )
32 + }
33 +
24 render(){ 34 render(){
25 return( 35 return(
26 <> 36 <>
...@@ -30,7 +40,7 @@ export default class SearchBar extends React.Component { ...@@ -30,7 +40,7 @@ export default class SearchBar extends React.Component {
30 onChangeText={this.queryChange} 40 onChangeText={this.queryChange}
31 value={this.state.query} 41 value={this.state.query}
32 icon='microphone' 42 icon='microphone'
33 - onIconPress={()=>{alert("원래는 음성 인식 창!")}} 43 + onIconPress={this.voiceRecognition}
34 onSubmitEditing={this.submit} 44 onSubmitEditing={this.submit}
35 /> 45 />
36 </View> 46 </View>
......