Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Button): Improved UX of the LinearGradient button #2587

Merged
merged 3 commits into from Sep 20, 2020

Conversation

pranshuchittora
Copy link
Member

Closes #2493

If the button has linear-gradient prop then it will render TouchableOpacity in Android instead of TouchableNativeFeedback in order to provide the user with feedback.

Not using Pressable because of the following reasons:

  • Very New.
  • Needs @latest version of React Native, therefore won't be possible for all users to upgrade RN.
  • As mentioned above, that it's very new so API may change in future to make it more stable.

@@ -66,6 +66,16 @@ class Button extends Component {
...attributes
} = this.props;

// Refactor to Pressable
const TouchableComponentInternal = TouchableComponent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be changed to:

const TouchableComponentInternal = TouchableComponent || 
  Platform.select(...);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flyingcircle thanks for the feedback :)

Copy link
Collaborator

@flyingcircle flyingcircle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about this on the first review. But since this is changing the default value, then a note needs to be left on the Prop in the docs when the new default happens.

@pranshuchittora pranshuchittora merged commit c69d761 into react-native-elements:next Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gradient Button doesn't show visual onPress like regular button
2 participants