有人可以解释一下为什么我的函数总是返回“ undefined”。 我知道这是函数的默认响应,但我指定返回true / false,但没有。
export default function App({ navigation }) {
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
const defaultOptions = {
headerStyle: {
backgroundColor: Colors.primary
},
headerTitleStyle: {
fontFamily: "raleway-bold"
},
headerBackTitleStyle: {
fontFamily: "raleway-regular"
},
headerTintColor: "white",
headerRight: () => (
<TouchableOpacity onPress={() => navigation.openDrawer()}>
<Ionicons
name={Platform.OS === "android" ? "md-menu" : "ios-menu"}
size={32}
color="white"
style={styles.menu}
/>
</TouchableOpacity>
)
};
const createHomeStack = () => (
<Stack.Navigator>
<Stack.Screen
name="Dashboard"
component={DashboardScreen}
options={defaultOptions}
/>
<Stack.Screen
name="AddExperience"
component={AddExperienceScreen}
options={defaultOptions}
/>
<Stack.Screen
name="AddEducation"
component={AddEducationScreen}
options={defaultOptions}
/>
</Stack.Navigator>
);
return (
<NavigationContainer>
<Drawer.Navigator>
<Drawer.Screen name="Home" children={createHomeStack} />
<Drawer.Screen name="Dashboard" component={DashboardScreen} />
<Drawer.Screen name="Profiles" component={ProfilesScreen} />
</Drawer.Navigator>
</NavigationContainer>
);
}
我一直试图以多种不同的方式返回结果,但是它总是返回未定义的结果...