Skip to content

ScrollView crashing in non-browser environments #1185

Open
@Joeao

Description

@Joeao

Hi Team ReactXP.

Doing some server side rendering and getting a document is not defined error. This problem seems to be similar to #730, fixed by 7e06794.

The issue can be replicated by rendering a ScrollView element in a non-browser environment. In my particular use case I'm using ReactDOMServer.renderToString, rendering a ReactXP app which includes a ScrollView.

 ReferenceError: document is not defined
    at Function.Scrollbar.getNativeScrollbarWidth (node_modules/reactxp/dist/web/CustomScrollbar.js:45:21)
    at new ScrollView (node_modules/reactxp/dist/web/ScrollView.js:147:66)

https://github.com/microsoft/reactxp/blob/master/src/web/CustomScrollbar.ts#L187
https://github.com/microsoft/reactxp/blob/master/src/web/ScrollView.tsx#L88

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplat: webPrimarily affects Web Browsers (and/or Electron)staleThis ticket may be old, or may no longer be valid, and will be closed if no further activity occurs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions