Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'rtl' of undefined #489

Open
nizhegorodets opened this issue Jul 11, 2021 · 1 comment
Open

Cannot read property 'rtl' of undefined #489

nizhegorodets opened this issue Jul 11, 2021 · 1 comment

Comments

@nizhegorodets
Copy link

Good afternoon!

I'm trying to use an external component, but I can't import it correctly. Please tell me where I am going wrong?

Component:
https://garden.zendesk.com/components/tabs#tab

Sandbox example:
https://codesandbox.io/s/88ejj?module=src/Example.tsx&file=/src/Example.tsx

I was able to import TabList, Tab, TabPanel successfully, but there is an error when importing Tabs.
Screenshot from 2021-07-10 15-16-47

Versions:

scalaVersion := "2.13.6"

Compile / npmDependencies += "react"                        -> "16.13.1"
Compile / npmDependencies += "react-dom"                    -> "16.13.1"
Compile / npmDependencies += "react-proxy"                  -> "1.1.8"
Compile / npmDependencies += "react-router-dom"             -> "5.2.0"
Compile / npmDependencies += "@zendeskgarden/react-buttons" -> "8.38.0"
Compile / npmDependencies += "@zendeskgarden/react-tabs"    -> "8.38.0"

Compile / npmDevDependencies += "file-loader"         -> "6.2.0"
Compile / npmDevDependencies += "style-loader"        -> "2.0.0"
Compile / npmDevDependencies += "css-loader"          -> "5.2.6"
Compile / npmDevDependencies += "html-webpack-plugin" -> "4.5.1"
Compile / npmDevDependencies += "copy-webpack-plugin" -> "6.4.0"
Compile / npmDevDependencies += "webpack-merge"       -> "5.8.0"

libraryDependencies += "me.shadaj" %%% "slinky-web" % "0.6.7"
libraryDependencies += "me.shadaj" %%% "slinky-hot" % "0.6.7"

libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.9" % Test

scalacOptions += "-Ymacro-annotations"

webpack / version := "4.44.2"
startWebpackDevServer / version := "3.11.2"

My code:

@JSImport("@zendeskgarden/react-tabs", JSImport.Default)
@js.native
object GardenTab extends js.Object {
  val Tab: js.Object = js.native
}

@react object Tab extends ExternalComponent {
  case class Props(item: String)
  override val component = GardenTab.Tab
}

@JSImport("@zendeskgarden/react-tabs", JSImport.Default)
@js.native
object GardenTabList extends js.Object {
  val TabList: js.Object = js.native
}

@react object TabList extends ExternalComponent {
  case class Props()
  override val component = GardenTabList.TabList
}

@JSImport("@zendeskgarden/react-tabs", JSImport.Default)
@js.native
object GardenTabPanel extends js.Object {
  val TabPanel: js.Object = js.native
}

@react object TabPanel extends ExternalComponent {
  case class Props(item: String)
  override val component = GardenTabPanel.TabPanel
}

@JSImport("@zendeskgarden/react-tabs", JSImport.Default)
@js.native
object GardenTabs extends js.Object {
  val Tabs: js.Object = js.native
}

@react object Tabs extends ExternalComponent {
  case class Props(isVertical: Boolean)
  override val component = GardenTabs.Tabs
}

@react class App extends StatelessComponent {
  type Props = Unit

  def render() =
    div(className := "App")(
      p(className := "gardenTabs") {
        Tabs(isVertical = true)(
          TabList() {
            Seq(
              Tab(item = "item1")("ITEM1"),
              Tab(item = "item2")("ITEM2"),
              Tab(item = "item3")("ITEM3")
            )
          },
          TabPanel(item = "item1") { "item1 tabPanel" },
          TabPanel(item = "item2") { "item2 tabPanel" }
        )
      }
    )
}

"Tabs code":

import React from 'react';
import { ThemeProps, DefaultTheme } from 'styled-components';
export interface ITabsProps extends Partial<ThemeProps<DefaultTheme>> {
    /**
     * Displays child `Tab` components in a vertical orientation
     */
    isVertical?: boolean;
    /**
     * Sets the currently selected `Tab` to display
     */
    selectedItem?: any;
    /**
     * Provides a callback function that returns the `selectedItem` when a `Tab` has been selected by keyboard or mouse
     * @param {String} selectedItem The `item` value of the selected `Tab`
     */
    onChange?: (updatedSelectedItem: any) => void;
}
declare const _default: React.FC<ITabsProps & React.RefAttributes<HTMLDivElement>>;
/** @component */
export default _default;
@shadaj
Copy link
Owner

shadaj commented Nov 5, 2021

Where specifically does the exception take place? It seems to be happening within React?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants