我是新來的反應原生,我只是想玩弄動作和狀態。 我不明白這個組件中的問題在哪裏。TouchableHighlight按錯誤
我得到undefined is not an object (evaluating 'this.wrappedInstance.setNativeProps')
import React, { Component } from 'react';
import { Container, Text } from 'native-base';
import {
AppRegistry,
View,
TouchableHighlight
} from 'react-native';
export default class Page2 extends Component {
constructor(){
super();
this.state = {
mess: "Page 2 message"
}
}
onPress(){
this.state.mess = this.state.mess+" wow a click!"
}
render() {
return (
<View>
<TouchableHighlight
onPress={this.onPress}
underlayColor="blue"
>
<Text> {this.state.mess}</Text>
</TouchableHighlight>
</View>
);
}
}
AppRegistry.registerComponent('Page2',() => Page2);