小编Lot*_*sin的帖子

如何解决“只读<{}>”类型上不存在属性“导航”&

我有以下两段代码:

自定义头文件.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)

typescript react-native react-navigation

11
推荐指数
3
解决办法
1万
查看次数