Description:
in my React Native project. initially sets up TapPay using certain credentials (e.g., appId = 123, appKey = "aaa").
Later, after fetching new credentials from our API (e.g., appId = 456, appKey = "bbb"),
we call the setup method again via our custom hook, but the new values do not take effect. The getDirectPayPrime() call still uses the old configuration until the app is completely closed and reopened.
//useTapPay.ts
import { NativeModules } from 'react-native';
const { TapPay } = NativeModules;
export const useTapPay = ({ appId, appKey }: useTapPayParams) => {
const { setup } = TapPay;
useEffect(() => {
if (appId && appKey) {
console.log('Setting up TapPay with:', appId, appKey);
setup(appId, appKey, TAP_PAY_ENV);
}
}, [appId, appKey, setup]);
return { TapPay };
};
// App.tsx
...
const { TapPay } = useTapPay(...);
const result = await TapPay.getDirectPayPrime();
console.log('🚀 result:', result); // still old TapPay object until the app is completely closed and reopened.
env:
Xcode: 16.2
react-native:0.72
device : iphone13、14、15
TapPay SDK:
Description:
in my React Native project. initially sets up TapPay using certain credentials (e.g.,
appId = 123, appKey = "aaa").Later, after fetching new credentials from our API (e.g.,
appId = 456, appKey = "bbb"),we call the
setupmethod again via our custom hook, but the new values do not take effect. ThegetDirectPayPrime()call still uses the old configuration until the app is completely closed and reopened.env:
Xcode: 16.2
react-native:0.72
device : iphone13、14、15
TapPay SDK: