Allow disabling of Google pay and Apple pay if needed.
Contributions are welcome!
npm install react-native-nfc-suppress
Update AndroidManifest.xml
<uses-permission android:name="android.permission.NFC" />
This library use native-modules, so you will need to do pod install for iOS:
cd ios && pod install && cd ..
import React from 'react';
import {
View,
Text,
Button,
} from 'react-native';
import { useNfcSuppressor } from 'react-native-nfc-suppress';
export const ExampleComponent= () => {
const { suppressed, supported, enabled, enable, disable } = useNfcSuppressor();
const switchSuppression = (): void => {
if (suppressed) {
disable();
} else {
enable();
}
};
return (
<View style={{display:'flex', flexDirection:'column'}}>
<Text>{`Is NFC enabled: ${supported}`}</Text>
<Text>{`Is NFC enabled: ${enabled}`}</Text>
<Text>{`Is enabled: ${suppressed}`}</Text>
<Button title="Switch" onPress={switchSuppression} />
<View>
)
}
Return boolean value. Channel NFC support state. Value updates on state change.
Return boolean value. Channel NFC state. Value updates on state change.
Return boolean value. Channel NFC suppresion state. Value updates on state change.
Return object. Expose all module functionality.