joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 771 forks source link

possible unhandaled promise Rejection (id.9) #753

Closed birurana closed 2 years ago

birurana commented 2 years ago

import React, {useState} from 'react' import { StyleSheet, Text, View } from 'react-native'; import {TextInput, Button} from 'react-native-paper'

function ArticleEdit(props) {

const data = props.route.params.data;

const [title, setTitle] = useState(data.title)
const [description, setDescription] = useState(data.description)

const updateData = () => {
    fetch('http://192.168.1.35:8000/api/articles/${data.id}/' , {
        method:"PUT",
        headers:{
            'Content-Type':'application/json'
        },
        body:JSON.stringify({title:title, description})
    })
    .then(resp => resp.json())
    .then(data => {
        console.log(data)

    })

}
return (
    <View>
        <TextInput style = {styles.inputStyle}
            label = "Title"
            value = {title}
            mode = "outlined"cd

            onChangeText = {text => setTitle(text)}

        />
        <TextInput style = {{padding:10, margin:30, marginTop:1}}
            label = "Description"
            value = {description}
            mode = "outlined"
            multiline
            numberOfLines = {10}

            onChangeText = {text => setDescription(text)}
        />
        <Button style = {{margin:10}}
        icon = "update"
        mode = "contained"
        onPress = {() => updateData()}
        > Update Article </Button>
    </View>

)

} const styles = StyleSheet.create({ inputStyle:{ padding:10, margin:30

}

})

export default ArticleEdit

retyui commented 2 years ago

Hi @birurana This module is unmentionable ⚠️! please use fork: https://github.com/RonRadtke/react-native-blob-util

birurana commented 2 years ago

Thanks