How to use react-native-haptic-feedback - 10 common examples

To help you get started, we’ve selected a few react-native-haptic-feedback 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 BlueWallet / BlueWallet / screen / send / success.js View on Github external
async componentDidMount() {
    console.log('send/success - componentDidMount');
    ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
  }
github BlueWallet / BlueWallet / screen / lnd / scanLndInvoice.js View on Github external
constructor(props) {
    super(props);

    if (!BlueApp.getWallets().some(item => item.type === LightningCustodianWallet.type)) {
      ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
      alert('Before paying a Lightning invoice, you must first add a Lightning wallet.');
      props.navigation.dismiss();
    } else {
      let fromSecret;
      if (props.navigation.state.params.fromSecret) fromSecret = props.navigation.state.params.fromSecret;
      let fromWallet = {};

      if (!fromSecret) {
        const lightningWallets = BlueApp.getWallets().filter(item => item.type === LightningCustodianWallet.type);
        if (lightningWallets.length > 0) {
          fromSecret = lightningWallets[0].getSecret();
          console.warn('warning: using ln wallet index 0');
        }
      }

      for (let w of BlueApp.getWallets()) {
github BlueWallet / BlueWallet / screen / wallets / reorderWallets.js View on Github external
onChangeOrder={() => {
            ReactNativeHapticFeedback.trigger('impactMedium', { ignoreAndroidSystemSettings: false });
            this.setState({ hasMovedARow: true });
          }}
          onActivateRow={() => {
github iotaledger / trinity-wallet / src / mobile / src / ui / components / SeedPicker.js View on Github external
const { rows, aboveMidOnMove } = this.state;
        if (this.isMoving) {
            return;
        }
        if (dy > 0) {
            this.move(dy > this.index * scaleMultiplier ? this.index * scaleMultiplier : dy);
        } else {
            this.move(
                dy < (this.index - rows.length + 1) * scaleMultiplier
                    ? (this.index - rows.length + 1) * scaleMultiplier
                    : dy,
            );
        }
        if (this.middleHeight % scaleMultiplier >= scaleMultiplier / 2 && !aboveMidOnMove) {
            this.setState({ aboveMidOnMove: true });
            ReactNativeHapticFeedback.trigger('selection', false);
        }
        if (this.middleHeight % scaleMultiplier <= scaleMultiplier / 2) {
            this.setState({ aboveMidOnMove: false });
        }
    }
github rainbow-me / rainbow / src / components / animations / TouchableScale.js View on Github external
handleHaptic = () => {
    const { enableHapticFeedback, hapticType } = this.props;

    if (enableHapticFeedback) {
      ReactNativeHapticFeedback.trigger(hapticType);
    }
  };
github rainbow-me / rainbow / src / components / buttons / LongPressButton.js View on Github external
onTapHandlerStateChange = ({ nativeEvent }) => {
    const { disabled, onPress, onRelease } = this.props;

    if (nativeEvent.state === State.BEGAN) {
      if (disabled) {
        ReactNativeHapticFeedback.trigger('notificationWarning');

        timing(this.scale, {
          duration: 150,
          easing: Easing.inOut(Easing.ease),
          toValue: 0.975,
        }).start(() => {
          timing(this.scale, {
            duration: 150,
            easing: Easing.inOut(Easing.ease),
            toValue: 1,
          }).start();
        });
      } else {
        timing(this.scale, {
          duration: 150,
          easing: Easing.inOut(Easing.ease),
github rainbow-me / rainbow / src / components / contacts / showDeleteContactActionSheet.js View on Github external
async buttonIndex => {
      if (buttonIndex === 0) {
        removeContact(address);
        ReactNativeHapticFeedback.trigger('notificationSuccess');
        onDelete();
      }
    }
  );
github BlueWallet / BlueWallet / screen / wallets / details.js View on Github external
`This wallet has a balance. Before proceeding, please be aware that you will not be able to recover the funds without this wallet's seed phrase. In order to avoid accidental removal this wallet, please enter your wallet's balance of ${this.state.wallet.getBalance()} satoshis.`,
      true,
      'plain-text',
    );
    if (Number(walletBalanceConfirmation) === this.state.wallet.getBalance()) {
      this.props.navigation.setParams({ isLoading: true });
      this.setState({ isLoading: true }, async () => {
        BlueApp.deleteWallet(this.state.wallet);
        ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
        await BlueApp.saveToDisk();
        EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
        EV(EV.enum.WALLETS_COUNT_CHANGED);
        this.props.navigation.navigate('Wallets');
      });
    } else {
      ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
      this.setState({ isLoading: false }, async () => {
        alert("The provided balance amount does not match this wallet's balance. Please, try again");
      });
    }
  }
github BlueWallet / BlueWallet / screen / wallets / details.js View on Github external
async presentWalletHasBalanceAlert() {
    ReactNativeHapticFeedback.trigger('notificationWarning', { ignoreAndroidSystemSettings: false });
    const walletBalanceConfirmation = await prompt(
      'Wallet Balance',
      `This wallet has a balance. Before proceeding, please be aware that you will not be able to recover the funds without this wallet's seed phrase. In order to avoid accidental removal this wallet, please enter your wallet's balance of ${this.state.wallet.getBalance()} satoshis.`,
      true,
      'plain-text',
    );
    if (Number(walletBalanceConfirmation) === this.state.wallet.getBalance()) {
      this.props.navigation.setParams({ isLoading: true });
      this.setState({ isLoading: true }, async () => {
        BlueApp.deleteWallet(this.state.wallet);
        ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
        await BlueApp.saveToDisk();
        EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
        EV(EV.enum.WALLETS_COUNT_CHANGED);
        this.props.navigation.navigate('Wallets');
      });
github iotaledger / trinity-wallet / src / mobile / src / ui / components / Slider.js View on Github external
onCompleteSwipe() {
        ReactNativeHapticFeedback.trigger('impactLight', false);
        Animated.timing(this.state.sliderPosition, {
            toValue: this.props.channelWidth - this.props.channelHeight,
            duration: 50,
        }).start();
        if (this.props.numberOfSliders > 1) {
            this.setState((prevState) => ({ sliderNumber: prevState.sliderNumber + 1 }));
        }
        this.setState({ sliderColor: this.props.postSwipeColor, swipeComplete: true });
        this.sliderAnimation.play();
        timer.setTimeout(
            'delaySwipeSuccess',
            () => {
                Animated.timing(this.state.textOpacity, {
                    toValue: 1,
                    duration: 600,
                    easing: Easing.ease,

react-native-haptic-feedback

Basic haptic feedback for iOS and android

MIT
Latest version published 3 months ago

Package Health Score

74 / 100
Full package analysis

Popular react-native-haptic-feedback functions