Skip to content

data[key].filter is not a function <unknown> CountryCodeList.js:58:28 CountryCodeList.<anonymous> #4

@rizwan92

Description

@rizwan92

i am getting error when i put things like this

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import CountryCodeList from 'react-native-country-code-list';
import { connect } from 'react-redux';
import { selectCountryFunction } from '../../redux/actions/userAction';


class TraddleCountryPicker extends React.Component {
  state = {};

  render() {
    return (
      <View style={{ flex: 1, backgroundColor: '#fff' }}>
        <CountryCodeList
          data={[
            { name: 'india', wow: 'india', code: 91 },
            { name: 'Pakistan', wow: 'Pakistan', code: 91 },
            { name: 'Bangladesh', wow: 'bangladesh', code: 91 }
          ]}
          onClickCell={cellObject => {
            this.props.selectCountry(cellObject);
            this.props.navigation.goBack();
          }}
          renderCell={cellObject => {
            return (
              <View style={styles.renderCellStyle}>
                <Text style={styles.textStyle}>{cellObject.item.name}</Text>
                <Text style={styles.textStyle}>{cellObject.item.code}</Text>
              </View>
            );
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  renderCellStyle: {
    borderWidth: 0.6,
    borderColor: '#efefef',
    height: 40,
    justifyContent: 'space-between',
    flexDirection: 'row',
    alignItems: 'center',
    paddingLeft: 10,
    paddingRight: 10
  },
  textStyle: {
    fontSize: 20,
    fontWeight: '500'
  }
});

export default connect(
  state => ({
    user: state.user
  }),
  dispatch => ({
    selectCountry: country => dispatch(selectCountryFunction(country))
  })
)(TraddleCountryPicker);

when i search on searchbox i get error like this

image

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