<최종 화면>
이미지를 클릭 할 때마다, 이미지가 바뀐다.
이미지가 많아지면 밑으로 배치되어 볼 수가 없다. 스크롤뷰 안에 넣어서 스크롤로 볼 수 있다.
백그라운드 배경을 주는 속성이 따로 없다. <ImageBackground>태그를 이용하자.
실행 전에 AVD를 실행해 놓자.
예제는 d:\HybridApp\ReactNative폴더에 만들 것이다 해당 경로까지 접속 후 init하자.
MainComponent.js를 만들자.
MainComponent.js가 화면에 보이기 위해 index.js에서 사용을 한다.
그리고 이미지르 사용할 것이기 때문에 images 폴더를 만들어서 거기에 이미지를 넣자.
이제 실행을 해보자.
<실행 화면> 원본 이미지가 커서 잘린다.
이미지의 너비, 높이 값을 주자.
너비와 높이 값을 주면 이미지의 비율이 깨질 수 있다. 현재 이미지는 티가 안나지만..
그럴때는 resizeMode 속성을 주자.
'contain'은 150 사이즈에 맞춰서 이미지가 비율에 맞게 들어간다.
'cover'는 150사이즈에 맞추지만 이미지가 잘릴 수 있을 것이다.
새로 이미지를 인터넷에서 가져와서 보여주겠다.
인터넷에 이미지를 골라, 마우스 우클릭을 하고 이미지 주소 복사를 하자.
이미지를 누르면 효과가 있게 해보자. (클릭 이벤트) 눌렀을때 검은색으로 표시됨
TouchableOpacity도 알아보자. 눌렀을때 약간 투명하게 된다. (클릭 효과)
이제 클릭해서 이미지를 바꿔보자.
누르 때마다 계속 이미지가 순차적으로 변경되게 해보자.
물론 인터넷 이미지도 사용 가능하다.
이미지를 하나 추가했으니 num의 최대 개수가 바뀌어서 2->3으로 변경하였다.
이미지가 추가될때마다 아래줄에 추가된다. 그러다가 화면에 안 보일 수 있다. 하지만 스크롤이 안된다.
이럴 경우 스크롤 뷰안에 이미지들을 넣자.
번외로 배경을 주고 거기에 글자를 놓고 싶다면?
배경을 주는 속성을 다로 없다. <ImageBackground>태그를 이용하자.
<복붙용 코드>
MainComponent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
import React, {Component} from 'react';
import {View, Text, Image, TouchableHighlight, TouchableOpacity, TouchableNativeFeedback, ScrollView, ImageBackground} from 'react-native';
export default class MainComponent extends Component{
constructor(){
super();
// 이 컴포넌트의 특별한 멤버변수 state
this.state= {
img: require('./images/ms19.png'),
// 이미지를 순차적으로 변경하기 위해
imgNum: 0, //배열의 인덱스 번호
imgArr: [
require('./images/ms17.png'),
require('./images/ms18.png'),
require('./images/ms19.png'),
// 네트워크도 당연히 사용 가능
]
};
}
render(){ //render 오버라이드
return(//리턴할게 한개가 아니기때문에 ()로 여러줄 쓸 수 있다.
// <View style={{flex:1, padding:16}}>
// {/* 이미지가 많을때 스크롤 필요 */}
// <ScrollView style={{height:300}}>
// {/* Image의 스타일이나 길게 쓸거 같으면 아래와 같은 줄바꿈을 해준다. */}
// <Image
// style={{width:150, height:150,resizeMode:'contain'}}
// source={require('./images/ms17.png')}>
// </Image>
// <Image
// style={{width:150, height:150,resizeMode:'contain'}}
// source={require('./images/ms17.png')}>
// </Image>
// </ScrollView>
// {/* 네트워크의 이미지 보여주기 : 사이즈지정이 없으면 보이지 않음*/}
// <Image
// style={{width:150, height:150}}
// source={{ uri:'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSEhUTExMWFRUXGBcXGBgVGRcYFhYVFRgXFxcVFxUYHSggGBolGxcVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGhAQGy0lHyYvLS0tLS8vLy0tLS0tLS0tLS0vLS01LS0tLS0tLS0tLy0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAMIBAwMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAADAAECBAUGBwj/xABAEAABAwIEAwUGBQIEBQUAAAABAAIRAyEEEjFB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IcpVd2OOs+c7X+OiD+PcdzHLfqOieiTHZcBcf1ev8pKj+K5gzJ0jZJPpsDc45TAmw/Lt/SFnNpNymw1bsP0hJJY4n8iDFwAxoiYtcaWRMONfA/VJJdH9BsWKzRe231KE5gtYJklERipan73Uq9pjmEySb/UT3CsH1/+Kar9fof2HokkpXJL5E4X9fkqtY39PqkkqjyJjj6fVE2Hh9QkkmxMk7R3moVXHvX3PzKSSEAKtp6/JFw7iZBv3vqkkm+AJVGiRYfZVfKIFtvqmSRHgCFZgBFhpy6oQNz4/ukktI8AM4WCjU1TpKkCGqD79UBx+qSSqIIk090/e6l9/EpJIBijXxHyKaobhJJCGJrjAuf76o7NT5pJKZESE/U+J+aSSSQj/9k='}}>
// </Image>
// {/* 이미지 클릭 반응하기 : Button이 아니면 onPress속성은 사용할 수 없음 */}
// {/* 터치를 인지하도록 만들어진 컴포넌트들 TouchableXXX 를 사용 */}
// <TouchableHighlight onPress={this.clickImage}>
// <Image
// style={{width:150, height:150,resizeMode:'contain'}}
// source={require('./images/ms18.png')}>
// </Image>
// </TouchableHighlight>
// {/* Button이 아닌 컴포넌트들을 클릭하고 싶을 때 모두 사용 가능 */}
// <TouchableNativeFeedback onPress={this.changeImage}
// background={TouchableNativeFeedback.SelectableBackground()}>
// <Image
// style={{width:150, height:150,resizeMode:'contain'}}
// source={this.state.imgArr[this.state.imgNum]}>
// </Image>
// </TouchableNativeFeedback>
// </View>
<View>
<Text style={{color:'black',fontSize:32, fontWeight:'bolde' ,margin:16}}>Image</Text>
<Text style={{color:'orange',fontSize:32, margin:16}}>This is background image test</Text>
</ImageBackground>
</View>
);
}//render method..
changeImage= ()=>{
// 이미지의 경로를 변경이 아니라 require()함수를 통으로 변경
let num= this.state.imgNum;
num++;
if(num>3) num=0;
this.setState({imgNum: num});
}
clickImage=()=>{
alert('click image!!');
}
}//MainComponent class..
|
'안드로이드 웹앱 콘테츠 개발자 양성(국비지원) > HybridApp' 카테고리의 다른 글
HybridApp-React Native 2세대 (Layout) (0) | 2020.01.21 |
---|---|
HybridApp-React Native 2세대 (CustomComponent) (0) | 2020.01.21 |
HybridApp-React Native 2세대 (Layout) (0) | 2020.01.20 |
HybridApp-React Native 2세대 (TextInput 입력칸에 글자 입력후 버튼으로 화면 갱신) (0) | 2020.01.20 |
HybridApp-React Native 2세대 (Button눌렀을때 텍스트,이미지 변경) (0) | 2020.01.20 |
댓글