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.

TouchableNativeFeedback and ripple effect

See original GitHub issue

That might sounds like a dumb question but when using onPress={() => Actions.AnotherView()} this kind of disable the ripple effect from TouchableNativeFeedback. It’s still there if I keep pushing on the button but if I just tap, it won’t show and I feel like this is not the proper behaviour expected.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Almajucommented, Mar 13, 2018

Here is the fix I ended up doing (it works):

import React from 'react';
import { Platform, TouchableOpacity, TouchableNativeFeedback, View } from 'react-native';
import _ from 'lodash';

const Touchable = (props) => {
  const { ...other } = props;

  if (Platform.OS === 'ios' || Platform.Version < 21) {
    return (
      <TouchableOpacity {...other}>
        {other.children}
      </TouchableOpacity>
    );
  }

  if (_.isFunction(props.onPress)) {
    other.onPress = () => {
      setTimeout(() => { props.onPress(); }, 0);
    };
  }
  return (
    <TouchableNativeFeedback useForeground {...other}>
      <View pointerEvents="box-only">
        {other.children}
      </View>
    </TouchableNativeFeedback>
  );
};
0reactions
aksonovcommented, Aug 8, 2018

Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists

Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableNativeFeedback - React Native
Set to true to add the ripple effect to the foreground of the view, instead of the background. This is useful if one...
Read more >
how create <TouchableNativeFeedback /> with ( NATIVE ...
This is how you use methods of a component in react native. <TouchableNativeFeedback background={TouchableNativeFeedback.Ripple('#EEE')}> ...
Read more >
Android TouchableNativeFeedback ripple effect is ... - GitHub
Hello, TouchableNativeFeedback's ripple effect is misplaced when I press on a Text component inside. Update: It is not just Text component.
Read more >
TouchableRipple · React Native Paper
A wrapper for views that should respond to touches. Provides a material "ink ripple" interaction effect for supported platforms (>= Android Lollipop).
Read more >
React Native Tutorial 37 - TouchableNativeFeedback - YouTube
Welcome to this course on React Native, React Native is used hybrid mobile app development. Facebook's React Native user interface (UI) ...
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