question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how do i trigger onNext clicking on custom touchableHighlight?

See original GitHub issue

Hi, here is my code:

_renderItem = (props) => {
	return (	
		<View style={styles.container}>
			<Image source={images.background} style={styles.backgroundImage} >
				<View style={styles.titleView}>
					<Image source={images.menu_logo}/>
					<Text style={styles.title}>{props.title}</Text>
				</View>

				<View style={styles.bodyView}>
					<Image source={props.image} resizeMode={'contain'} style={styles.image} />
					<Text style={styles.bodyText}>{props.text}</Text>				
				</View>
				<TouchableHighlight
					onPress={this.nextPressed.bind(this)}
					style={styles.okButton}
				>
					<Text style={styles.okButtonText}>OK</Text>
				</TouchableHighlight>
			</Image>
		</View>
	);
}

_nextPressed = () => {
    ..........?????
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
Jacsecommented, Nov 22, 2017

Normally you wouldn’t define your own button like that but instead use the renderNextButton and renderDoneButton-props. If you really want to do it that way, though I don’t recommend it, you can call goToSlide like this:

_nextPressed = () => {
  this.AppIntroSlider.goToSlide(index)
}

render() {
    return (
        <AppIntroSlider
            ref={ref => this.AppIntroSlider = ref}
        />
    );
}

Just note that onDone won’t be called when you specify your own button component.

2reactions
6axter82commented, Nov 22, 2017

after I implement <AppIntroSlider ref={ref => this.AppIntroSlider = ref} />

and do call this.AppIntroSlider.goToSlide(1);

I’m getting the following error: TypeError: undefined is not an object (evaluating ‘_this3.AppIntroSlider.goToSlide’)

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native TouchableHighlight activates wrong button ...
I have a React-Native view where I have to buttons side by side from each other. What is happening is when I click...
Read more >
TouchableHighlight - React Native
A wrapper for making views respond properly to touches. On press down, the opacity of the wrapped view is decreased, which allows the ......
Read more >
React Native - Quick Guide - Tutorialspoint
Step 5: Start react native ... Then, select Marshmallow and click on next. ... click on the play button under the Actions column...
Read more >
How to get a `onPress` callback with data in `TouchableOpacity`
How to avoid having to click TouchableOpacity twice to trigger onPress event? ... how to get sender in TouchableHighlight's onPress ...
Read more >
Awesome Router Component for React Native - Morioh
Now, when you click on "Next page please! ... The action gets triggered from your custom leftCorner or rightCorner components by calling this.props....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found