I am new to react-native. I used the react-native-navbar package to go back to the previous route navbar component for react-native
when I click on the navbar button it shows me an error "undefined is not an object(evaluating 'this.navigator.pop')
"
here is my snippet:
'use strict';
var React = require('react-native');
var {
StyleSheet,
Text,
View,
} = React;
var NavigationBar = require('react-native-navbar');
var Demo = React.createClass({
render: function()
{
var leftButtonConfig = {
title: 'Back',
handler: function onNext() {
this.navigator.pop();
}
};
var titleConfig = {
title: 'Hello world page!',
};
return(
<View style={{ flex: 1, }}>
<NavigationBar
title={titleConfig}
leftButton={leftButtonConfig} />
<View style={styles.container}>
<Text style={styles.header}>
Hello World
</Text>
</View>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex:1
},
header: {
fontSize: 20,
fontWeight: 'bold',
textAlign: 'center'
}
});
module.exports = Demo;