Answer the question
In order to leave comments, you need to log in
How to fix props reading error in React Navigation?
Good afternoon!
Recently I came across this:
TypeError: Cannot read properties of undefined (reading 'jumpTo')
onPress
/home/head/Desktop/Serge Jr./ITProjects/wccnavigator/pages/stores.tsx:17
14 |
15 | Categories
16 | {
> 17 | return this.props.navigation.jumpTo('CurrentCategory',{cat: item.ID})}>{item.Category}
| ^ 18 | }} />
19 |
20 |
import React, {Component} from 'react';
import { FlatList, Text, View } from 'react-native';
import { BottomTabNavigator, NavigationScreenProp } from 'react-navigation';
import { StoresFeed } from '../handlers/stores/homepage/Feed';
import { StoreListService } from '../services/stores/homepage/List';
export interface StoresProps {
navigation: NavigationScreenProp<any,any>
}
export class Stores extends Component<StoresProps, object>{
render(){
return (
<React.Fragment>
<View style={screenStyle.list}>
<Text style={pageStyle.feedList}>Категории</Text>
<FlatList data={catList} renderItem={({item} : {item: any}) => {
return <Text style={pageStyle.LCList} onPress={() => this.props.navigation.jumpTo('CurrentCategory',{cat: item.ID})}>{item.Category}</Text>
}} />
</View>
</React.Fragment>
);
}
}
const pageStyle = new StoresFeed('ui-change',0).eventStart(),
screenStyle = new StoresFeed('ui-change',1).eventStart();
const catList = new StoreListService('categories', null).eventStart();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question