Skip to content

Releases: vonovak/react-navigation-header-buttons

v3.0.2

14 Aug 16:39
Compare
Choose a tag to compare
  • improvement to TS types (#54)

If you have any other TS problem, please contribute a PR! I'll ship it quickly :)

v3.0.1

14 Jul 15:37
Compare
Choose a tag to compare

fixes: support for arrays of styles in TypeScript (#52)

v3.0.0

01 Jul 20:08
Compare
Choose a tag to compare

Welcome to new major release!

❌ Breaking

  • The module no longer has a default export: HeaderButtons which was previously default export, is now a named export.

There are a bunch of named exports and I felt like it wasn't clear which export is the "main one", so I made them all named.

  • default testID for overflow button is now exported from here. This is so that in e2e tests, by importing it, you depend just on the constant and not other React-related stuff from this lib.

🎉 New features

  • new HiddenItem component

If you have a lot of code where you specify show="never" then you can make the code a little more straightforward:

<Item title="edit" show={Item.SHOW_NEVER} onPress={...} />
=>
<HiddenItem title="edit" onPress={...} />

🏋 Improvements

  • easier customization of cancel button in iOS ActionSheets
    There were several requests for adding a overflowCancelButtonTitle prop that would customize the cancel button shown in the iOS Action Sheet. I didn't want to add such prop to the api, so I looked for another way - it is now possible to import the default overflow button menu press handlers and override the cancel label (and potentially other params if someone wants that). I hope this works well for you. Let me know if not :)

See the example

  • some small improvements to how code is structured

It's possible that the TS typings are now broken, unfortunately I don't have time to verify them. Please send me a PR if you encounter a problem with TS.

Lastly, thank you for using this small package!

v2.3.1

27 Apr 13:55
Compare
Choose a tag to compare
  • uses the same default android ripple color as react-navigation ('rgba(0, 0, 0, .32)')

see example if you want to customize the ripple

v2.3.0

27 Apr 13:07
Compare
Choose a tag to compare
  • export more TS types - #46

v2.2.0

27 Mar 22:03
Compare
Choose a tag to compare

new features

v2.1.2

30 Jan 22:07
Compare
Choose a tag to compare

fixes flow typing for Flow v0.85 #41 by @gaykov

v2.1.1

16 Nov 13:07
Compare
Choose a tag to compare

this release

  • fixes flow errors
  • removes StyleObj flow type in favor of ViewStyleProp which is present on latest RN versions (#31)
  • fixes wrong destructuring here

v2.1.0

27 Jul 14:26
Compare
Choose a tag to compare

v2.0.0

16 Jul 22:56
Compare
Choose a tag to compare

v2 includes a slightly redesigned api that allows for easier support of use cases such as disabled item state or custom ripple effect on the buttons. There are breaking changes, but if you followed the previous advice on "How to integrate in your project", migration should be easy. There are no changes to styling of the buttons.

Breaking:

  • cancelButtonLabel prop was removed, provide custom onOverflowMenuPress if you relied on this prop.

to get the same behavior and customize the cancel label used on ActionSheetIOS, the replacement will look more or less like this

const onOverflowMenuPressIOS = ({ hiddenButtons }) => {
  let actionTitles = hiddenButtons.map(btn => btn.props.title);
  actionTitles.push('your cancel label');

  ActionSheetIOS.showActionSheetWithOptions(
    {
      options: actionTitles,
      cancelButtonIndex: actionTitles.length - 1,
    },
    (buttonIndex: number) => {
      if (buttonIndex !== actionTitles.length - 1) {
        hiddenButtons[buttonIndex].props.onPress();
      }
    }
  );
};
  • IconElement was renamed to ButtonElement
  • HeaderButtons expects different props now - instead of IconComponent, iconSize and color you're expected to pass HeaderButtonComponent prop

If you were using this library together with react-native-vector-icons, you will also be required to import HeaderButton and wrap it in your own component providing the IconComponent, iconSize and color props, as documented here.

Please see the example screens or run the improved example app.