rntpc_react-native-dropdownalert:基于 React Native 的下拉通知提示组件项目

用户可通过该项目在 React Native 应用中实现通知提示功能,支持错误等多种类型,可通过按压、取消等多种方式关闭,支持自定义或构建自己的提示样式。【此简介由AI生成】

分支4Tags1
文件最后提交记录最后更新时间
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Change success icon to sun from checkmark circle; 9 年前
implement alert position bottom (#302) * implement alert position bottom In doing so, opportunity to correct onMoveShouldSetPanResponder to be based on panResponderEnabled hence eliminates need for panResponderMoveDistance prop. This was based on: "Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?" for this case yes when enabled. https://reactnative.dev/docs/gesture-responder-system#responder-lifecycle * update readme support * update demo gif2 年前
implement alert position bottom (#302) * implement alert position bottom In doing so, opportunity to correct onMoveShouldSetPanResponder to be based on panResponderEnabled hence eliminates need for panResponderMoveDistance prop. This was based on: "Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?" for this case yes when enabled. https://reactnative.dev/docs/gesture-responder-system#responder-lifecycle * update readme support * update demo gif2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
implement alert position bottom (#302) * implement alert position bottom In doing so, opportunity to correct onMoveShouldSetPanResponder to be based on panResponderEnabled hence eliminates need for panResponderMoveDistance prop. This was based on: "Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?" for this case yes when enabled. https://reactnative.dev/docs/gesture-responder-system#responder-lifecycle * update readme support * update demo gif2 年前
Update license year 5 年前
fix:处理上游代码静态检查oat问题 Signed-off-by: tangshutong <tangshutong3@h-partners.com> 1 个月前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
implement alert position bottom (#302) * implement alert position bottom In doing so, opportunity to correct onMoveShouldSetPanResponder to be based on panResponderEnabled hence eliminates need for panResponderMoveDistance prop. This was based on: "Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?" for this case yes when enabled. https://reactnative.dev/docs/gesture-responder-system#responder-lifecycle * update readme support * update demo gif2 年前
update testing suite and snapshots 6 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前
5.1.0 2 年前
Refactor functional typescript component (#301) * upgrade example to latest react-native * refactor DropdownAlert to functional typescript component and add first test * use function instead of arrows; fix onCancel * rename alert to alertWithType; add test ids; implement promises * test render functions and onLayout; consolidate touchable opacity style * implement Notification child components and reorganize example list * implement children prop, action callbacks and rename props * upgrade example to react-native 0.72.3 * rename DropdownAlert test file; upgrade dev deps; fix prettier issues * update README and package json * fix test cases where state changes not wrapped in act function * fix setTimeout return type * fix timeout not clearing * refactor example ListItem, NotificationAndriod and NotificationIOS * Update demo and add using children prop to readme * implement Queue test * fix rename of example folder * reinstate caveats in readme2 年前

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

项目介绍

用户可通过该项目在 React Native 应用中实现通知提示功能,支持错误等多种类型,可通过按压、取消等多种方式关闭,支持自定义或构建自己的提示样式。【此简介由AI生成】

定制我的领域

下载使用量

0

项目总下载次数(含Clone、Pull、 zip 包及 release 下载),每日凌晨更新

语言类型

TSX67.51%
TypeScript11.5%
Java11.18%
Objective-C3.5%
Ruby3.48%