alinz / react-native-dropdown

This is simple implementation of drop down menu
MIT License
657 stars 160 forks source link

Super expression must either be null or a function, not undefined. #45

Closed tigerraj32 closed 6 years ago

tigerraj32 commented 8 years ago

I got this error message after i install this package. Super expression must either be null or a function, not undefined Module AppRegistry is not a registered callable module.

I have react-native-cli: 1.0.0 react-native: 0.26.3 node: v4.4.3

mosesmc52 commented 8 years ago

I got the error message as well

loriling commented 8 years ago

me too

avishayhajbi commented 8 years ago

+1

mlumbroso commented 8 years ago

Hi,

I've started investigating this issue, and for now I managed to not have this error and display the dropdown (although I have another error on select). I'll try to make a PR when I have time.

What allowed to begin fixing was using new import syntax :

_ On all files in node_modules/react-native-dropdown/ replace: const React = require('react-native'); with

import React, { Component } from 'react';

and make those sort of changes :

const {
  StyleSheet,
  Component,
  View,
  Text
} = React;

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

(beware to remove Component since it's included via the previous command).

Then replace : extends Component with extends React.Component

And it shouldn't do this error again. I'll try to do a PR tomorrow if I can.

Edit : just saw this PR #41 that does these changes...

shivamsinha15 commented 8 years ago

until the pull request #41 is accepted you can fix it problem by directly using that specific PR.

  1. Goto react project folder
  2. rm -rf node_modules
  3. npm install https://github.com/g6ling/react-native-dropdown --save
  4. npm install
riten7 commented 8 years ago

I am also getting the same error ....please fix this as soon as possible

qingtian5266 commented 7 years ago

+1

ghost commented 7 years ago

+1

Keped commented 6 years ago

+1

mxdi9i7 commented 6 years ago

I'm still encountering the same issue, I basically copied the code on README.md to test on my app but the error still appears. I notice that there hasn't been any response on this issue since 6 months ago, is this project not maintained anymore?

jerinho commented 6 years ago

Hi,

I've started investigating this issue, and for now I managed to not have this error and display the dropdown (although I have another error on select). I'll try to make a PR when I have time.

What allowed to begin fixing was using new import syntax :

_ On all files in node_modules/react-native-dropdown/ replace: const React = require('react-native'); with

import React, { Component } from 'react';

and make those sort of changes :

const {
  StyleSheet,
  Component,
  View,
  Text
} = React;

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

(beware to remove Component since it's included via the previous command).

Then replace : extends Component with extends React.Component

And it shouldn't do this error again. I'll try to do a PR tomorrow if I can.

Edit : just saw this PR #41 that does these changes...

why we need to edit node_modules's file. it is ignored by git. is it a bug?

namnm commented 5 years ago

Look like the bug was fixed in this git repo, but he hasnt published the change to a new npm version?

SG-Yang commented 5 years ago

it is got fixed? "react-native-dropdown": "0.0.6", try the demo. 04-23 09:49:11.581 1421-1610/com.ahbapp E/ReactNativeJS: Super expression must either be null or a function, not undefined

import React, {Component} from 'react' import {StyleSheet, Text, TextInput, View} from "react-native"; import {Col, Grid, Row} from "react-native-easy-grid"; import {Option, OptionList, Select, updatePosition} from 'react-native-dropdown' import withNavigation from "react-navigation/src/views/withNavigation";

class PathShow extends Component { constructor(props) { super(props) this.state = { pathCategory: '', canada: '' } }

componentDidMount() {
    updatePosition(this.refs['SELECT1']);
    updatePosition(this.refs['OPTIONLIST']);
}

_getOptionList() {
    return this.refs['OPTIONLIST'];
}

_canada(province) {

    this.setState({
        ...this.state,
        canada: province
    });
}

render(): React.ReactNode {

    return (
        <View style={{height: '100%', width: '100%'}}>
            <Grid style={styles.searchContainer}>
                <Row style={{width: '100%', height: 60}}>
                    <Col size={20}>
                        <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                            <Select
                                width={250}
                                ref="SELECT1"
                                optionListRef={this._getOptionList.bind(this)}
                                defaultValue="Select a Province in Canada ..."
                                onSelect={this._canada.bind(this)}>
                                <Option children={'Yukon'}></Option>
                            </Select>
                            <Text>Selected provicne of Canada: {this.state.canada}</Text>
                            <OptionList ref="OPTIONLIST"/>
                        </View>
                    </Col>
                    <Col size={80}>
                        <View style={{backgroundColor: '#FFFFFF'}}>
                            <TextInput style={styles.searchBoxStyle} autoFocus={true} placeholder={'输入查询条件'}>
                            </TextInput>
                        </View>
                    </Col>
                </Row>
                <Row size={80}>
                </Row>
            </Grid>
        </View>
    )
}

}

const styles = StyleSheet.create({ searchBoxStyle: { borderBottomWidth: 1, borderBottomColor: '#6275ff' }, searchContainer: { // backgroundColor:'#FFFFFF' } }) export default withNavigation(PathShow);

namnm commented 5 years ago

It's fixed in this git repo, but the author hasnt published a new npm version for it!

ghasemikasra39 commented 5 years ago

same issue