@mappedin/react-native-sdk 6.0.0-alpha.11 → 6.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -88
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
# @mappedin/react-native-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Mappedin SDK for React Native SDK enables integration of Mappedin's indoor mapping and navigation capabilities into React Native applications. This SDK provides a native wrapper around Mappedin's web-based mapping technology using WebView for cross-platform compatibility.
|
|
4
4
|
|
|
5
5
|
## ✨ Features
|
|
6
6
|
|
|
7
|
-
- 📱 **Cross-Platform
|
|
7
|
+
- 📱 **Cross-Platform** - Write once, deploy everywhere with confidence
|
|
8
8
|
- 🎯 **Interactive Indoor Maps** - Smooth zoom, pan, and rotation controls that feel natural
|
|
9
9
|
- 🧭 **Smart Navigation & Wayfinding** - Clear turn-by-turn directions your users will love
|
|
10
10
|
- 📍 **Points of Interest** - Beautifully showcase venue locations and amenities
|
|
11
|
-
- 🔄 **Real-time Updates** - Keep your maps fresh with live location tracking
|
|
12
|
-
- 🌐 **WebView-Powered** - Built on proven, reliable web technology
|
|
13
11
|
- ⚡ **Event-Driven** - Comprehensive event system for seamless interactions
|
|
14
12
|
|
|
13
|
+
## 🆘 Support & Resources
|
|
14
|
+
|
|
15
|
+
- 👨💻 [Mappedin Developer Portal](https://developer.mappedin.com/)
|
|
16
|
+
- 📖 [Mappedin SDK for React Native Guides](https://developer.mappedin.com/react-native-sdk/getting-started)
|
|
17
|
+
- 📋 [API Documentation](https://docs.mappedin.com/react-native-sdk-api/v6/latest/)
|
|
18
|
+
- 💬 [Community Forum](https://community.mappedin.com/)
|
|
19
|
+
|
|
15
20
|
## 📦 Installation
|
|
16
21
|
|
|
17
22
|
```bash
|
|
@@ -44,59 +49,61 @@ import { View, StyleSheet } from 'react-native';
|
|
|
44
49
|
import { MapView, useMap } from '@mappedin/react-native-sdk';
|
|
45
50
|
|
|
46
51
|
const MapSetup = () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
52
|
+
const { mapData, mapView } = useMap();
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (mapData && mapView) {
|
|
56
|
+
console.log('Map is ready!');
|
|
57
|
+
|
|
58
|
+
async function initializeMap() {
|
|
59
|
+
// Display all venue labels
|
|
60
|
+
mapView.Labels.all();
|
|
61
|
+
|
|
62
|
+
// Expand stacked maps with automatic spacing
|
|
63
|
+
await mapView.StackedMaps.expand({
|
|
64
|
+
distanceBetweenFloors: 'auto',
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Optional: Create a smooth tour through all spaces
|
|
68
|
+
for (const space of mapData.getByType('space')) {
|
|
69
|
+
await mapView.Camera.focusOn(space, {
|
|
70
|
+
duration: 1000,
|
|
71
|
+
easing: 'ease-in-out',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
initializeMap();
|
|
77
|
+
}
|
|
78
|
+
}, [mapData, mapView]);
|
|
79
|
+
|
|
80
|
+
return null;
|
|
76
81
|
};
|
|
77
82
|
|
|
83
|
+
// Add your Mappedin key, secret and map ID or use a demo key and map
|
|
84
|
+
// Demo Key & Maps: https://developer.mappedin.com/docs/demo-keys-and-maps
|
|
78
85
|
const App = () => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
return (
|
|
87
|
+
<View style={styles.container}>
|
|
88
|
+
<MapView
|
|
89
|
+
options={{}}
|
|
90
|
+
mapData={{
|
|
91
|
+
key: 'your-mappedin-key',
|
|
92
|
+
secret: 'your-mappedin-secret',
|
|
93
|
+
mapId: 'your-map-id',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<MapSetup />
|
|
97
|
+
</MapView>
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
93
100
|
};
|
|
94
101
|
|
|
95
102
|
const styles = StyleSheet.create({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
container: {
|
|
104
|
+
flex: 1,
|
|
105
|
+
backgroundColor: '#f0f8ff',
|
|
106
|
+
},
|
|
100
107
|
});
|
|
101
108
|
|
|
102
109
|
export default App;
|
|
@@ -109,35 +116,39 @@ import React from 'react';
|
|
|
109
116
|
import { MapView, useMap } from '@mappedin/react-native-sdk';
|
|
110
117
|
|
|
111
118
|
const CustomMapComponent = () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
const { mapData, mapView } = useMap();
|
|
120
|
+
|
|
121
|
+
const handleSpaceClick = async space => {
|
|
122
|
+
// Focus on clicked space with smooth animation
|
|
123
|
+
await mapView.Camera.focusOn(space, {
|
|
124
|
+
duration: 1500,
|
|
125
|
+
easing: 'ease-out',
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Add your Mappedin key, secret and map ID or use a demo key and map
|
|
130
|
+
// Demo Key & Maps: https://developer.mappedin.com/docs/demo-keys-and-maps
|
|
131
|
+
return (
|
|
132
|
+
<MapView
|
|
133
|
+
style={{ flex: 1 }}
|
|
134
|
+
mapData={{
|
|
135
|
+
key: 'mik_your_key_here',
|
|
136
|
+
secret: 'mis_your_secret_here',
|
|
137
|
+
mapId: 'your_map_id_here',
|
|
138
|
+
}}
|
|
139
|
+
options={
|
|
140
|
+
{
|
|
141
|
+
// Custom options go here
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
{/* Your custom map setup logic */}
|
|
146
|
+
</MapView>
|
|
147
|
+
);
|
|
137
148
|
};
|
|
138
149
|
```
|
|
139
150
|
|
|
140
|
-
## 🔧 API
|
|
151
|
+
## 🔧 API Summary
|
|
141
152
|
|
|
142
153
|
### Components
|
|
143
154
|
|
|
@@ -146,6 +157,7 @@ const CustomMapComponent = () => {
|
|
|
146
157
|
The main component that renders your indoor map with powerful mapping capabilities.
|
|
147
158
|
|
|
148
159
|
**Props:**
|
|
160
|
+
|
|
149
161
|
- `mapData` - Configuration object containing your Mappedin credentials
|
|
150
162
|
- `options` - Additional map configuration options
|
|
151
163
|
- `style` - ViewStyle for the map container
|
|
@@ -156,6 +168,7 @@ The main component that renders your indoor map with powerful mapping capabiliti
|
|
|
156
168
|
Access map data and view controls from any child component.
|
|
157
169
|
|
|
158
170
|
**Returns:**
|
|
171
|
+
|
|
159
172
|
- `mapData` - Venue data and spatial information
|
|
160
173
|
- `mapView` - Map control methods and interactions
|
|
161
174
|
|
|
@@ -171,31 +184,22 @@ mapView.Labels.hide(); // Hide all labels
|
|
|
171
184
|
|
|
172
185
|
// Stacked Maps
|
|
173
186
|
await mapView.StackedMaps.expand({
|
|
174
|
-
|
|
187
|
+
distanceBetweenFloors: 'auto' | number,
|
|
175
188
|
});
|
|
176
189
|
```
|
|
177
190
|
|
|
178
191
|
## 📚 Examples
|
|
179
192
|
|
|
180
193
|
Check out our example app in `apps/rn-example/` for more detailed implementations, including:
|
|
194
|
+
|
|
181
195
|
- Basic map initialization
|
|
182
196
|
- Custom styling and theming
|
|
183
197
|
- Navigation and routing
|
|
184
198
|
- Event handling
|
|
185
199
|
- Advanced interactions
|
|
186
200
|
|
|
187
|
-
## 🆘 Support & Resources
|
|
188
|
-
|
|
189
|
-
- 📖 [Mappedin Developer Portal](https://developer.mappedin.com/)
|
|
190
|
-
- 📋 [API Documentation](https://developer.mappedin.com/react-native/)
|
|
191
|
-
- 💬 [Community Forum](https://community.mappedin.com/)
|
|
192
|
-
- 🐛 [Issue Tracker](https://github.com/mappedin/react-native-sdk/issues)
|
|
193
|
-
|
|
194
201
|
## 📄 License
|
|
195
202
|
|
|
196
203
|
See LICENSE.txt for license information.
|
|
197
204
|
|
|
198
205
|
---
|
|
199
|
-
|
|
200
|
-
*Built with ❤️ by the Mappedin team*
|
|
201
|
-
|