Working with Expo Modules
Expo.ImagePicker:
import * as ImagePicker from 'expo-image-picker';
const pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
});
if (!result.cancelled) {
setImage(result.uri);
}
};
Expo.SecureStore:
import * as SecureStore from 'expo-secure-store';
await SecureStore.setItemAsync('secure_key', 'some_value');
const value = await SecureStore.getItemAsync('secure_key');
Expo.Contacts:
import * as Contacts from 'expo-contacts';
const { status } = await Contacts.requestPermissionsAsync();
if (status === 'granted') {
const { data } = await Contacts.getContactsAsync({
fields: [Contacts.Fields.Emails],
});
}
Expo.Calendar:
import * as Calendar from 'expo-calendar';
const createCalendar = async () => {
const { status } = await Calendar.requestCalendarPermissionsAsync();
if (status === 'granted') {
const calendars = await Calendar.getCalendarsAsync();
}
};
Conclusion: Using Expo modules effectively allows you to add advanced features to your app with minimal effort. Understanding these modules is key to leveraging the full potential of the Expo SDK.