react-native-navigation的迁移库

StaticEventsScreen.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const React = require('react');
  2. const Navigation = require('../services/Navigation');
  3. const Root = require('../components/Root');
  4. const Button = require('../components/Button');
  5. const {
  6. PUSH_BTN,
  7. POP_BTN,
  8. STATIC_EVENTS_OVERLAY_BTN,
  9. MODAL_BTN
  10. } = require('../testIDs');
  11. const Screens = require('./Screens');
  12. class StaticEventsScreen extends React.Component {
  13. render() {
  14. return (
  15. <Root componentId={this.props.componentId}>
  16. <Button label='Show Overlay' testID={STATIC_EVENTS_OVERLAY_BTN} onPress={this.showEventsOverlay} />
  17. <Button label='Push' testID={PUSH_BTN} onPress={this.push} />
  18. <Button label='Pop' testID={POP_BTN} onPress={this.pop} />
  19. <Button label='Show Modal' testID={MODAL_BTN} onPress={this.showModal} />
  20. </Root>
  21. );
  22. }
  23. showModal = () => {
  24. Navigation.showModal({
  25. component: {
  26. name: Screens.Modal
  27. }
  28. });
  29. }
  30. showEventsOverlay = () => Navigation.showOverlay(Screens.EventsOverlay, {
  31. overlay: {
  32. interceptTouchOutside: false
  33. }
  34. });
  35. push = () => Navigation.push(this, Screens.Pushed);
  36. pop = () => Navigation.pop(this);
  37. }
  38. module.exports = StaticEventsScreen;