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

Platform specific SearchBar #837

Merged
merged 19 commits into from
Jan 28, 2018
Merged

Platform specific SearchBar #837

merged 19 commits into from
Jan 28, 2018

Conversation

xavier-villelegier
Copy link
Collaborator

@xavier-villelegier xavier-villelegier commented Jan 23, 2018

Information

This adds a new platform props, to choose between:
• Default react-native-elements SearchBar
• iOS SearchBar
• Android SearchBar

BREAKING CHANGES

loadingProps

loadingIcon was an object to customize the style of the ActivityIndicator shown when showLoading was true. It was replaced by loadingProps.

Before

<SearchBar
  loadingIcon={{
    style: { padding: 10 },
  }}
/>

After

<SearchBar
  loadingProps={{
    color: 'red', // This was not possible before
    style: { padding: 10 },
  }}
/>

showLoading

showLoadingIcon was renamed to showLoading

Before

<SearchBar showLoadingIcon />

After

<SearchBar showLoading />

SearchBar API Updates

Props type default description
platform string "default" One of "default", "ios", "android"
cancelButtonTitle string "Cancel" iOS only Title of the cancel button on the right side
showLoading boolean false Shows an ActivityIndicator when true
loadingProps object {} Props passed to ActivityIndicator
onCancel function null Callback fired when pressing the cancel button (iOS) or the back icon (Android)

Update applied to v1 Input

Props type default description
leftIcon React Native element null Component displayed on the left side of the TextInput
leftIconContainerStyle style null Style applied to the container of the leftIcon
rightIcon React Native element null Component displayed on the right side of the TextInput
rightIconContainerStyle style null Style applied to the container of the rightIcon

Preview

Almost pixel perfect iOS 11 design (red lines are here for pixel comparison)
pixelperfectsearchbar

Example 1

<SearchBar
  showLoading
  placeholder='Search'
/>
iOS Android
oct -15-2017 15-22-05 oct -15-2017 18-16-03

TODO

  • Move the tests to the new searchbar/ directory
  • Remove the old search/ directory
  • Add more tests
  • Add more and more and more tests ✅
  • Add a fallback if platform is not one of "default", "ios", "android"

@xavier-villelegier xavier-villelegier changed the title Searchbar v1 Platform specific SearchBar Jan 23, 2018
@codecov
Copy link

codecov bot commented Jan 23, 2018

Codecov Report

Merging #837 into next will increase coverage by 1.34%.
The diff coverage is 56.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #837      +/-   ##
==========================================
+ Coverage   53.02%   54.37%   +1.34%     
==========================================
  Files          29       32       +3     
  Lines         513      572      +59     
  Branches      109      120      +11     
==========================================
+ Hits          272      311      +39     
- Misses        186      199      +13     
- Partials       55       62       +7
Impacted Files Coverage Δ
src/input/Input.js 18.75% <ø> (+18.75%) ⬆️
src/searchbar/SearchBar-default.js 77.27% <100%> (ø)
src/searchbar/SearchBar.js 100% <100%> (ø)
src/searchbar/SearchBar-ios.js 51.72% <51.72%> (ø)
src/searchbar/SearchBar-android.js 51.85% <51.85%> (ø)
src/buttons/ButtonGroup.js 64.28% <0%> (-24.61%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 961dbf3...528ae49. Read the comment docs.

@xavier-villelegier
Copy link
Collaborator Author

Tests are passing

giphy

# Conflicts:
#	src/searchbar/__tests__/__snapshots__/SearchBar-default.js.snap
@iRoachie
Copy link
Collaborator

Snapshots!

@xavier-villelegier
Copy link
Collaborator Author

@iRoachie Let me just update the docs

@xavier-villelegier xavier-villelegier merged commit 7ee34bb into next Jan 28, 2018
@xavier-villelegier xavier-villelegier deleted the searchbar-v1 branch January 28, 2018 17:03
xavier-villelegier pushed a commit that referenced this pull request Jan 28, 2018
* Update README.md - fixing typos (#835)

* Pass activeOpacity to TouchableOpacity inside Tile (#839)

* Pass activeOpacity to TouchableOpacity inside Tile

* Update Tile tests

* Comment `LinearGradient` for now (FIXME)

* feat(example): Cleanup remains from example app split

* Fix ListItem (#848)

Fix error on empty rightTitle prop by adding !!

* Separate checkbox single and checkbox with text styling (#850)

* (theming) Unify components under one primary color (#849)

* feat(theming): Remove not-used colors

* feat(theme): Add primary color and use through components

Added in button, button group, badge, and header

* Update snapshots

* Update underColor on buttonGroup to match selectedColor

* Snapshots

* Add color for Checkbox

* fix(Checkbox): Shifting width between checked and unchecked

* chore(packages): Update versions to fix warnings in jest

* added listItem right icon size so that it takes rightIcon size, or 28 (#852)

* uses thumbStyle.transform values in the thumb View (#820)

* [ts] Correct style type for IconObject (#851)

* Add ButtonComponent props and linear gradient props (#857)

* Add ButtonComponent props

* Use `linearGradientProps` + add error on mounting

* feat(button-group): Adds selectMultiple feature (#858)

Closes #713

* Platform specific SearchBar (#837) 🚀

* Add SearchBar wrapper

* Split SearchBar iOS and Android into separate files

* Add back default SearchBar

* Update root import

* Add back Input right/left icon

* Rename loadingIcon to loadingProps

* Specify `platform` PropType

* Add a fallback

* Move tests to `searchbar`

* Remove old Search component

* Fix loading props spreading overriding whole style

* Remove useless things

* Add tests for SearchBar

* Generate snapshots

* Add more tests

* Update tests

* Update documentation

* Fix typo

* Slightly changed the style of SearchBars

* Bump version to `1.0.0-beta2`

* Update snapshots from Searchbar changes

* feat(button): Re-add custom TouchableComponent

* feat(Button): Cleanup button code, update ts definitions (#859)

* Update SearchBars PropTypes

* feat(searchbar-both) Add additional defaultProps

Made tests pass

* Fix PropTypes warnings

* Update snapshots from searchbar android change

* feat(ts): Add definitons for searchbar (#860)

* Fix attributes spreading in platform specific searchbars

* feat(Button) Fix activeOpacity props

* fixed PricingCard to use new Button props

* test(jest): Update PricingCard snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants