選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.native.js 2.5KB

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