How to use the react-native-nfc-manager.isEnabled function in react-native-nfc-manager

To help you get started, we’ve selected a few react-native-nfc-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github whitedogg13 / react-native-nfc-manager / example / App.js View on Github external
console.warn('start fail', error);
                this.setState({supported: false});
            })

        if (Platform.OS === 'android') {
            NfcManager.getLaunchTagEvent()
                .then(tag => {
                    console.log('launch tag', tag);
                    if (tag) {
                        this.setState({ tag });
                    }
                })
                .catch(err => {
                    console.log(err);
                })
            NfcManager.isEnabled()
                .then(enabled => {
                    this.setState({ enabled });
                })
                .catch(err => {
                    console.log(err);
                })
            NfcManager.onStateChanged(
                event => {
                    if (event.state === 'on') {
                        this.setState({enabled: true});
                    } else if (event.state === 'off') {
                        this.setState({enabled: false});
                    } else if (event.state === 'turning_on') {
                        // do whatever you want
                    } else if (event.state === 'turning_off') {
                        // do whatever you want
github bailabs / tailpos / src / container / PaymentContainer / nfc_manager_initialization.js View on Github external
export function check_tagged_nfc_card(props, deviceId) {
  NfcManager.isEnabled().then(status => {
    if (status) {
      register_tag_event(props, deviceId);
    } else {
      showToastDanger("NFC is disabled");
    }
  });
}
github whitedogg13 / react-native-nfc-manager / example / AndroidTechTestNdef.js View on Github external
            .then(() => NfcManager.isEnabled())
            .then(enabled => this.setState({enabled}))
github whitedogg13 / react-native-nfc-manager / example / AndroidMifareClassic.js View on Github external
      .then(() => NfcManager.isEnabled())
      .then(enabled => this.setState({ enabled }))