我对带有反应导航的功能组件有疑问。
当我按下标题中的按钮时,无法在另一个函数中调用内部函数。
我的代码:
export default Consulta = ({ navigation }) => {
const print = () => {
[...]
}
}
Consulta.navigationOptions = props => ({
title: props.navigation.getParam('title'),
headerStyle: {
backgroundColor: '#4f5f98',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
headerRight: (
<Button
onPress={ ()=> Consulta.print() }
title="Info"
color="#12h"
/>
),
})
如何从Button headerRight中的onPress事件在Consulta中调用'PRINT'函数?
很抱歉我的英语水平,我是RN的新手。
谢谢