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(native): Support both onChange and onChangeText props #462

Merged
merged 1 commit into from Jun 13, 2018

Conversation

Projects
None yet
2 participants
@eliperkins
Collaborator

eliperkins commented Jun 13, 2018

What:

This supports both props that accepts for supporting text
input changed events.

Additionally, this moves onChange related tests to their own module.

Why:

Fixes #361

How:

Adds additional argument to getInputProps that is only used on React Native builds. This argument is then used to provide an additional event handler.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table
fix(native): Support both onChange and onChangeText props
This supports both props that <TextInput /> accepts for supporting text
input changed events.

Additionally, this moves onChange related tests to their own module.
@eliperkins

This comment has been minimized.

Collaborator

eliperkins commented Jun 13, 2018

I PR'ed this into the next branch, but I suppose this is also source-compatible with v1.x. Let me know if you want me to PR this into master instead!

onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),
}
if (!rest.disabled) {

This comment has been minimized.

@eliperkins

eliperkins Jun 13, 2018

Collaborator

I don't love how this forking logic came out, so I'd love some feedback here.

This comment has been minimized.

@kentcdodds

kentcdodds Jun 13, 2018

Member

Actually, I don't think it's all that bad 👍

@kentcdodds

This looks good to me! Thanks!

onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),
}
if (!rest.disabled) {

This comment has been minimized.

@kentcdodds

kentcdodds Jun 13, 2018

Member

Actually, I don't think it's all that bad 👍

@kentcdodds kentcdodds merged commit 8442b75 into paypal:next Jun 13, 2018

1 check passed

deploy/netlify Deploy preview ready!
Details
@kentcdodds

This comment has been minimized.

Member

kentcdodds commented Jun 13, 2018

Thanks a bunch @eliperkins!

@eliperkins eliperkins deleted the eliperkins:onchangetext-onchange branch Jun 14, 2018

kentcdodds added a commit that referenced this pull request Jun 14, 2018

feat(2.0.0): release v2! (#461)
* feat(2.0.0): squashed commits of everything!

fix(TypeScript): Change typings (#373)

BREAKING CHANGE: TypeScript typings are much more complete now.

fix(exports): removed statics assignments to default export (#390)

fix(build): to facilitate better tree-shaking, this is necessary

feat(a11y): Improve a11y and add getMenuProps (#285)

We no longer will validate your `htmlFor` and `id` attributes on labels
and inputs. Instead we provide props you can pass if you really want to
set those. You can still set those values yourself on the elements, but
we wont validate them for you.

Closes #283

fix(TypeScript): add missing types for setItemCount and unsetItemCount actions (#393)

fix(TS): add missing types for setState and getMenuProps (#394)

fix(aria): improve WAI-ARIA compliance (#396)

Big thanks to @1Copenut for leaving feedback in #285

fix(aria): remove unnecessary aria-expanded from the input

feat(flow): add flow definitions (#399)

* [#23] Flow definitions

* removed factory function

* Fix code review notes

fix(TypeScript): fix several type definitions (#407)

* Fixed existing types and added missing types

* Added Partial to state

Closes #406

fix(TS): Change StateChangeOptions to only extend DownshiftState as a Partial (#424)

* let prettier run

* Add contributor

* StateChangeOptions now extends only a Partial of DownshiftState

fix(flow): more precise types (#402)

* [#23] more precise types

* update defintions

* feat(breakingChanges): remove the breakingChanges prop

Now we'll go with the more expected behavior for controlling selectedItem.

BREAKING CHANGE: When controlling `selectedItem`, the inputValue will be set to the `defaultInputValue` rather than `itemToString`.

* fix(menu): don't reset downshift if clicking within the menu

Closes #287

* fix: remove support for prop called `render`. Only support `children`

This is done to bring downshift into conformance with the community
convention of using the children prop (for example, the React Team chose
`children` with the official context API). We'd prefer to reduce
cognitive overhead by not having two ways to do the same thing.

Closes #433

BREAKING CHANGE: If you use the `render` prop, rename it to `children`.

* fix(preventDownshiftDefault): accept the property via nativeEvent

Closes #404

* fix(react-native): custom onPress handlers will now be properly called

* docs: add spectrum badge

* fix(TS): remove breakingChanges prop

* fix(native): Support both onChange and onChangeText props (#462)

This supports both props that <TextInput /> accepts for supporting text
input changed events.

Additionally, this moves onChange related tests to their own module.

BREAKING CHANGE: If you use the `render` prop, rename it to `children`.

Rendez added a commit to Rendez/downshift that referenced this pull request Sep 30, 2018

feat(2.0.0): release v2! (paypal#461)
* feat(2.0.0): squashed commits of everything!

fix(TypeScript): Change typings (paypal#373)

BREAKING CHANGE: TypeScript typings are much more complete now.

fix(exports): removed statics assignments to default export (paypal#390)

fix(build): to facilitate better tree-shaking, this is necessary

feat(a11y): Improve a11y and add getMenuProps (paypal#285)

We no longer will validate your `htmlFor` and `id` attributes on labels
and inputs. Instead we provide props you can pass if you really want to
set those. You can still set those values yourself on the elements, but
we wont validate them for you.

Closes paypal#283

fix(TypeScript): add missing types for setItemCount and unsetItemCount actions (paypal#393)

fix(TS): add missing types for setState and getMenuProps (paypal#394)

fix(aria): improve WAI-ARIA compliance (paypal#396)

Big thanks to @1Copenut for leaving feedback in paypal#285

fix(aria): remove unnecessary aria-expanded from the input

feat(flow): add flow definitions (paypal#399)

* [paypal#23] Flow definitions

* removed factory function

* Fix code review notes

fix(TypeScript): fix several type definitions (paypal#407)

* Fixed existing types and added missing types

* Added Partial to state

Closes paypal#406

fix(TS): Change StateChangeOptions to only extend DownshiftState as a Partial (paypal#424)

* let prettier run

* Add contributor

* StateChangeOptions now extends only a Partial of DownshiftState

fix(flow): more precise types (paypal#402)

* [paypal#23] more precise types

* update defintions

* feat(breakingChanges): remove the breakingChanges prop

Now we'll go with the more expected behavior for controlling selectedItem.

BREAKING CHANGE: When controlling `selectedItem`, the inputValue will be set to the `defaultInputValue` rather than `itemToString`.

* fix(menu): don't reset downshift if clicking within the menu

Closes paypal#287

* fix: remove support for prop called `render`. Only support `children`

This is done to bring downshift into conformance with the community
convention of using the children prop (for example, the React Team chose
`children` with the official context API). We'd prefer to reduce
cognitive overhead by not having two ways to do the same thing.

Closes paypal#433

BREAKING CHANGE: If you use the `render` prop, rename it to `children`.

* fix(preventDownshiftDefault): accept the property via nativeEvent

Closes paypal#404

* fix(react-native): custom onPress handlers will now be properly called

* docs: add spectrum badge

* fix(TS): remove breakingChanges prop

* fix(native): Support both onChange and onChangeText props (paypal#462)

This supports both props that <TextInput /> accepts for supporting text
input changed events.

Additionally, this moves onChange related tests to their own module.

BREAKING CHANGE: If you use the `render` prop, rename it to `children`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment