MCPcopy
hub / github.com/testshallpass/react-native-dropdownalert

github.com/testshallpass/react-native-dropdownalert @v5.2.0 sqlite

repository ↗ · DeepWiki ↗ · release v5.2.0 ↗
47 symbols 97 edges 12 files 0 documented · 0%
README

react-native-dropdownalert

Platform npm version npm version License CI

screenshot

Table of contents

An alert to notify users about an error or something else. It can be dismissed by press, cancel, automatic, pan gesture or programmatic. It can be customized and/or you can build your own alert (BYOA) - see DropdownAlertProps on what's available.

Installation

  • yarn add react-native-dropdownalert
  • npm i react-native-dropdownalert --save

Usage

import the library

import DropdownAlert, {
  DropdownAlertData,
  DropdownAlertType,
} from 'react-native-dropdownalert';

create an alert promise function variable

let alert = (_data: DropdownAlertData) => new Promise<DropdownAlertData>(res => res);

add the component as the last component in the document tree so it overlaps other UI components and set alert prop with alert function

<DropdownAlert alert={func => (alert = func)} />

invoke alert

const alertData = await alert({
  type: DropdownAlertType.Error,
  title: 'Error',
  message: 'Something went wrong.',
});

Support

react minium version react-native minium version package version reason
v16.8.0 v0.61.0 v5.0.0 use react hooks
v16.0.0 v0.50.0 v3.2.0 use SafeAreaView
v16.0.0-alpha.6 v0.44.0 v2.12.0 use ViewPropTypes

Using children prop

Option 1 pass child component(s) like so:

<DropdownAlert>{/* insert child component(s) */}</DropdownAlert>

Option 2 pass child component(s) like so:

<DropdownAlert children={/* insert child component(s) */} />

Either way DropdownAlert will render these instead of the pre-defined child components when alert is invoked. Check out the iOS and Android notifications in example project.

Caveats

  • Modals can overlap `DropdownAlert`` if it is not inside the modal's document tree.
  • It is important you place the DropdownAlert below the StackNavigator.

Inspired by: RKDropdownAlert

Extension points exported contracts — how you extend this code

ListItem (Interface)
(no doc)
example/App.tsx

Core symbols most depended-on inside this repo

_dismiss
called by 5
DropdownAlert.tsx
enqueue
called by 2
Queue.ts
dequeue
called by 2
Queue.ts
_onDonePan
called by 2
DropdownAlert.tsx
_alert
called by 2
DropdownAlert.tsx
_updateStatusBar
called by 2
DropdownAlert.tsx
_clearDismissTimeoutID
called by 2
DropdownAlert.tsx
_animate
called by 2
DropdownAlert.tsx

Shape

Function 32
Enum 6
Method 6
Class 2
Interface 1

Languages

TypeScript100%

Modules by API surface

DropdownAlert.tsx25 symbols
Queue.ts8 symbols
__tests__/DropdownAlert.test.tsx5 symbols
example/NotificationAndroid.tsx4 symbols
example/App.tsx4 symbols
example/NotificationIOS.tsx1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/core7.25.2 · 1×
@react-native/babel-preset0.79.2 · 1×
@react-native/eslint-config0.79.2 · 1×
@react-native/metro-config0.79.2 · 1×
@react-native/typescript-config0.79.2 · 1×
@testing-library/react-native13.2.0 · 1×
@types/jest29.5.14 · 1×
@types/react19.0.0 · 1×
@types/react-test-renderer19.0.0 · 1×
babel-jest29.7.0 · 1×
eslint8.57.1 · 1×
expo53.0.9 · 1×

For agents

$ claude mcp add react-native-dropdownalert \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact