Skip to content

Commit 0883744

Browse files
committed
depend on react-navigation-header-buttons-base
1 parent 89ead99 commit 0883744

File tree

11 files changed

+346
-812
lines changed

11 files changed

+346
-812
lines changed

HeaderButton.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

HeaderButtons.js

Lines changed: 0 additions & 170 deletions
This file was deleted.

OverflowButton.js

Lines changed: 0 additions & 115 deletions
This file was deleted.

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This package will help you render buttons in the navigation bar and handle the styling so you don't have to. It tries to mimic the appearance of native navbar buttons. `HeaderButtons.Item` accepts `buttonWrapperStyle` prop which you may use to modify item alignment in case the default outcome does not fit your needs.
44

5+
This package depends on `react-native-vector-icons` and is a simple wrapper around [`react-navigation-header-buttons-base`](https://github.com/vonovak/react-navigation-header-buttons-base), which you can use if you do not want to depend on the icons package.
6+
57
#### Demo App with Code Samples
68

79
Available via expo [here](https://expo.io/@vonovak/navbar-buttons-demo)
@@ -27,6 +29,22 @@ static navigationOptions = {
2729
};
2830
```
2931

32+
Alernatively, you can use the icon-family-based exports:
33+
34+
```
35+
import { IoniconHeaderButtons, Item } from 'react-navigation-header-buttons'
36+
37+
static navigationOptions = {
38+
title: 'Usage With Icons',
39+
headerRight: (
40+
<IoniconHeaderButtons color="blue">
41+
<Item title="add" iconName="ios-search" onPress={() => console.warn('add')} />
42+
<Item title="select" onPress={() => console.warn('edit')} />
43+
</IoniconHeaderButtons>
44+
),
45+
};
46+
```
47+
3048
#### Props of HeaderButtons
3149

3250
`HeaderButtons` accepts:
@@ -37,7 +55,7 @@ static navigationOptions = {
3755
| IconComponent?: React.ComponentType<\*> | component to use for the icons | |
3856
| iconSize?: number | iconSize | |
3957
| color?: string | color of icons and buttons | |
40-
| OverflowIcon?: React.Node | React element for the overflow icon | will render android-styled overflow icon by default |
58+
| OverflowIcon?: React.ComponentType<\*> | React element for the overflow icon | will render android-styled overflow icon by default |
4159
| overflowButtonWrapperStyle?: Object | optional styles for overflow button | there are some default styles set, as seen in `OverflowButton.js` |
4260
| cancelButtonLabel?: string | ios only, the cancel button label for overflow menu actions | 'Cancel' by default |
4361

example/navbar-buttons-demo/screens/UsageCustom.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class UsageCustom extends React.Component<ScreenProps> {
2121
title="add"
2222
IconElement={<Ionicons name="ios-add" size={23} />}
2323
buttonWrapperStyle={{ marginTop: -10 }}
24-
onPress={() => console.warn('add')}
24+
onPress={() => alert('add')}
2525
/>
2626
</HeaderButtons>
2727
),
@@ -40,10 +40,10 @@ export class UsageCustom extends React.Component<ScreenProps> {
4040
title="add"
4141
IconElement={<Ionicons name="ios-add" size={23} />}
4242
buttonWrapperStyle={{ marginTop: -10 }}
43-
onPress={() => console.warn('add')}
43+
onPress={() => alert('add')}
4444
/>
4545
</HeaderButtons>
46-
),
46+
)
4747
`;
4848

4949
return (

0 commit comments

Comments
 (0)