react-bootstrap-drawer icon indicating copy to clipboard operation
react-bootstrap-drawer copied to clipboard

Provide react-bootstrap Level of Support

Open ghost opened this issue 5 years ago • 5 comments

As raised by @richtera - the library lacks Typescript definitions, and does not support the use of ref as our functional components need to make use of React.forwardRef.

  • [x] Rewrite the project in Typescript.
  • [ ] Rewrite components in terms of React.forwardRef where needed.

See:

  • https://github.com/SimpleSigner/react-bootstrap-drawer/issues/1
  • https://github.com/SimpleSigner/react-bootstrap-drawer/pull/2
  • https://github.com/react-bootstrap/react-bootstrap/blob/0765f8a1dec691f10e22a8aaaa22607fb9d77b49/src/Button.tsx#L76

ghost avatar Sep 04 '21 23:09 ghost

See: https://www.carlrippon.com/creating-react-and-typescript-apps-with-webpack/

ghost avatar Apr 23 '22 09:04 ghost

The following is required to support JSX syntax inside of .ts files, it appears @babel/preset-typescript expects one to use the .tsx file extension to automagically pick up on the syntax. Without this configuration, the transpiler assumes the <div> syntax represents some form of type declaration, rather than JSX for a <div> element.

[
  '@babel/preset-typescript',
  {
    allExtensions: true,
    isTSX: true,
  }
],

See: https://babeljs.io/docs/en/babel-preset-typescript

ghost avatar Apr 30 '22 10:04 ghost

One will need to use a multi-phase compilation project, first using tsc (via npm install --save-dev typescript) to type check the project and generate the type definitions, second using Webpack / Babel to generate the JS bundle.

See: https://www.typescriptlang.org/docs/handbook/babel-with-typescript.html

ghost avatar May 29 '22 20:05 ghost

The forwardRef issue was not specifically because of references but because of a mismatch between react-bootstrap versions. Added a peerDependency definition to avoid this problem in the future.

ghost avatar Jun 05 '22 11:06 ghost

See: https://github.com/SimpleSigner/react-bootstrap-drawer/pull/4

ghost avatar Jun 05 '22 11:06 ghost