17 lines
532 B
TypeScript
17 lines
532 B
TypeScript
// Metro module 6669 (f6670).
|
|
import { useState, useEffect } from "react";
|
|
import Dispatcher from "../../../../Dispatcher";
|
|
export default function useToggleOnIAPSuccess() {
|
|
const toggleFlip2 = function toggleFlip() {
|
|
setState((prevState) => !prevState);
|
|
};
|
|
const [state, setState] = useState(false);
|
|
useEffect(() => {
|
|
Dispatcher.subscribe("IAP_PURCHASE_PRODUCT_SUCCESS", toggleFlip2);
|
|
return () => {
|
|
Dispatcher.unsubscribe("IAP_PURCHASE_PRODUCT_SUCCESS", toggleFlip2);
|
|
};
|
|
}, []);
|
|
return state;
|
|
};
|