0
반응 네이티브에서 모바일 앱을 만들고 있습니다! 최근에 모든 페이지마다 고유 한 헤더 구성 요소를 작성합니다. 여기 내 머리글 구성 요소의 코드입니다. 그 구성 요소 안에 두 개의 아이콘이 있습니다. 그러나 불행히도이 버튼들은 전혀 작동하지 않습니다 !!OnPress가 Touchable Opacity에서 작동하지 않습니다.
import React, {Component} from 'react';
import {
Text,
View,
Image,
Dimensions,
TouchableOpacity
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import Styles from './Styles';
export default class ChatHead extends Component {
constructor(props) {
super(props);
this.state = {
}
}
render(){
console.log(this.props.headerText, this.props);
if(this.props.headerText.length > 16){
name = this.props.headerText.substr(0, 16);
name += "...";
}
else name = this.props.headerText;
return(
<View style={Styles.viewStyle}>
<Text style={Styles.nameStyle}>{name}</Text>
<TouchableOpacity
style={Styles.audioCallButton}
onPress={() => console.log("Audio Button Pressed")}
>
<Icon name={'md-call'} size={25} color="white" align='right'/>
</TouchableOpacity>
<TouchableOpacity
style={Styles.videoCallButton}
onPress={() => console.log("Video Button Pressed")}
>
<Icon name={'ios-videocam'} size={28} color="white" align='right'/>
</TouchableOpacity>
</View>
);
}
};
onPress에 전혀 응답하지 않습니다!
스타일을 추가 할 수 있습니까? –
작동하지 않는 경우, 콘솔 출력 및/또는 터치 할 수있는 시각적 피드백을 제공하지 않는 것을 의미합니까? –