how to solve Property 'navigation' does not exist on type 'Readonly<{}> &
I could be wrong, but have you tried adding navigation
type to be expected
import React from 'react';
import { Text, View, Button, Alert } from 'react-native';
import { NavigationScreenProps } from "react-navigation";
import { CustomHeader } from '../components/Header';
interface Props {
navigation: any
}
export class ChangeAccountDetailScreen extends React.Component<Props> {
render() {
return (
<View style={{ flex: 1 }}>
<CustomHeader navigation={this.props.navigation} />
<Text style={{ fontSize: 20 }}>Profile Screen</Text>
</View>
);
}
}
Here is another solution where I add more details in the interface definition
import React from 'react';
import { Text, View, Button, Alert } from 'react-native';
import {
NavigationParams,
NavigationScreenProp,
NavigationState
} from 'react-navigation';
import { CustomHeader } from '../components/Header';
interface Props {
navigation: NavigationScreenProp<NavigationState, NavigationParams>
}
export class ChangeAccountDetailScreen extends React.Component<Props> {
render() {
return (
<View style={{ flex: 1 }}>
<CustomHeader navigation={this.props.navigation} />
<Text style={{ fontSize: 20 }}>Profile Screen</Text>
</View>
);
}
}