我的(简单)React Navigation StackNavigator中有一个自定义标题,如下所示:
module.exports.myFunction = function() {
const myFnEventEmitter = new(require('events').EventEmitter)();
var job = new CronJob('00 0-59 * * * *', function() {
var a = 5;
var b = 2;
myFnEventEmitter.emit('started', a + b)
}, function() {},
true
);
return myFnEventEmitter;
}
但这会返回const myFnEventEmitter = Tester.myFunction();
myFnEventEmitter.on('started', data => {
console.log("Done!");
console.log(data);
req.flash('success', "You have successfully started the software!");
res.render('dashboard');
})
如何将视图的唯一标题传递给自定义标题?
答案 0 :(得分:0)
根据文档,您需要navigationOptions
作为访问navigation
的函数:
navigationOptions: ({ navigation }) => ({
headerTitle: <GradientHeader title={navigation.state.params.title} />,
}),