browniefed / examples

Egghead Screencast Code Examples
203 stars 102 forks source link

TouchableWithoutFeedback onPress is not firing call back to handler function. #23

Closed Headstock67 closed 4 years ago

Headstock67 commented 4 years ago

The TouchableWithoutFeedback events aren't registering and so the call back is not firing at all.

It seems like this may have been on issue since React Native v0.59. I'm using v0.61.5.

Any thoughts on how to fix this?

Cheers

Headstock67 commented 4 years ago

I solved the problem. Hope it helps others with the same issue.

In styles, I changed:

mainButton:{
    marginRight: 15, 
    zIndex: 1,
  }

Then I applied the this style to the Icon wrapped by the TouchableWithoutFeedback

 <TouchableWithoutFeedback style={styles.playerControls} onPress={this.handlePlayPauseButtonTouched}>
                <Icon style={styles. mainButton} name = {!this.state.paused ? "pause" : "play"} size={30} color="white"/>
            </TouchableWithoutFeedback>  

Then to solve the issue with the progress bar I added to styles:

 progressBar:{
    zIndex: 1,
  },

Then added this style to the view containing the progress bar.

<View style={styles.progressBar}>
              <VideoProgressBar 
                progress={this.state.videoProgress}
                color = "rgba(158,76,157,0.7)"
                unfilledColor = "rgba(255,255,255,0.5)"
                borderColor = "white"
                width={250}
                height={20}
              />
  </View>