Skip to content

v2.0.0

Compare
Choose a tag to compare
@vonovak vonovak released this 16 Jul 22:56
· 190 commits to master since this release

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.