this.props.navigate inside carousel is not working
See original GitHub issueHello, I want to add navigation to my carousel but its not working I keep getting this error cannot read property navigation of undefined I used the example provided in this repo, and I added my StackNavigator like this inside index.js
import { StackNavigator } from 'react-navigation';
import Feed from './Feed';
class Feeds extends Component...
export default StackNavigator({
Feeds: {
screen: Feeds,
navigationOptions: {
header: null
},
},
Result: {
screen: Feed
}
})
This is my Feed screen that i want to navigate to it when the user choose an item inside the carousel
import React, { Component } from 'react';
import {
ToastAndroid,View,Text,
} from 'react-native';
export default class Feed extends Component {
constructor(props) {
super(props);
this.state = {
feed: props.navigation.state.params.feed,
report: null
};
}
static navigationOptions = ({ navigation }) => {
return {
title: `Feed / ${navigation.state.params.feed}`,
}
};
render() {
<View>
<Text>{this.navigation.state.params.feed}</Text>
</View>
}
}
and then inside SliderEntry.js I’ve just add a button to navigate into the Feed screen
<Button onPress={() => this.props.navigation.navigate("Result", {feed: title})} />
this.props
contain only
static propTypes = {
title: PropTypes.string.isRequired,
subtitle: PropTypes.string,
illustration: PropTypes.string,
even: PropTypes.bool,
};
no navigation inside, am I doing it wrong ?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
this.props.navigate inside carousel is not working #83 - GitHub
Hello, I want to add navigation to my carousel but its not working I keep getting this error cannot read property navigation of...
Read more >I am facing the issue while trying to navigate to pages using ...
I am facing the issue while trying to navigate to pages using carousel ; import { StyleSheet ; Text, FlatList ; SafeAreaView, ScrollView ......
Read more >React Bootstrap Carousel Component
Carousels don't automatically normalize slide dimensions. ... You can also control the Carousel state, via the activeIndex prop and onSelect handler.
Read more >React navigation withNavigation HOC not working in carousel ...
Coding example for the question React navigation withNavigation HOC not working in carousel-React Native.
Read more >react-material-ui-carousel - npm
A Generic, extendible Carousel UI component for React using Material UI. Latest version: 3.4.2, last published: 7 months ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@efstathiosntonas @Pradnyana28 Here’s my solution:
In your Carousel:
Adding the bind allows the _renderItem function to understand what “this” is in this.props.navigation.
In the renderItem function:
And inside SliderEntry.js:
do you have any solutions?