Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/mapview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
| `loadingIndicatorColor` | `Color` | `#606060` | Sets loading indicator color, default to `#606060`.
| `loadingBackgroundColor` | `Color` | `#FFFFFF` | Sets loading background color, default to `#FFFFFF`.
| `moveOnMarkerPress` | `Boolean` | `true` | `Android only` If `false` the map won't move when a marker is pressed.
| `legalLabelInsets` | `EdgeInsets` | | If set, changes the position of the "Legal" label link from the OS default. **Note:** iOS only.


## Events
Expand Down Expand Up @@ -103,3 +104,12 @@ type EdgePadding {
left: Number
}
```

```
type EdgeInsets {
top: Number,
left: Number,
bottom: Number,
right: Number
}
```
38 changes: 36 additions & 2 deletions example/examples/LegalLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {
StyleSheet,
View,
Text,
Animated,
Dimensions,
TouchableOpacity,
} from 'react-native';

import MapView from 'react-native-maps';
Expand All @@ -15,6 +17,34 @@ class LegalLabel extends React.Component {
provider: MapView.ProviderPropType,
}

state = {
_legalLabelPositionY: new Animated.Value(10),
legalLabelPositionY: 10,
}

componentDidMount() {
this.state._legalLabelPositionY.addListener(({value}) => {
this.setState({
legalLabelPositionY: value,
});
});
}

componentWillUnmount() {
this.state._legalLabelPositionY.removeAllListeners();
}

onPressAnimate = () => {
Animated.sequence([
Animated.spring(this.state._legalLabelPositionY, {
toValue: 100,
}),
Animated.spring(this.state._legalLabelPositionY, {
toValue: 10,
}),
]).start();
}

render() {
const latlng = {
latitude: 37.78825,
Expand All @@ -30,7 +60,7 @@ class LegalLabel extends React.Component {
<MapView
provider={this.props.provider}
style={styles.map}
legalLabelInsets={{ bottom: 10, right: 10 }}
legalLabelInsets={{ bottom: this.state.legalLabelPositionY, right: 10 }}
initialRegion={{
...latlng,
latitudeDelta: LATITUDE_DELTA,
Expand All @@ -41,7 +71,9 @@ class LegalLabel extends React.Component {
</MapView>

<View style={styles.username}>
<Text style={styles.usernameText}>Username</Text>
<TouchableOpacity onPress={this.onPressAnimate}>
<Text style={styles.usernameText}>Animate</Text>
</TouchableOpacity>
</View>

<View style={styles.bio}>
Expand Down Expand Up @@ -84,6 +116,8 @@ const styles = StyleSheet.create({
usernameText: {
fontSize: 36,
lineHeight: 36,
color: 'blue',
textDecorationLine: 'underline',
},
photo: {
padding: 2,
Expand Down
6 changes: 6 additions & 0 deletions ios/AirMaps/AIRMap.m
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ - (void)updateLegalLabelInsets {
}
}


- (void)setLegalLabelInsets:(UIEdgeInsets)legalLabelInsets {
_legalLabelInsets = legalLabelInsets;
[self updateLegalLabelInsets];
}

- (void)beginLoading {
if ((!self.hasShownInitialLoading && self.loadingEnabled) || (self.cacheEnabled && self.cacheImageView.image == nil)) {
self.loadingView.hidden = NO;
Expand Down