Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.native.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // @flow
  2. // Apply all necessary polyfills as early as possible to make sure anything imported henceforth
  3. // sees them.
  4. import './features/mobile/polyfills';
  5. import React, { PureComponent } from 'react';
  6. import { AppRegistry } from 'react-native';
  7. import { App } from './features/app';
  8. import { IncomingCallApp } from './features/mobile/incoming-call';
  9. // It's crucial that the native loggers are created ASAP, not to lose any data.
  10. import { _initLogging } from './features/base/logging/functions';
  11. declare var __DEV__;
  12. /**
  13. * The type of the React {@code Component} props of {@link Root}.
  14. */
  15. type Props = {
  16. /**
  17. * The URL, if any, with which the app was launched.
  18. */
  19. url: Object | string
  20. };
  21. /**
  22. * React Native doesn't support specifying props to the main/root component (in
  23. * the JS/JSX source code). So create a wrapper React Component (class) around
  24. * features/app's App instead.
  25. *
  26. * @extends Component
  27. */
  28. class Root extends PureComponent<Props> {
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. return (
  37. <App
  38. { ...this.props } />
  39. );
  40. }
  41. }
  42. // Initialize logging.
  43. _initLogging();
  44. // HORRIBLE HACK ALERT! React Native logs the initial props with `console.log`. Here we are quickly patching it
  45. // to avoid logging potentially sensitive information.
  46. if (!__DEV__) {
  47. /* eslint-disable */
  48. const __orig_console_log = console.log;
  49. const __orig_appregistry_runapplication = AppRegistry.runApplication;
  50. AppRegistry.runApplication = (...args) => {
  51. // $FlowExpectedError
  52. console.log = () => {};
  53. __orig_appregistry_runapplication(...args);
  54. // $FlowExpectedError
  55. console.log = __orig_console_log;
  56. };
  57. /* eslint-enable */
  58. }
  59. // Register the main/root Component of JitsiMeetView.
  60. AppRegistry.registerComponent('App', () => Root);
  61. // Register the main/root Component of IncomingCallView.
  62. AppRegistry.registerComponent('IncomingCallApp', () => IncomingCallApp);