Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
undefined is not an object (evaluating 'navigation.reset')

I was thinking that my code was right, but it turned out that it gave me undefined, however when i click a button to go to 'List'; it works! it just i can't do it from TouchableOpacity onPress. Here's my code

import { StyleSheet, Text, View,TouchableOpacity } from 'react-native'
import {useSelector, useDispatch} from 'react-redux'
import {fetchDogsAsync} from '../store/action/index'

const DogsList = ({navigation}) => {
    const dispatch = useDispatch()
    const {dogs,isLoading} = useSelector(state => state)
    useEffect(() => {
        dispatch(fetchDogsAsync())
    }, [dispatch])
    console.log(dogs,isLoading);
    return (
        <View>
        {
                isLoading ? <Text>Loading...</Text> : (dogs?.message).map((dog,idx)=> {
                    return (
                        <TouchableOpacity key={dog} onPress={() => navigation.reset({
                            index: 0,
                            routes: [{name: 'List', params: {breed: dog}}],
                          })}><Text>{dog}</Text></TouchableOpacity>
                    )

                })
            }
    </View>
    )
}

export default DogsList

const styles = StyleSheet.create({})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<Navigator.Screen
     name="initial"
     component={ListScreen}
     options={{ title: "", headerShown: false }}
/>

only the components used in Screen tags will receive the navigation prop. Here ListScreen will receive the navigation prop. However the child components of ListScreen won't receive the navigation prop. But you can use useNavigation hook anywhere in the component tree which will give you the navigation object. You can read more about it in their official documentation.

https://reactnavigation.org/docs/use-navigation/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!