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.0KB

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