diff options
| -rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 21 | 
1 files changed, 10 insertions, 11 deletions
| diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index 9a5cfb93..fd51c84f 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -1,22 +1,15 @@ -import React, {useState} from 'react'; -import {StyleSheet, View, Image, Alert} from 'react-native'; +import React from 'react'; +import {StyleSheet, View, Image, Alert, Text, Platform} from 'react-native';  import {Button} from 'react-native-elements';  import {SearchBackground, TabsGradient, TaggBigInput} from '../../components';  import {SCREEN_HEIGHT, SCREEN_WIDTH, StatusBarHeight} from '../../utils';  import AsyncStorage from '@react-native-community/async-storage'; -import {UserType} from '../../types';  import {RouteProp} from '@react-navigation/native';  import {ProfileStackParams} from 'src/routes';  import {StackNavigationProp} from '@react-navigation/stack';  import {CaptionScreenHeader} from '../../components/';  import {MOMENTS_ENDPOINT} from '../../constants';  import {AuthContext} from '../../routes/authentication'; - -const NO_USER: UserType = { -  userId: '', -  username: '', -}; -  /**   * Upload Screen to allow users to upload posts to Tagg   */ @@ -55,15 +48,21 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {      try {        const request = new FormData();        const uri = image.path; -      const name = image.filename; +      var fileName = image.filename; + +      //Manipulating filename to end with .jpg instead of .heic +      if (fileName.endsWith('.heic') || fileName.endsWith('.HEIC')) { +        fileName = fileName.split('.')[0] + '.jpg'; +      }        request.append('image', {          uri: uri, -        name: name, +        name: fileName,          type: 'image/jpg',        });        request.append('moment', title);        request.append('user_id', userId);        request.append('captions', JSON.stringify({image: caption})); +        const token = await AsyncStorage.getItem('token');        let response = await fetch(MOMENTS_ENDPOINT, {          method: 'POST', | 
