1.1.3 • Published 7 months ago

react-native-confirmation v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

react-native-confirmation

JavaScript TypeScript React Native Expo Yarn Git NPM Xcode

npm i react-native-confirmation
yarn add react-native-confirmation
import { useState } from "react";
import { Button, TextInput, Text } from "react-native"
import ConfirmationModal from "react-native-confirmation";

const App = () => {
  const [isVisible, setIsVisible] = useState(false);
  const [input, setInput] = useState("");
  const [text, setText] = useState("");

  const clearText = () => {
    setText("");
    console.log("Text cleared!")
  };

  return (
    <>
      <Button onPress={() => setIsVisible(true)} />
      <TextInput
          onChangeText={setInput}
          onSubmitEditing={() => setText(input)}
          value={input}
          placeholder="Message"
      />
      <Text>{text}</Text>
      <ConfirmationModal
        isVisible={isVisible}
        setIsVisible={setIsVisible}
        onConfirm={clearText}
      />
    </>
  );
};

export default App;

Simulator Screenshot - iPhone 13 mini - 2023-09-29 at 00 58 23 Simulator Screenshot - iPhone 13 mini - 2023-09-29 at 00 57 08 Simulator Screenshot - iPhone 13 mini - 2023-09-29 at 00 55 32 Simulator Screenshot - iPhone 13 mini - 2023-09-29 at 00 53 46

PropTypeDescriptionDefault
isVisibleboolBoolean state of the confirmation modalfalse
setIsVisibleisVisible: bool => void
onConfirm() => void | Promise < void >Pass in any function you'd like to run onConfirm press
secondaryOnConfirm?() => void | Promise < void >Pass a second function as another option you'd like to run on secondaryOnConfirm press
secondaryOnConfirmText?stringCustom secondary "confirm" text"Delete"
message?stringOptional message to display to users before asking them to "Confirm" or "Cancel"
onConfirmText?stringCustom "confirm" text"Confirm"
onConfirmTextColor?stringCustom "confirm" text color"rgb(227, 43, 44)"
cancelText?stringCustom "cancel" text"Cancel"
cancelTextColor?stringCustom "cancel" text color"rgb(56, 124, 254)"
colorScheme?"system" | "light" | "dark"Color scheme of the confirmation modal component"system"
1.1.1

7 months ago

1.1.0

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.0.15

8 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.0

11 months ago