When importing import MapplsGL from 'mappls-map-react-native'; App getting crash with TypeError: Cannot read property 'StyleSource' of null.
"react": "18.3.1",
"react-native": "0.77.1",
"mappls-map-react-native": "^1.0.11",
When importing import MapplsGL from 'mappls-map-react-native'; App getting crash with TypeError: Cannot read property 'StyleSource' of null.
"react": "18.3.1",
"react-native": "0.77.1",
"mappls-map-react-native": "^1.0.11",
Share
Improve this question
asked 3 hours ago
ElangoElango
3003 silver badges21 bronze badges
1 Answer
Reset to default 0This error happens because MapplsGL is not initialized correctly, or the native module is not properly linked. Follow these steps to resolve it:
Step 1: Reinstall the Package and Link Native Modules
npm uninstall mappls-map-react-native
npm install mappls-map-react-native --save
Step 2: Check If MapplsGL is Loaded Correctly
import MapplsGL from 'mappls-map-react-native';
console.log("MapplsGL:", MapplsGL);
console.log("Available Keys:",
Object.keys(MapplsGL));
MapplsGL.setAccessToken("<yourToken>");