How to suppress warning - Unhandled Promise Rejection

I'm testing my React Native app on an android simulator. I'm following the advice of a React Blog writer, Jim Sproch, to cancel setState with a rejected promise after calling cancel on the promise in componentWillUnmount. I modified the code slightly to accept a function and not a promise:

export const makeCancelableFunction = (fn) => {
    let hasCanceled = false;

    return {
        promise: (val) => new Promise((resolve, reject) => {
            if (hasCanceled) {
                reject({isCanceled: true});
            } else {
                fn(val);
                resolve(val);
            }
        }),
        cancel() {
            hasCanceled = true;
        }
    };
};

The parameter, fn, is a function that will set state. I get a warning message that way I use it, if and only if the promise is rejected from makeCancelableFunction:

Possible Unhandled Promise Rejection (id: 1):

Here is how I use the function:

    this.maybeSetHistory = makeCancelableFunction((results) => {
        this.setState({
            history: results,
        });
    });
/* code hidden */
        }).then((results) => {
            this.maybeSetHistory.promise(results);
        }).catch((reason) => {
            this.props.errorCallback(reason);
        });

I test the code as it is used in the promise chain by exiting the view immediately after navigating to the view. When the function, maybeSetHistory, is called the warning message appears. I clearly don't want this to happen on actual phones.

I have tried the suggested code which takes and wraps a parameter of type, Promise. I have tried to toggle production mode, then restarting the phone emulator app, Expo by swiping the Expo app away on the emulator, toggling the mode to production on Packager, then press a for Android emulation. When production is the mode of Packager; nonetheless, the warning appears. Is there a way to suppress this particular warning message? Should I be concerned? Am I handling Promise rejections incorrectly?