Possible Unhandled Promise Rejection (id: 0)

I’m trying to implement the simple sharing

import Share, {ShareSheet, Button} from 'react-native-share';

<TouchableHighlight onPress={() => {
     Share.open({
        title: "React Native",
        message: "Hola mundo",
        url: "http://facebook.github.io/react-native/"
      })
}}>
      <Text> Share </Text>
</TouchableHighlight>

But I got this error:

09-07 11:07:45.829 3037 5393 W ReactNativeJS: Possible Unhandled Promise Rejection (id: 0):
09-07 11:07:45.829 3037 5393 W ReactNativeJS: undefined is not an object (evaluating ‘_reactNative.NativeModules.RNShare.open’)

Any advice ?

1 possible answer(s) on “Possible Unhandled Promise Rejection (id: 0)

Possible Unhandled Promise Rejection (id:0)

Hey Team,

I get this yellow box:

Possible Unhandled Promise Rejection (id: 0):
Already read
TypeError: Already read
    at consumed (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:12146:23)
    at Response.Body.text (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:12237:14)
    at _class._onRegisterPressed$ (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:73490:940)
    at tryCatch (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10389:30)
    at GeneratorFunctionPrototype.invoke [as _invoke] (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10665:12)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10422:13)
    at tryCatch (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10389:30)
    at invoke (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10465:12)
    at http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10473:1
    at tryCallOne (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:6407:8)

How can I fix this? I’m doing a server request inside a try catch block. Everything is working fine. I’m not getting any errors from my server, only this yellow box appears.

Thank you a lot for this great framework!

albo1337

3 thoughts on “Possible Unhandled Promise Rejection (id:0)

  1. Yep, that error happens when body has been already consumed.

    To have a bit of spec-fun:

    The json() method, when invoked, must return the result of running consume body with JSON.

    and…

    Objects implementing the Body mixin also have an associated consume body algorithm, given a type, runs these steps:

    1. If this object is disturbed or locked, return a new promise rejected with a TypeError.

    Simply said, the following is likely to produce such error:

    fetch('http://google.com').then(res => {
      return res.json().then(
         () => res.json() // this will throw
      );
    });

Possible Unhandled Promise Rejection (id: 0)

I’m trying to implement the simple sharing

import Share, {ShareSheet, Button} from 'react-native-share';

<TouchableHighlight onPress={() => {
     Share.open({
        title: "React Native",
        message: "Hola mundo",
        url: "http://facebook.github.io/react-native/"
      })
}}>
      <Text> Share </Text>
</TouchableHighlight>

But I got this error:

09-07 11:07:45.829 3037 5393 W ReactNativeJS: Possible Unhandled Promise Rejection (id: 0):
09-07 11:07:45.829 3037 5393 W ReactNativeJS: undefined is not an object (evaluating ‘_reactNative.NativeModules.RNShare.open’)

Any advice ?

1 possible answer(s) on “Possible Unhandled Promise Rejection (id: 0)

Possible Unhandled Promise Rejection (id:0)

Hey Team,

I get this yellow box:

Possible Unhandled Promise Rejection (id: 0):
Already read
TypeError: Already read
    at consumed (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:12146:23)
    at Response.Body.text (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:12237:14)
    at _class._onRegisterPressed$ (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:73490:940)
    at tryCatch (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10389:30)
    at GeneratorFunctionPrototype.invoke [as _invoke] (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10665:12)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10422:13)
    at tryCatch (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10389:30)
    at invoke (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10465:12)
    at http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:10473:1
    at tryCallOne (http://10.10.1.227:8081/index.ios.bundle?platform=ios&dev=true:6407:8)

How can I fix this? I’m doing a server request inside a try catch block. Everything is working fine. I’m not getting any errors from my server, only this yellow box appears.

Thank you a lot for this great framework!

albo1337

2 thoughts on “Possible Unhandled Promise Rejection (id:0)