Curriculum
Course: Introduction to Expo
Login

Curriculum

Introduction to Expo

Text lesson

Lesson 3: Working with Expo Modules

Working with Expo Modules

  1. Expo.ImagePicker:

    • Allows users to pick images from their library or take new ones.
    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);
    }
    };

  2. Expo.SecureStore:

    • Stores sensitive data securely.
    import * as SecureStore from 'expo-secure-store';

    await SecureStore.setItemAsync('secure_key', 'some_value');
    const value = await SecureStore.getItemAsync('secure_key');

  3. Expo.Contacts:

    • Accesses and manages the device’s contacts.
    import * as Contacts from 'expo-contacts';

    const { status } = await Contacts.requestPermissionsAsync();
    if (status === 'granted') {
    const { data } = await Contacts.getContactsAsync({
    fields: [Contacts.Fields.Emails],
    });
    }

  4. Expo.Calendar:

    • Integrates with the device’s 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.

Layer 1
Login Categories
This website uses cookies and asks your personal data to enhance your browsing experience.