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.

Gradient Button doesn't show visual onPress like regular button

See original GitHub issue

Explain what you did (Required)

Created a gradient button. See example here:

import LinearGradient from 'react-native-web-linear-gradient'
import React from 'react'

<Button
  title={'TITLE'}
  onPress={onPress}
  ViewComponent={LinearGradient}
  linearGradientProps={{
    colors: ['#FFF', '#333'],
    start: { x: 0, y: 0 },
    end: { x: 0, y: 1 },
  }}
/>

Expected behavior (Required)

When pressing the button onPress is fired, but the user does not get any tactile feedback. See image. The Strava button works fine, but the Continue button does not give any feedback to the user whatsoever.

Describe the bug (Required)

It appears that once you add linearGradientProps the button does no longer provide feedback to the user.

To Reproduce (Required)

  1. yarn add react-native-web-linear-gradient
  2. copy above code in your project
  3. Click the button

Screenshots (Required)

image

Your Environment (Required):

software version
react-native-elements ^0.18.0
react-native 0.62.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

1reaction
supermar1010commented, Aug 13, 2020

I just tried that, doesn’t work as well, there’s no ripple effect on either android or iOS. Here’s a small demo project its basically a new reactnative project with RNE, RN-linear-gradient and rn-vector-icons. The touchable component is commented out right now, because I tested both. testgradientbuttonwithoutnodemodules.zip The new Pressable has in it’s default setting no ripple effect, but I have to pass a ripple config but in the button, I did not find a way to do that.

0reactions
flyingcirclecommented, Sep 2, 2020

@supermar1010 A good place to start would be to look at maybe the react-native issue history to see if they had to deal with a similar issue, or perhaps any issues related to Gradient itself that might be related to Android. I haven’t really used gradient in my own apps, so I’m not too familiar with what libraries are all exactly involved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LinearGradient and onPress for navigation - Stack Overflow
Well now realizing LinearGradient does not work with onPress...How should I go about navigating that linearGradient to another page? import ...
Read more >
Creating complex gradients with react-native-linear-gradient
Gradients can come in handy when you want to create multi-color backgrounds or custom buttons, adding visual interest to your UI and guiding ......
Read more >
Button · React Native Paper
A button is component that the user can press to trigger an action.
Read more >
How To Create Buttons in Unity | Beginner UI Tutorial - YouTube
How do you create and script a button ? Do you want to use the OnClick () Unity event? We'll go through that...
Read more >
The Button element - HTML: HyperText Markup Language
The <button> HTML element is an interactive element activated by a user with ... Buttons that only show an icon to represent do...
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