我正在使用React Navigation
,我想在StackNavigator
中添加右鍵。加入右鍵後,我得到這樣的錯誤:對象作爲React子無效(反應導航)
Object is not valid as React child (found: object with keys {right}). If you meant to render a collection of children, use an array instead
如何解決這個錯誤?
下面是代碼:
import React, {Component} from 'react';
import {View, Text} from 'react-native';
class ReviewScreen extends Component {
static navigationOptions = {
title: 'Review Jobs',
header:() => {
return {
right: <Text>Go right</Text>
};
}
}
render(){
return (
<View>
<Text>ReviewScreen</Text>
</View>
);
}
}
export default ReviewScreen;