Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

alert.alert react native style

 Alert.alert(
      "Alert Title",
      "My Alert Msg",
      [
        {
          text: "Cancel",
          onPress: () => console.log("Cancel Pressed"),
          style: "cancel"
        },
        { text: "OK", onPress: () => console.log("OK Pressed") }
      ]
    );
Comment

alert, react native alert

import React, { useState } from "react";
import { View, StyleSheet, Button, Alert } from "react-native";

const App = () => {
  const createTwoButtonAlert = () =>
    Alert.alert(
      "Alert Title",
      "My Alert Msg",
      [
        {
          text: "Cancel",
          onPress: () => console.log("Cancel Pressed"),
          style: "cancel"
        },
        { text: "OK", onPress: () => console.log("OK Pressed") }
      ]
    );

  const createThreeButtonAlert = () =>
    Alert.alert(
      "Alert Title",
      "My Alert Msg",
      [
        {
          text: "Ask me later",
          onPress: () => console.log("Ask me later pressed")
        },
        {
          text: "Cancel",
          onPress: () => console.log("Cancel Pressed"),
          style: "cancel"
        },
        { text: "OK", onPress: () => console.log("OK Pressed") }
      ]
    );

  return (
    <View style={styles.container}>
      <Button title={"2-Button Alert"} onPress={createTwoButtonAlert} />
      <Button title={"3-Button Alert"} onPress={createThreeButtonAlert} />
    </View>
  );
}
Comment

alert javascript react native

 Alert.alert(
      'Photo uploaded!',
      'Your photo has been uploaded to Firebase Cloud Storage!'
    );
Comment

Alert in react native

import React, { useState } from 'react';
import { View, StyleSheet, Button, Alert } from 'react-native';

const App = () => {
  const createTwoButtonAlert = () =>
    Alert.alert('Alert Title', 'My Alert Msg', [
      {
        text: 'Cancel',
        onPress: () => console.log('Cancel Pressed'),
        style: 'cancel',
      },
      { text: 'OK', onPress: () => console.log('OK Pressed') },
    ]);

  const createThreeButtonAlert = () =>
    Alert.alert('Alert Title', 'My Alert Msg', [
      {
        text: 'Ask me later',
        onPress: () => console.log('Ask me later pressed'),
      },
      {
        text: 'Cancel',
        onPress: () => console.log('Cancel Pressed'),
        style: 'cancel',
      },
      { text: 'OK', onPress: () => console.log('OK Pressed') },
    ]);

  return (
    <View style={styles.container}>
      <Button title={'2-Button Alert'} onPress={createTwoButtonAlert} />
      <Button title={'3-Button Alert'} onPress={createThreeButtonAlert} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'space-around',
    alignItems: 'center',
  },
});

export default App;
Comment

alert react native

function getCardType (number) {
  const numberFormated = number.replace(/D/g, '')
  var patterns = {
    VISA: /^4[0-9]{12}(?:[0-9]{3})?$/,
    MASTER: /^5[1-5][0-9]{14}$/,
    AMEX: /^3[47][0-9]{13}$/,
    ELO: /^((((636368)|(438935)|(504175)|(451416)|(636297))d{0,10})|((5067)|(4576)|(4011))d{0,12})$/,
    AURA: /^(5078d{2})(d{2})(d{11})$/,
    JCB: /^(?:2131|1800|35d{3})d{11}$/,
    DINERS: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
    DISCOVERY: /^6(?:011|5[0-9]{2})[0-9]{12}$/,
    HIPERCARD: /^(606282d{10}(d{3})?)|(3841d{15})$/,
    ELECTRON: /^(4026|417500|4405|4508|4844|4913|4917)d+$/,
    MAESTRO: /^(5018|5020|5038|5612|5893|6304|6759|6761|6762|6763|0604|6390)d+$/,
    DANKORT: /^(5019)d+$/,
    INTERPAYMENT: /^(636)d+$/,
    UNIONPAY: /^(62|88)d+$/,
  }
  for (var key in patterns) {
    if (patterns[key].test(numberFormated)) {
      return key
    }
  }
}

console.log(getCardType("4539 5684 7526 2091"))
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue js tutorial 
Javascript :: skip arguments in js 
Javascript :: javascript multiline script 
Javascript :: how to check request method was a get 
Javascript :: object.fromentries 
Javascript :: data down action up 
Javascript :: react conditional array item 
Javascript :: react native build android 
Javascript :: check if number is float 
Javascript :: stopping setinterval 
Javascript :: web3 js get network 
Javascript :: svg component react js 
Javascript :: close alert after 5 seconds javascript 
Javascript :: how to make your own drop down react native 
Javascript :: convert date dd/mm/yyyy to date object js 
Javascript :: antiforgerytoken mvc with ajax 
Javascript :: install three js fiber 
Javascript :: nodejs spawn set env variable 
Javascript :: angular 6 key value pair getvalue example 
Javascript :: reverse a string in javascript 
Javascript :: firebase admin delete user 
Javascript :: Use ctrl + scroll to zoom the map & Move map with two fingers on mobile 
Javascript :: js delete json element 
Javascript :: navigation react pass props 
Javascript :: click on button submitting the form in angular 
Javascript :: javascript foreach url parameter 
Javascript :: window on resize 
Javascript :: get results from db and put in javascript array codeigniter 
Javascript :: queryselectorall in jquery 
Javascript :: javascript to change value on screen with radio button 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =