Skip to content

Commit

Permalink
[expo] Deprecate importing Linking from expo package and remove unu…
Browse files Browse the repository at this point in the history
…sed dependency (#8659)
  • Loading branch information
tsapeta committed Jun 4, 2020
1 parent 4bec954 commit dcf36df
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 64 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -33,6 +33,7 @@ Package-specific changes not released in any SDK will be added here just before

- `react-native-view-shot` is no longer installed by default, install it with `expo install react-native-view-shot`. ([#7950](https://github.com/expo/expo/pull/7950) by [@evanbacon](https://github.com/evanbacon))
- The AR module has been removed from the `expo` package. See https://expo.fyi/deprecating-ar for more information. ([#8442](https://github.com/expo/expo/pull/8442) by [@sjchmiela](https://github.com/sjchmiela))
- Importing `Linking` from `expo` package is now deprecated. Use `expo-linking` module instead. ([#8659](https://github.com/expo/expo/pull/8659) by [@tsapeta](https://github.com/tsapeta))
- **`expo-battery`**
- Removed deprecated `isSupported` method. ([#7206](https://github.com/expo/expo/pull/7206) by [@bbarthec](https://github.com/bbarthec))
- **`expo-camera`**
Expand Down
10 changes: 3 additions & 7 deletions apps/native-component-list/src/components/CannyFooter.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { StyleSheet, Text, View, StyleProp, ViewStyle } from 'react-native';
import { Linking } from 'expo';
import * as Linking from 'expo-linking';

import Colors from '../constants/Colors';
import Button from './Button';
Expand All @@ -10,17 +10,13 @@ const cannyUrl = `https://expo.canny.io/feature-requests`;
export default class CannyFooter extends React.Component<{ style?: StyleProp<ViewStyle> }> {
onPress = () => {
Linking.openURL(cannyUrl);
}
};

render() {
return (
<View style={[styles.container, this.props.style]}>
<Text style={styles.text}>Missing something?</Text>
<Button
style={styles.button}
onPress={this.onPress}
title="Open a Canny!"
/>
<Button style={styles.button} onPress={this.onPress} title="Open a Canny!" />
</View>
);
}
Expand Down
Expand Up @@ -10,7 +10,7 @@ import {
View,
Alert,
} from 'react-native';
import { Linking } from 'expo';
import * as Linking from 'expo-linking';
import * as ImagePicker from 'expo-image-picker';
import * as Permissions from 'expo-permissions';
import * as Contacts from 'expo-contacts';
Expand Down Expand Up @@ -48,8 +48,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
IconComponent={Ionicons}
OverflowIcon={<Ionicons name="ios-more" size={23} color="blue" />}
iconSize={23}
color="blue"
>
color="blue">
<HeaderButtons.Item
title="share"
iconName="md-share"
Expand All @@ -71,7 +70,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
)}
</HeaderButtons>
),
})
});

readonly state: State = {};

Expand All @@ -83,7 +82,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
checkPermissionAsync = async () => {
const permission = await getPermissionAsync(Permissions.CONTACTS);
this.setState({ permission });
}
};

get id() {
const { params = {} } = this.props.navigation.state;
Expand All @@ -98,7 +97,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
// tslint:disable-next-line no-console
console.error(message);
}
}
};

loadAsync = async () => {
if (!this.state.permission) {
Expand All @@ -113,7 +112,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
});
// tslint:disable-next-line no-console
console.log(contact);
}
};

get jobTitle() {
const { contact } = this.state;
Expand Down Expand Up @@ -279,7 +278,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
// Do something here depending on the button index selected
}
);
}
};

_takePhoto = async () => {
const permission = await getPermissionAsync(Permissions.CAMERA);
Expand All @@ -294,7 +293,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
if (!result.cancelled) {
this._setNewPhoto(result.uri);
}
}
};

_setNewPhoto = async (uri: string) => {
// console.log(this.id, this.state.contact, uri);
Expand All @@ -309,7 +308,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
}

this.loadAsync();
}
};

_selectPhoto = async () => {
const permission = await getPermissionAsync(Permissions.CAMERA_ROLL);
Expand All @@ -324,11 +323,11 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
if (!result.cancelled) {
this._setNewPhoto(result.uri);
}
}
};

onPressItem = () => {
Alert.alert('item pressed');
}
};

renderListHeaderComponent = () => {
const { contact } = this.state;
Expand All @@ -340,8 +339,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
flex: 1,
alignItems: 'stretch',
backgroundColor: Colors.greyBackground,
}}
>
}}>
<View style={{ alignItems: 'center', marginBottom: 8 }}>
<ContactsAvatar
style={styles.image}
Expand All @@ -364,7 +362,7 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
</View>
</View>
);
}
};

renderListFooterComponent = () => (
<Text
Expand All @@ -376,11 +374,10 @@ export default class ContactDetailScreen extends React.Component<NavigationScree
justifyContent: 'center',
alignItems: 'center',
color: 'red',
}}
>
}}>
Delete Contact
</Text>
)
);

render() {
const { contact, permission } = this.state;
Expand Down Expand Up @@ -435,17 +432,14 @@ class LinkedButton extends React.PureComponent<{

onPress = () => {
Linking.openURL(`${this.props.format}:${this.props.uri}`);
}
};

render() {
const SIZE = 40;
const { color, backgroundColor } = this.colors;
const { text, icon } = this.props;
return (
<TouchableOpacity
disabled={!this.enabled}
onPress={this.onPress}
>
<TouchableOpacity disabled={!this.enabled} onPress={this.onPress}>
<View
style={{
width: SIZE,
Expand All @@ -457,8 +451,7 @@ class LinkedButton extends React.PureComponent<{
backgroundColor,
justifyContent: 'center',
alignItems: 'center',
}}
>
}}>
<Ionicons name={`ios-${icon}`} size={20} color={color} />
</View>
<Text style={{ fontSize: 10, color: backgroundColor, textAlign: 'center' }}>{text}</Text>
Expand Down
4 changes: 1 addition & 3 deletions packages/expo/build/Expo.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions packages/expo/build/Expo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo/build/Expo.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 7 additions & 18 deletions packages/expo/build/ExpoLazy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dcf36df

Please sign in to comment.