Kais Kais - 1 year ago 257
React JSX Question

Unknown named module: 'react/lib/NativeMethodsMixin'

I create a new React Native project and install @shoutem/ui in project and include the Examples component of Shoutem UI into React Native app.

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { Examples } from '@shoutem/ui';

class HelloWorld extends Component {
render() {
return (
<Examples />

AppRegistry.registerComponent('HelloWorld', () => HelloWorld);

But when I run start the project , I get "Unknown named module: 'react/lib/NativeMethodsMixin'" error.

Answer Source

The bug seems to be inside the @shoutem/animation module, in the Parallax.js file: https://github.com/shoutem/animation/blob/develop/Parallax.js NativeMethodsMixin is not imported correctly from react:

If you change this: import NativeMethodsMixin from 'react/lib/NativeMethodsMixin'; to this: import NativeMethodsMixin from 'react'; your app should work.

I would either file a Github issue on the @shoutem/animation project or check if the way NativeMethodsMixin is imported is specific to an older version of react and then use that version in your app.

I hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download