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

feat(SearchBarIos): new prop option omitCancel #3833

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

coderpr0grammer
Copy link

@coderpr0grammer coderpr0grammer commented Aug 29, 2023

Motivation

I'm always frustrated when the showCancel Prop (for platform="ios" only) on the SearchBar component from @rneui/base only defines whether or not to persist the cancel button beside the searchbar when unfocused. I wanted to see an option that let the developer omit the cancel button from the SearchBar, resulting in a cleaner UI when the button is not necessary. I created a new prop called omitCancel:boolean that defaults as false. When omitCancel={true}, it will completely omit the cancel button on SearchBars with platform="ios", so it will never appear regardless of it being focused or not.

Fixes: Creates new prop called omitCancel:boolean that defaults as false

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Checked with my own app

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation using yarn docs-build-api
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

In the below image, the cancel button is omitted while maintaining the rest of the native iOS styles.
image

@netlify
Copy link

netlify bot commented Aug 29, 2023

Deploy Preview for react-native-elements ready!

Name Link
🔨 Latest commit f8cb2ff
🔍 Latest deploy log https://app.netlify.com/sites/react-native-elements/deploys/64ed7afb11285500085d5ace
😎 Deploy Preview https://deploy-preview-3833--react-native-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@coderpr0grammer coderpr0grammer changed the title Make the showCancel prop actually hide or show the cancel button [New feature] New prop option "omitCancel" for SearchBar component where platform="ios" Aug 29, 2023
Copy link
Author

@coderpr0grammer coderpr0grammer left a comment

Choose a reason for hiding this comment

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

I'm not sure if we are supposed to also modify the documentation pages that are in the repo (which is what I did), I'm not sure if this may have caused it not to pass some checks by Netlify. Please let me know if there is anything wrong with the PR!

@arpitBhalla arpitBhalla changed the title [New feature] New prop option "omitCancel" for SearchBar component where platform="ios" feat(SearchBarIos): new prop option omitCancel Sep 9, 2023
@pranshuchittora
Copy link
Member

I feel adding more props would lead to more confusion. I would rather update the current showCancel prop to accept more values with current boolean value.

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.

None yet

2 participants