Home / File/ UnsupportedVersionDialog.js — react Source File

UnsupportedVersionDialog.js — react Source File

Architecture documentation for UnsupportedVersionDialog.js, a javascript file in the react codebase. 5 imports, 1 dependents.

File javascript BabelCompiler Validation 5 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1["UnsupportedVersionDialog.js"]
  899cf357_78bc_8627_bd54_2c00e2c9fde2["ModalDialog.js"]
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 --> 899cf357_78bc_8627_bd54_2c00e2c9fde2
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  7b4b1f74_ad9f_b54a_6f0f_61769f9baa4b["constants.js"]
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 --> 7b4b1f74_ad9f_b54a_6f0f_61769f9baa4b
  b32e1bff_a181_a5b6_2828_1e3241442fff["UnsupportedVersionDialog.css"]
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 --> b32e1bff_a181_a5b6_2828_1e3241442fff
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  e2c52a93_982e_407f_9fee_e89aa134ae9d["DevTools.js"]
  e2c52a93_982e_407f_9fee_e89aa134ae9d --> 2b861b3e_4cb9_174c_13d4_aec0fc37d1b1
  style 2b861b3e_4cb9_174c_13d4_aec0fc37d1b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {Fragment, useContext, useEffect, useState} from 'react';
import {ModalDialogContext} from './ModalDialog';
import {StoreContext} from './context';
import {UNSUPPORTED_VERSION_URL} from '../constants';

import styles from './UnsupportedVersionDialog.css';

type DAILOG_STATE = 'dialog-not-shown' | 'show-dialog' | 'dialog-shown';

export default function UnsupportedVersionDialog(_: {}): null {
  const {dispatch} = useContext(ModalDialogContext);
  const store = useContext(StoreContext);
  const [state, setState] = useState<DAILOG_STATE>('dialog-not-shown');

  useEffect(() => {
    if (state === 'dialog-not-shown') {
      const showDialog = () => {
        setState('show-dialog');
        dispatch({
          canBeDismissed: true,
          id: 'UnsupportedVersionDialog',
          type: 'SHOW',
          content: <DialogContent />,
        });
      };

      if (store.unsupportedRendererVersionDetected) {
        showDialog();
      } else {
        store.addListener('unsupportedRendererVersionDetected', showDialog);
        return () => {
          store.removeListener(
            'unsupportedRendererVersionDetected',
            showDialog,
          );
        };
      }
    }
  }, [state, store]);

  return null;
}

function DialogContent(_: {}) {
  return (
    <Fragment>
      <div className={styles.Row}>
        <div>
          <div className={styles.Title}>Unsupported React version detected</div>
          <p>
            This version of React DevTools supports React DOM v15+ and React
            Native v61+.
          </p>
          <p>
            In order to use DevTools with an older version of React, you'll need
            to{' '}
            <a
              className={styles.ReleaseNotesLink}
              target="_blank"
              rel="noopener noreferrer"
              href={UNSUPPORTED_VERSION_URL}>
              install an older version of the extension
            </a>
            .
          </p>
        </div>
      </div>
    </Fragment>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does UnsupportedVersionDialog.js do?
UnsupportedVersionDialog.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in UnsupportedVersionDialog.js?
UnsupportedVersionDialog.js defines 2 function(s): DialogContent, UnsupportedVersionDialog.
What does UnsupportedVersionDialog.js depend on?
UnsupportedVersionDialog.js imports 5 module(s): ModalDialog.js, UnsupportedVersionDialog.css, constants.js, context.js, react.
What files import UnsupportedVersionDialog.js?
UnsupportedVersionDialog.js is imported by 1 file(s): DevTools.js.
Where is UnsupportedVersionDialog.js in the architecture?
UnsupportedVersionDialog.js is located at packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free