Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RNN-v2 Helper Functions with Flow Typing
import { Navigation } from "react-native-navigation";
class NavigationHelpers {
// @flow
static showModal = (
modalName: string,
modalTitleText: string,
props?: Object = {}
) => {
Navigation.showModal({
stack: {
children: [
{
component: {
name: modalName,
passProps: { ...props },
options: {
topBar: {
title: {
text: modalTitleText
},
//just an example, you would need your own <CloseModalButton/>
// leftButtons: [
// {
// id: "close",
// component: { name: "CloseModalButton" }
// }
// ]
}
}
}
}
]
}
});
};
// @flow
static pushComponent = (
componentId: string,
componentName: string,
title: string,
props?: Object = {}
) => {
Navigation.push(componentId, {
component: {
name: componentName,
passProps: {
...props
},
options: {
topBar: {
title: {
text: title
}
}
}
}
});
};
}
export { NavigationHelpers };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.