React-native-web: TypeError: nativeEvent.type is undefined in simple, base project

Created on 26 Mar 2016  路  3Comments  路  Source: necolas/react-native-web

This is essentially all that my app does:

web/index.js

import React, { AppRegistry } from 'react-native'
import MyView from './../app/myview'

AppRegistry.registerComponent('MyView', () => MyView);
AppRegistry.runApplication('MyView', {
    rootTag: document.getElementById('react-root')
});

app/myview.js

import React, {View, Text} from 'react-native';

export default class MyView extends React.Component {
    render() {
        return (
                <View>
                    <Text>React-Native. Hello World!</Text>
                </View>
        )
    }
}

Whenever I run this in a browser with webpack-dev-server, clicking anywhere on the browser gives the error in the console:

Firefox
TypeError: nativeEvent.type is undefined

Chrome
Uncaught TypeError: Cannot read property 'indexOf' of undefined

The line it is pointing to is this:

function normalizeNativeEvent(nativeEvent) {
>>  var mouse = nativeEvent.type.indexOf('mouse') >= 0;
  return mouse ? normalizeMouseEvent(nativeEvent) : normalizeTouchEvent(nativeEvent);
}

I am doing absolutely nothing fancy, and I am not sure why this error is occuring. It is also not allowing me to use TouchableOpacity or any of the other Touchable* components' onPress event. All I see is this error whenever I click anywhere.

All 3 comments

This issue was caused by a misconfiguration on my side. Closing this issue. Kindly reply if you would like me to ellaborate on what exactly the misconfiguration was.

Hi rohanprabhu, I have encounter this issue just now, could you share what's your findings? Thanks in advance.

@rohanprabhu what was your configuration issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bcpugh picture bcpugh  路  3Comments

holmesal picture holmesal  路  3Comments

ricklove picture ricklove  路  3Comments

MovingGifts picture MovingGifts  路  3Comments

buffaloDeveloper picture buffaloDeveloper  路  3Comments