我有以下两段代码:
自定义头文件.tsx
import { View, StyleSheet, Button } from 'react-native';
import { NavigationScreenProps } from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
export const CustomHeader = ({ navigation }: NavigationScreenProps) => (
<View style={[styles.container]}>
<Icon
name="md-menu"
size={32}
color="black"
style={{ marginLeft: 10 }}
onPress={() => navigation.openDrawer()}
/>
</View>
);
const styles = StyleSheet.create({
container: {
borderBottomWidth: 2,
height: 70,
paddingTop: 20,
},
});
Run Code Online (Sandbox Code Playgroud)
DetailScreen.tsx
import React from 'react';
import { Text, View, Button, Alert } from 'react-native';
import { NavigationScreenProps } from "react-navigation"; …Run Code Online (Sandbox Code Playgroud)