myxvisual / react-uwp

📱⌨ React Components that Implement Microsoft's UWP Design & Fluent Design.
https://react-uwp.com
MIT License
1.18k stars 78 forks source link

Unable to get property 'toLowercase' of undefined or null reference #60

Closed ShrinathGupta closed 6 years ago

ShrinathGupta commented 6 years ago

Problem description

Build getting failed when deployed on react-native for windows. It shows error in ...\node_modules\react-uwp\common\electron\IS_ELECTRON_ENV.js

I debugged and found that navigator does not have userAgent object, because if this it throws undefined.

Link to minimal working code that reproduces the issue

import * as React from "react";
import { Theme as UWPThemeProvider, getTheme } from "react-uwp/Theme";
import Button from "react-uwp/Button";
const theme = getTheme({
  themeName: "dark",
  accent: "#0078D7",
  useFluentDesign: true,
  desktopBackgroundImage: "http://127.0.0.1:8092/static/images/jennifer-bailey-10753.jpg"
  userAgent: req.headers['user-agent']
});

export class App extends React.Component {
  render() {
    return (
      <UWPThemeProvider
        theme={theme}
        needGenerateAcrylic={false} // if using SSR, set this config to false, using fallback color.
      >
        <Button>Server Side Rendering...</Button>
      </UWPThemeProvider>
    )
  }
}
export default App;

error

Versions

I have tried lot of things but it's not working.

@myxvisual Your help will be highly appreciated. !

myxvisual commented 6 years ago

Hi @ShrinathGupta thanks for feedback, sorry for neglecting this error, now you can upgrade to v1.2.2 to solve this problem.

myxvisual commented 6 years ago

Hi @ShrinathGupta thanks for feedback, sorry for neglecting this error, now you can upgrade to v1.2.2 to solve this problem.

myxvisual commented 6 years ago

Hi @ShrinathGupta thanks for feedback, sorry for neglecting this error, now you can upgrade to v1.2.2 to solve this problem.

ShrinathGupta commented 6 years ago

Thanks, but i tired that also and it breaks at react-dommodule, Error: Object doesn't support property or method 'addeventlistner', error2

If i tried to remove, react-dom it breaks at module dependency 'Scrollreveal/index.js' So, I manually commented eventlistener in schedule.development.js.

  // Assumes that we have addEventListener in this environment. Might need
  // something better for old IE.
  // window.addEventListener('message', idleTick, false);

After doing that still facing issue, please refer below attached image. error3

One more thing if i pass userAgent: req.headers['user-agent'], error occured: req is not defined.

@myxvisual can you please check where it starts breaking.