diff --git a/__tests__/MenuTrigger-test.js b/__tests__/MenuTrigger-test.js
index 2ce143c..19b85f0 100644
--- a/__tests__/MenuTrigger-test.js
+++ b/__tests__/MenuTrigger-test.js
@@ -15,9 +15,10 @@ describe('MenuTrigger', () => {
Trigger Button
);
- expect(nthChild(output, 0).type).toEqual(TouchableHighlight);
- expect(nthChild(output, 1).type).toEqual(View);
- expect(nthChild(output, 2)).toEqual(
+ expect(output.type).toEqual(View);
+ expect(nthChild(output, 1).type).toEqual(TouchableHighlight);
+ expect(nthChild(output, 2).type).toEqual(View);
+ expect(nthChild(output, 3)).toEqual(
Trigger Button
);
});
@@ -26,9 +27,9 @@ describe('MenuTrigger', () => {
const { output } = render(
);
- expect(nthChild(output, 0).type).toEqual(TouchableHighlight);
- expect(nthChild(output, 1).type).toEqual(View);
- expect(nthChild(output, 2)).toEqual(
+ expect(nthChild(output, 1).type).toEqual(TouchableHighlight);
+ expect(nthChild(output, 2).type).toEqual(View);
+ expect(nthChild(output, 3)).toEqual(
Trigger text
);
});
@@ -45,9 +46,8 @@ describe('MenuTrigger', () => {
const { output } = render(
);
- const triggerView = nthChild(output, 1);
- expect(typeof triggerView.ref).toEqual('function');
- triggerView.ref();
+ expect(typeof output.ref).toEqual('function');
+ output.ref();
expect(onRefSpy).toHaveBeenCalled();
expect(onRefSpy.calls.count()).toEqual(1);
});
@@ -58,7 +58,7 @@ describe('MenuTrigger', () => {
);
const menuActions = { openMenu: createSpy() };
instance.context = { menuActions };
- nthChild(output, 0).props.onPress();
+ nthChild(output, 1).props.onPress();
expect(menuActions.openMenu).toHaveBeenCalledWith('menu1');
expect(menuActions.openMenu.calls.count()).toEqual(1);
});
@@ -69,7 +69,7 @@ describe('MenuTrigger', () => {
);
const menuActions = { openMenu: createSpy() };
instance.context = { menuActions };
- nthChild(output, 0).props.onPress();
+ nthChild(output, 1).props.onPress();
expect(menuActions.openMenu).not.toHaveBeenCalled();
});
@@ -82,9 +82,9 @@ describe('MenuTrigger', () => {
const { output } = render(
);
- const touchable = nthChild(output, 0);
- const view = nthChild(output, 1);
- const text = nthChild(output, 2);
+ const touchable = nthChild(output, 1);
+ const view = nthChild(output, 2);
+ const text = nthChild(output, 3);
expect(normalizeStyle(touchable.props))
.toEqual(objectContaining({ underlayColor: 'green' }));
expect(normalizeStyle(view.props.style))
diff --git a/src/MenuTrigger.js b/src/MenuTrigger.js
index bf1a823..169b8cd 100644
--- a/src/MenuTrigger.js
+++ b/src/MenuTrigger.js
@@ -16,15 +16,17 @@ export default class MenuTrigger extends Component {
const onPress = () => !disabled && this._onPress();
const { Touchable, defaultTouchableProps } = makeTouchable(customStyles.TriggerTouchableComponent);
return (
-
-
- {text ? {text} : children}
-
-
+
+
+
+ {text ? {text} : children}
+
+
+
);
}