How to use the react-native.Alert.alert function in react-native

To help you get started, we’ve selected a few react-native 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 syousif94 / frugalmaps / frugalapp / src / Notifications.js View on Github external
}

    const status = await checkPermission();

    if (status !== "granted") {
      return;
    }

    const notificationId = await createNotification(event);

    await AsyncStorage.setItem(id, notificationId);
    // await CalendarManager.toggleEvent(event, true);
    syncReminder(id, true);
    return true;
  } catch (error) {
    Alert.alert("Error", error.message);
    return;
  }
}
github BrightID / BrightID / BrightID / src / components / NewConnectionsScreens / actions / websocket.js View on Github external
const { ipAddress, channel } = getState().main.connectQrData;

    const socket = io.connect(`http://${ipAddress}`);

    socket.emit('join', channel);

    console.log(`Joined channel: ${channel}`);

    socket.on('signals', () => {
      console.log('signals');
      dispatch(fetchData());
    });

    return socket;
  } catch (err) {
    Alert.alert(err.message || 'Error', err.stack);
  }
};
github jaggerwang / zqc-app-demo / src / actions / bootstrap.js View on Github external
cbFail: () => {
        dispatch(actions.processingTask(''));
        let {location, network} = getState();
        let errors = [];
        if (network.isConnected === undefined) {
         errors.push('获取网络状态失败。'); 
        }
        if (!location.position) {
          errors.push('获取位置失败。');
        }
        if (errors.length > 0) {
          Alert.alert(
            '检测网络和位置出错',
            errors.join(''),
            [
              {text: '重试', onPress: () => dispatch(bootstrap({navigator}))},
            ],
          );
        } else if (!network.isConnected) {
          Alert.alert(
            '网络不可用',
            '请打开WIFI或移动网络后重试。',
            [
              {text: '重试', onPress: () => {
                dispatch(bootstrap({navigator}));
              }},
            ],
          );
github jitsi / jitsi-meet / react / features / settings / components / native / SettingsView.js View on Github external
_showURLAlert() {
        const { t } = this.props;

        Alert.alert(
            t('settingsView.alertTitle'),
            t('settingsView.alertURLText'),
            [
                {
                    onPress: () => this._urlField.focus(),
                    text: t('settingsView.alertOk')
                }
            ]
        );
    }
github AOSSIE-Org / CarbonFootprint-Mobile / app / containers / NotificationsModal.js View on Github external
removeFriend = (currentEmail, friendEmail, title) => {
        this.props.loaderToggle();
        Alert.alert(title, `Are you sure you want remove this ${title.toLowerCase()}?`, [
            {
                text: 'Yes',
                onPress: () =>
                    deleteFriend(currentEmail, friendEmail).then(user => {
                        this.props.loaderToggle();
                        this.props.getFriendList(this.props.choice);
                        Toast.show(`${title} Removed`);
                    })
            },
            {
                text: 'No',
                onPress: null
            }
        ]);
    };
github syousif94 / frugalmaps / buncha / components / ProfileView.js View on Github external
function logout({ dispatch, scrollTo }) {
  Alert.alert("Logout", "Are you sure?", [
    {
      text: "Cancel",
      style: "cancel"
    },
    {
      text: "OK",
      onPress: () => {
        dispatch(User.logout());
        scrollTo({ page: 0 });
      }
    }
  ]);
}
github ruddell / ignite-jhipster / boilerplate / app / modules / account / password-reset / forgot-password-screen.js View on Github external
componentDidUpdate(prevProps) {
    if (prevProps.fetching && !this.props.fetching) {
      if (this.props.error) {
        Alert.alert('Error', this.props.error, [{ text: 'OK' }])
      } else {
        Alert.alert('Success', 'Password reset email sent', [{ text: 'OK' }])
        Navigation.popToRoot(this.props.componentId)
      }
    }
  }
github shoutem / extensions / shoutem.cms / app / components / CurrentLocation / CurrentLocationBase.js View on Github external
promptForLocationPermission(message, confirmationMessage, onConfirmation) {
    const confirmOption = { text: confirmationMessage, onPress: onConfirmation };
    const cancelOption = { text: I18n.t(ext('cancelLocationPermissions')) };
    const alertOptions = [confirmOption, cancelOption];

    Alert.alert(
      I18n.t(ext('locationPermissionsPrompt')),
      message,
      alertOptions,
    );
  }
}
github NSWSESMembers / availability-poc / client / src / screens / burger / Root.js View on Github external
.then((update) => {
        if (update) {
          Alert.alert(
            'Update Available',
            `Version ${update.appVersion} (${(update.packageSize / 1024 / 1024).toFixed(2)}mb) is available for download`,
            [
              { text: 'Cancel', style: 'cancel' },
              { text: 'Install & Restart', onPress: this.installUpdate },
            ],
            { cancelable: false },
          );
        } else {
          Alert.alert('No updates available.');
        }
      });
  }
github wheatandcat / Peperomia / PeperomiaNative / src / components / organisms / Home / Cards.tsx View on Github external
const onDeleteAlert = ({ id }: ItemProps) => {
    Alert.alert(
      '削除しますか?',
      '',
      [
        {
          text: 'キャンセル',
          style: 'cancel',
        },
        {
          text: '削除する',
          onPress: () => {
            onDelete(id);
          },
        },
      ],
      { cancelable: false }
    );