arun rajesh
arun rajesh

Reputation: 181

React native X.match not a function

Code:

import MapView from 'react-native-maps'

export default class mapTestProject extends Component {
  render() {
    return (
      <MapView>
         style = {styles.map}
         showsUserLocation = {false}
         followUserLocation = {false}
         zoomEnabled = {true}
      />
    );
  }
}

const styles = StyleSheet.create({
  map: {
      height: 400,
      marginTop: 80
   },
});

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

I am trying to create a sample map project.It gives "x.match not a function" error.Please help me on fixing this issue.any help will be appreicated.thanks in advance

enter image description here"

Upvotes: 1

Views: 994

Answers (2)

tonymayoral
tonymayoral

Reputation: 5217

Had the same issue with the latest version of react-native-maps v0.14.0 Temporally using v0.13.1 solved the problem:

npm install [email protected] --save
react-native link

Upvotes: 0

Shubham Khatri
Shubham Khatri

Reputation: 281874

React Components name must begin with upper case letter since all lower case are reserved for the HTML tags like div, p, span, li etc

import MapView from 'react-native-maps'

export default class MapTestProject extends Component {
  render() {
    return (
      <MapView>
         style = {styles.map}
         showsUserLocation = {false}
         followUserLocation = {false}
         zoomEnabled = {true}
      />
    );
  }
}

const styles = StyleSheet.create({
  map: {
      height: 400,
      marginTop: 80
   },
});

AppRegistry.registerComponent('mapTestProject', () => MapTestProject);

Upvotes: 1

Related Questions