How to use expo - 10 common examples

To help you get started, we’ve selected a few expo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / expo / v31 / expo-tests.tsx View on Github external
async () => {
    const appOwnerShip = Constants.appOwnership;
    const expoVersion = Constants.expoVersion;
    const installationId = Constants.installationId;
    const deviceId = Constants.deviceId;
    const deviceName = Constants.deviceName;
    const deviceYearClass = Constants.deviceYearClass;
    const isDevice = Constants.isDevice;
    const platform = Constants.platform;
    const sessionId = Constants.sessionId;
    const statusBarHeight = Constants.statusBarHeight;
    const systemFonts = Constants.systemFonts;
    const manifest = Constants.manifest;
    const linkingUri = Constants.linkingUri;
    const userAgent: string = await Constants.getWebViewUserAgentAsync();
};
// #endregion
github anpigon / rn_instagram_clone / App.js View on Github external
loadAssets = async() => {
		// Font Preloading
    await Font.loadAsync({
      Roboto: require("native-base/Fonts/Roboto.ttf"),
      Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
      'Sweet Sensations Persona Use': require('./assets/Sweet_Sensations_Persona_Use.ttf'),
      'Noto Sans KR': require('./assets/NotoSansKR-Regular.otf'),
      'Noto Sans KR Bold': require('./assets/NotoSansKR-Bold.otf'),
      'Noto Serif KR': require('./assets/NotoSerifKR-Regular.otf'),
      'Noto Serif KR Bold': require('./assets/NotoSerifKR-Bold.otf'),
    });

		// Images Preloading
    // await Asset.loadAsync([
    //   require("./assets/icon.png")
    // ])

    console.log('loadAssets complete!!!');
  }
github tenx-tech / stargazer / app / src / App.tsx View on Github external
async preloadAssets(): Promise {
    try {
      if (this.props.fontAssets) {
        // @ts-ignore - prop type should be correct I think the Expo type is wrong
        await Font.loadAsync(this.props.fontAssets);
      }
    } catch (err) {
      console.log(
        "Error fetching providing fontAssets - please check they match the expected format. Error:",
        err,
      );
    }

    try {
      await Asset.loadAsync(
        [require("./stargazer.png")].concat(this.props.imageAssets || []),
      );
    } catch (err) {
      console.log(
        "Error fetching providing imageAssets - please check they match the expected format. Error:",
        err,
      );
    }
  }
github BrightID / BrightID / brightID-expo / src / AppBootstrap.js View on Github external
bootstrapAsync = async () => {
    // bootstrap the application
    // async storage key 'userData' : {
    // userToken: String,
    // nameornym: String,
    // avatarUri: String
    // }

    try {
      // add user permssions
      const cam = await Permissions.getAsync(Permissions.CAMERA);
      const camr = await Permissions.getAsync(Permissions.CAMERA_ROLL);
      // console.warn(cam);
      // console.warn(camr);
      // load font
      await Font.loadAsync({
        EurostileRegular: require('../assets/fonts/EurostileRegular.ttf'),
        'ApexNew-Book': require('../assets/fonts/ApexNew-Book.otf'),
        'ApexNew-Medium': require('../assets/fonts/ApexNew-Medium.otf'),
        'ApexNew-Light': require('../assets/fonts/ApexNew-Light.otf'),
      });

      // load user data
      let userData = await AsyncStorage.getItem('userData');
      if (userData !== null) {
        userData = JSON.parse(userData);
        store.dispatch(setUpDefault(userData));
github blockmason / lndr-mobile / legacy-src / utils / SetupPushNotifications.js View on Github external
export async function registerForPushNotificationsAsync () {
  const { status: existingStatus } = await Permissions.getAsync(
    Permissions.NOTIFICATIONS
  )
  let finalStatus = existingStatus

  // only ask if permissions have not already been determined, because
  // iOS won't necessarily prompt the user a second time.
  if (existingStatus !== 'granted') {
    // Android remote notification permissions are granted during the app
    // install, so this will only ask on iOS
    const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS)
    finalStatus = status
  }

  // Stop here if the user did not grant permissions
  if (finalStatus !== 'granted') {
    console.log('Failed to grant')
    return
  }

  // Get the token that uniquely identifies this device
  let token = await Notifications.getExpoPushTokenAsync()

  // POST the token to your backend server from where you can retrieve it to send push notifications.
  return fetch(PUSH_ENDPOINT, {
    method: 'POST',
    headers: {
github jnancy / Eventry / eventry-app / screens / LoginScreen.js View on Github external
async _registerForPushNotificationsAsync() {
      const { status: existingStatus } = await Permissions.getAsync(
        Permissions.NOTIFICATIONS
      );
      let finalStatus = existingStatus;
    
      // only ask if permissions have not already been determined, because
      // iOS won't necessarily prompt the user a second time.
      if (existingStatus !== 'granted') {
        // Android remote notification permissions are granted during the app
        // install, so this will only ask on iOS
        const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
        finalStatus = status;
      }
    
      // Stop here if the user did not grant permissions
      if (finalStatus !== 'granted') {
        return;
      }
    
      // Get the token that uniquely identifies this device
      let token = await Notifications.getExpoPushTokenAsync();
      console.log("The auth key here " + this.state.Authkey);
      // POST the token to your backend server from where you can retrieve it to send push notifications.
      return fetch('http://eventry-dev.us-west-2.elasticbeanstalk.com/users/update_expo_token', {
        method: 'POST',
        headers: {
          'Authorization': "Token " + this.state.Authkey,
github EvanBacon / expo-firebase-tutorial / App.js View on Github external
async componentDidMount() {
    firebase.auth().onAuthStateChanged(auth => {
      if (!auth) {
        firebase.auth().signInAnonymously();
      }
      this.setState({ isSignedIn: !!auth });
    });



    //// WHATS AFTER THIS ........



    const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
    if (status !== 'granted') return;

    this.unsubscribe = firebase.messaging().onMessage(message => {
      console.log(message);
      alert('hey message');
    });

    const token = await firebase.iid().getToken();
    console.log({ token });
  }
github BrightID / BrightID / brightID-expo / src / AppBootstrap.js View on Github external
bootstrapAsync = async () => {
    // bootstrap the application
    // async storage key 'userData' : {
    // userToken: String,
    // nameornym: String,
    // avatarUri: String
    // }

    try {
      // add user permssions
      const cam = await Permissions.getAsync(Permissions.CAMERA);
      const camr = await Permissions.getAsync(Permissions.CAMERA_ROLL);
      // console.warn(cam);
      // console.warn(camr);
      // load font
      await Font.loadAsync({
        EurostileRegular: require('../assets/fonts/EurostileRegular.ttf'),
        'ApexNew-Book': require('../assets/fonts/ApexNew-Book.otf'),
        'ApexNew-Medium': require('../assets/fonts/ApexNew-Medium.otf'),
        'ApexNew-Light': require('../assets/fonts/ApexNew-Light.otf'),
      });

      // load user data
      let userData = await AsyncStorage.getItem('userData');
      if (userData !== null) {
        userData = JSON.parse(userData);
        store.dispatch(setUpDefault(userData));
      } else {
github EvanBacon / pro-chat / client / src / components / chat / Actions.js View on Github external
_pickImageAsync = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status !== 'granted') {
      this.setState({
        errorMessage: 'Permission to access photos was denied',
      });
      return null;
    }

    const result = await ImagePicker.launchImageLibraryAsync({
      allowsEditing: true,
      aspect: [4, 3],
    });

    console.log(result);

    if (!result.cancelled) {
      const storageUrl = await Fire.shared.uploadImageAsync(result.uri);
      console.log('local', result.uri, 'global', storageUrl);
      return storageUrl;
    }
    // Maybe do something

    return null;
  };
github BrightID / BrightID / brightID-expo / src / components / SignUp.js View on Github external
getAvatarPhoto = async () => {
    // expo version
    try {
      let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: 'Images',
        base64: true,
      });

      if (!result.cancelled) {
        this.setState({ avatarUri: result.uri });
      }
    } catch (err) {
      console.warn(err);
    }

    // for full documentation on the Image Picker api
    // see https://github.com/react-community/react-native-image-picker

    // const options = {
    //   title: 'Select Avatar',