1

I'm attempting to use GL-REACT-NATIVE with expo to apply filter (Default presets) to images. I could manage to make it work with a default url from the package, 'https://i.imgur.com/5EOyTDQ.jpg' although I wan't to use it on my own urls from expo-images-picker, I'm receiving the current url from images picker: "ph://ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED", When I attempt to use this url on the uri field I get an error:

[Unhandled promise rejection: Error: Unable to download file: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=ph://ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED, NSErrorFailingURLKey=ph://ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED, _NSURLErrorRelatedURLSessionTaskErrorKey=(]

this is my code:

import React, { useState } from 'react';
import { CreateBar } from '../../components/CreateBar';
import { Container, ImageContainer, Image, FilterText, FilterContainer } from './styles';
import ImageFilters, { Presets, Constants } from 'react-native-gl-image-filters';
import { Surface } from 'gl-react-native';

// Translation
import i18n from 'i18n-js';
import { ScrollView, Text, View } from 'react-native';

export function Filters({ navigation, ...rest }: any) {
  console.log(rest);
  return (
    <Container>
      <CreateBar
        iconName="Filter"
        onPressIcon1={() => navigation.goBack()}
        onPressIcon2={() => console.log('forward')}
      />

      <ImageContainer>
        <Surface style={{ width: '100%', height: '100%' }}>
          <ImageFilters {...Constants.DefaultPresets[10].preset} width={300} height={300}>
            {{ uri: rest.route.params.images[0] }}
          </ImageFilters>
        </Surface>
      </ImageContainer>

      <FilterContainer>
        <FilterText>Filter</FilterText>
      </FilterContainer>
    </Container>
  );
}

I Had a look into this: https://github.com/ivpusic/react-native-image-crop-picker/issues/384#issuecomment-317628146 Although my image looks like this:

enter image description here

When it was supposed to look like:

enter image description here

Nilton Schumacher F
  • 814
  • 3
  • 13
  • 43

0 Answers0