I'm new to react-native, I'm just trying to play around with actions and states. I don't get where's the problem in this component.
I get the error 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);