You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.native.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // @flow
  2. // FIXME The bundler-related (and the browser-related) polyfills were born at
  3. // the very early days of prototyping the execution of lib-jitsi-meet on
  4. // react-native. Today, the feature base/lib-jitsi-meet should not be
  5. // responsible for such polyfills because it is not the only feature relying on
  6. // them. Additionally, the polyfills are usually necessary earlier than the
  7. // execution of base/lib-jitsi-meet (which is understandable given that the
  8. // polyfills are globals). The remaining problem to be solved here is where to
  9. // collect the polyfills' files.
  10. import './features/base/lib-jitsi-meet/native/polyfills-bundler';
  11. // Polyfill localStorage early so any library that requires it sees it available.
  12. import './features/base/storage/native/polyfills-browser';
  13. import React, { PureComponent } from 'react';
  14. import { AppRegistry } from 'react-native';
  15. import { App } from './features/app';
  16. import { IncomingCallApp } from './features/mobile/incoming-call';
  17. // It's crucial that the native loggers are created ASAP, not to lose any data.
  18. import { _initLogging } from './features/base/logging/functions';
  19. declare var __DEV__;
  20. /**
  21. * The type of the React {@code Component} props of {@link Root}.
  22. */
  23. type Props = {
  24. /**
  25. * The URL, if any, with which the app was launched.
  26. */
  27. url: Object | string
  28. };
  29. /**
  30. * React Native doesn't support specifying props to the main/root component (in
  31. * the JS/JSX source code). So create a wrapper React Component (class) around
  32. * features/app's App instead.
  33. *
  34. * @extends Component
  35. */
  36. class Root extends PureComponent<Props> {
  37. /**
  38. * Implements React's {@link Component#render()}.
  39. *
  40. * @inheritdoc
  41. * @returns {ReactElement}
  42. */
  43. render() {
  44. return (
  45. <App
  46. { ...this.props } />
  47. );
  48. }
  49. }
  50. // Initialize logging.
  51. _initLogging();
  52. // HORRIBLE HACK ALERT! React Native logs the initial props with `console.log`. Here we are quickly patching it
  53. // to avoid logging potentially sensitive information.
  54. if (!__DEV__) {
  55. /* eslint-disable */
  56. const __orig_console_log = console.log;
  57. const __orig_appregistry_runapplication = AppRegistry.runApplication;
  58. AppRegistry.runApplication = (...args) => {
  59. // $FlowExpectedError
  60. console.log = () => {};
  61. __orig_appregistry_runapplication(...args);
  62. // $FlowExpectedError
  63. console.log = __orig_console_log;
  64. };
  65. /* eslint-enable */
  66. }
  67. // Register the main/root Component of JitsiMeetView.
  68. AppRegistry.registerComponent('App', () => Root);
  69. // Register the main/root Component of IncomingCallView.
  70. AppRegistry.registerComponent('IncomingCallApp', () => IncomingCallApp);