Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.native.js 2.3KB

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