bramus / react-native-maps-directions

Directions Component for `react-native-maps`
MIT License
1.24k stars 196 forks source link

Blank Screen in Production Mode #197

Closed krishna-gujjjar closed 2 years ago

krishna-gujjjar commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-maps-directions@1.8.0 for the project I'm working on.

The current version of this package does not work well with react-native-maps@1.0.2. The Error shows that I got that error in the react-native-maps-directions.

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-maps-directions/.eslintignore b/node_modules/react-native-maps-directions/.eslintignore
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/.eslintrc b/node_modules/react-native-maps-directions/.eslintrc
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/.github/workflows/format_eslint.yml b/node_modules/react-native-maps-directions/.github/workflows/format_eslint.yml
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/CHANGELOG.md b/node_modules/react-native-maps-directions/CHANGELOG.md
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/LICENSE.md b/node_modules/react-native-maps-directions/LICENSE.md
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/README.md b/node_modules/react-native-maps-directions/README.md
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/index.d.ts b/node_modules/react-native-maps-directions/index.d.ts
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/index.js b/node_modules/react-native-maps-directions/index.js
old mode 100644
new mode 100755
diff --git a/node_modules/react-native-maps-directions/src/MapViewDirections.js b/node_modules/react-native-maps-directions/src/MapViewDirections.js
old mode 100644
new mode 100755
index ac08d73..6347b44
--- a/node_modules/react-native-maps-directions/src/MapViewDirections.js
+++ b/node_modules/react-native-maps-directions/src/MapViewDirections.js
@@ -1,6 +1,6 @@
 import React, { Component } from 'react';
 import PropTypes from 'prop-types';
-import MapView from 'react-native-maps';
+import {Polyline} from 'react-native-maps';
 import isEqual from 'lodash.isequal';

 const WAYPOINT_LIMIT = 10;
@@ -220,7 +220,7 @@ class MapViewDirections extends Component {
        })
            .catch(errorMessage => {
                this.resetState();
-               console.warn(`MapViewDirections Error: ${errorMessage}`); // eslint-disable-line no-console
+               console.warn(`MapViewDirections Error: `, errorMessage); // eslint-disable-line no-console
                onError && onError(errorMessage);
            });
    }
@@ -305,7 +305,7 @@ class MapViewDirections extends Component {
        } = this.props;

        return (
-           <MapView.Polyline coordinates={coordinates} {...props} />
+           <Polyline coordinates={coordinates} {...props} />
        );
    }

diff --git a/node_modules/react-native-maps-directions/v2.md b/node_modules/react-native-maps-directions/v2.md
old mode 100644
new mode 100755

This issue body was partially generated by patch-package.

bramus commented 2 years ago

What is the version of react-native-maps? The last commit fixed an issue with version 1.0.0. Might need to update the peerDependencies constraint there to reflect this.

krishna-gujjjar commented 2 years ago

Yes, react-native-maps-directions@1.9.0 fixed this issue.

Thanks