All Projects → qfight → react-native-actionsheet-api

qfight / react-native-actionsheet-api

Licence: MIT License
React Native API Andorid polyfill

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-actionsheet-api

ImageActionSheet
iOS Native style action sheet like in Whatsapp with the option of showing icons. It is a complete implementation and does not use any private api of UIKit.
Stars: ✭ 20 (+11.11%)
Mutual labels:  actionsheet, actionsheetios
actionsheet-android
iPad-style ActionSheet for Android
Stars: ✭ 21 (+16.67%)
Mutual labels:  actionsheet, action-sheet
Sdcalertview
The little alert that could
Stars: ✭ 1,768 (+9722.22%)
Mutual labels:  actionsheet
react-native-wxui
A UI package for React Native
Stars: ✭ 21 (+16.67%)
Mutual labels:  actionsheet
vue2-dialog
A mobile Vue plugin for VueDialog
Stars: ✭ 21 (+16.67%)
Mutual labels:  actionsheet
Tfpopup
🚀🚀🚀TFPopup不生产弹框,它只是弹框的弹出工🚀🚀🚀默认支持多种动画方式一行调用,支持完全自定义动画.
Stars: ✭ 182 (+911.11%)
Mutual labels:  actionsheet
ActionSheet
Android中的ActionSheet(仿IOS ui界面)
Stars: ✭ 17 (-5.56%)
Mutual labels:  actionsheet
Overlaycontroller
OverlayController easily pop your custom view and provide optional transition animation. written in swift 5.0
Stars: ✭ 94 (+422.22%)
Mutual labels:  actionsheet
iakit
无依赖 mini 组件库,只封装了 alert, toast, loading, actionSheet 等使用频率较高的组件。适用于类似 H5 活动页的简单移动端项目,不必为了使用这些组件而引入一个大而全的 UI 库和框架。
Stars: ✭ 38 (+111.11%)
Mutual labels:  actionsheet
react-native-custom-actionsheet
📜 Cross platform custom ActionSheet
Stars: ✭ 47 (+161.11%)
Mutual labels:  action-sheet
AlertKit
🚨 SwiftUI alerts (and action sheets) done right
Stars: ✭ 60 (+233.33%)
Mutual labels:  actionsheet
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (+1244.44%)
Mutual labels:  actionsheet
SheetyColors
An action sheet styled color picker for iOS.
Stars: ✭ 101 (+461.11%)
Mutual labels:  actionsheet
Toactionsheet
A custom-designed reimplementation of the UIActionSheet control for iOS
Stars: ✭ 175 (+872.22%)
Mutual labels:  actionsheet
CWActionSheet
模仿微信ActionSheet
Stars: ✭ 47 (+161.11%)
Mutual labels:  actionsheet
Zhpopupcontroller
Help you pop up custom views easily. and support pop-up animation, layout position, mask effect and gesture interaction etc.
Stars: ✭ 1,481 (+8127.78%)
Mutual labels:  actionsheet
LGApplications
个人小demo集合:①ActionSheet; ②PickerView; ③ScrollView嵌套; ④渐变文字Label; ⑤tableView实现单选;
Stars: ✭ 36 (+100%)
Mutual labels:  actionsheet
HJCActionSheet
Like Wechat ActionSheet Demo
Stars: ✭ 12 (-33.33%)
Mutual labels:  actionsheet
TezActionSheet
Custom singleton actionSheet with block completion.
Stars: ✭ 18 (+0%)
Mutual labels:  actionsheet
react-native-general-actionsheet
ActionSheet api on iOS and Android same as ActionSheetIOS.
Stars: ✭ 23 (+27.78%)
Mutual labels:  actionsheet

react-native-actionsheet-api

提供Android和iOS平台通用的的showActionSheetWithOptions()API。统一使用ActionSheet。调用时,如果是iOS,调用ActionSheetIOS.showActionSheetWithOptions()

Why react-native-actionsheet-api

IOS有ActionSheetIOS.showActionSheetWithOptions(),但是在Android中没有这个方法可以使用, 虽然在Android中使用ActionSheet有人会感觉很别扭,但是有时候确实需要使用(可以把样式改成Android风格的)。

当我们必须要使用ActionSheet,并且希望跟IOS一样,通过API调用来展示,而不是每次通过渲染一个组件来展示, 基本上就是提供Native提供组件,比如react-native-actionsheet-native,但是需要导入Native代码,而我不希望导入,所以开发出这个组件。

提示:这个组件并不完美,使用之前,需要先在页面中渲染一次(创建一个实例)

ScreenShot

IOS效果:

IOS

Android效果:

Android

Useage

Step 0: 安装

npm install react-native-actionsheet-api --save

Step 1: 引入

import ActionSheet from 'react-native-actionsheet-api';

Step 2: 实例化

一般选择在使用之前实例化ActionSheet,但是只需要实例化一次

// 在页面中渲染
class MyPage extends React.component {
    // ...

    render(){
        return (
            <View>
                {/* 只需要实例化一次 */}
                <ActionSheet />
                {/* ... */}
            </View>
        )
    }
}

Step 3: 调用

// 然后在任何地方,都可以使用直接调用这个方法了
// IOS和Android都可以使用下面的代码
ActionSheet.showActionSheetWithOptions({
      title: '请选择您最喜欢的水果',
      options: ['苹果🍎', '梨🍐', '香蕉🍌', '橘子🍊', '都不喜欢'],
      cancelButtonIndex: 4,
      //destructiveButtonIndex: 0,
      tintColor: 'green',
    },
    (buttonIndex) => {
      this.setState({ clicked: BUTTONS[buttonIndex] });
    }
);

License

这个项目采用MIT协议 - 详细信息请查看LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].