Skip to content

TypeError: Cannot read property 'getWrappedInstance' of undefined #35

@zeevl

Description

@zeevl

Using the following:

  • react-native 0.58
  • mobx ^5.9.0
  • mobx-react ^5.4.3
  • react-native-paper ^2.7.0

When doing something akin to the following --

import React from 'react';
import { observer } from 'mobx-react/native';
import {
  withTheme
} from 'react-native-paper';

class SomeClass extends React.Component<Props> {
  render() {...}
}

export default withTheme(observer(SomeClass));

using that class throws, TypeError: Cannot read property 'getWrappedInstance' of undefined.

The place it's being thrown from is here --

return this._root.getWrappedInstance

Apparently this._root doesn't exist on the component returned from observable. I'm not sure what _root is supposed to come from or why it's assumed to be there?

The object returned from mobx-react#observable works with other HOCs (i.e. react-jss) so it seems something special is being done here..?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions