@expo/react-native-action-sheet
Advanced tools
Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "@expo/react-native-action-sheet", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "A cross-platform ActionSheet for React Native", | ||
"main": "build/index.js", | ||
"types": "build/index.d.ts", | ||
"react-native": "src/index.ts", | ||
"types": "lib/typescript/src/index.d.ts", | ||
"main": "lib/commonjs/index.js", | ||
"module": "lib/module/index.js", | ||
"files": [ | ||
"lib/", | ||
"src/" | ||
], | ||
"scripts": { | ||
"build": "expo-module build", | ||
"clean": "expo-module clean", | ||
"lint:prettier": "yarn prettier src/**/*.{ts,tsx} --write" | ||
"build": "bob build", | ||
"type-check": "tsc --noEmit", | ||
"lint": "eslint . --ext .ts,.tsx --fix", | ||
"fmt": "prettier --write \"{src,example}/**/*.{ts,tsx}\"" | ||
}, | ||
@@ -28,12 +35,42 @@ "repository": { | ||
"devDependencies": { | ||
"@types/react": "^16.8.8", | ||
"@types/react-native": "^0.57.41", | ||
"expo-module-scripts": "^1.0.0", | ||
"prettier": "^1.16.4", | ||
"react": "^16.8.4", | ||
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz" | ||
"@react-native-community/bob": "^0.6.1", | ||
"@react-native-community/eslint-config": "^0.0.5", | ||
"@types/react": "^16.8.23", | ||
"@types/react-native": "^0.57.65", | ||
"@typescript-eslint/eslint-plugin": "^1.12.0", | ||
"@typescript-eslint/parser": "^1.12.0", | ||
"eslint": "^6.0.1", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-prettier": "3.1.0", | ||
"husky": "^3.0.0", | ||
"lint-staged": "^9.2.0", | ||
"prettier": "^1.18.2", | ||
"react": "^16.8.6", | ||
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz", | ||
"typescript": "^3.5.3" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.3.0" | ||
}, | ||
"@react-native-community/bob": { | ||
"source": "src", | ||
"output": "lib", | ||
"targets": [ | ||
"commonjs", | ||
"module", | ||
"typescript" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts,tsx}": [ | ||
"yarn lint", | ||
"yarn fmt", | ||
"git add" | ||
] | ||
} | ||
} |
@@ -5,10 +5,16 @@ # react-native-action-sheet [![Slack](https://slack.expo.io/badge.svg)](https://slack.expo.io) | ||
| iOS | Android | Web | | ||
|---------------------------|---------------------------|---------------------------| | ||
| <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/ios.gif" width="200" height="400"/> | <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/android.gif" width="200" height="400"/> | <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/web.gif" width="300" height="400"/> | | ||
## Installation | ||
``` | ||
npm install @expo/react-native-action-sheet -S | ||
$ npm install @expo/react-native-action-sheet -S | ||
``` | ||
or | ||
``` | ||
yarn add @expo/react-native-action-sheet | ||
$ yarn add @expo/react-native-action-sheet | ||
``` | ||
@@ -18,5 +24,5 @@ | ||
### 1. import connectActionSheet function and connect your component which uses showActionSheetWithOptions. | ||
### 1. Connect your component which uses showActionSheetWithOptions. | ||
```es6 | ||
import { connectActionSheet } from '@expo/react-native-action-sheet'; | ||
import { connectActionSheet } from '@expo/react-native-action-sheet' | ||
@@ -32,3 +38,3 @@ class App extends React.Component { | ||
`App` component can access actionSheet method as `this.props.showActionSheetWithOptions` | ||
`App` component can access the actionSheet method as `this.props.showActionSheetWithOptions` | ||
@@ -55,7 +61,8 @@ ```es6 | ||
### 2. import ActionSheetProvider and wrap your top-level component with `<ActionSheetProvider />` | ||
### 2. Wrap your top-level component with `<ActionSheetProvider />` | ||
```es6 | ||
import { ActionSheetProvider } from '@expo/react-native-action-sheet'; | ||
import { ActionSheetProvider } from '@expo/react-native-action-sheet' | ||
class AppContainer extends React.Component { | ||
@@ -72,5 +79,2 @@ render() { | ||
## Web Setup | ||
WIP | ||
## Options | ||
@@ -129,9 +133,42 @@ | ||
See the [example app](https://github.com/expo/react-native-action-sheet/tree/master/example) for examples of how to apply different options. | ||
See the [example app](https://github.com/expo/react-native-action-sheet/tree/master/example). | ||
### Usage | ||
``` | ||
$ cd exmaple | ||
$ yarn | ||
$ cd example | ||
$ yarn | ||
// build simulator | ||
$ yarn ios | ||
$ yarn android | ||
// web | ||
$ yarn web | ||
``` | ||
## Development | ||
### Setup | ||
``` | ||
$ git clone git@github.com:expo/react-native-action-sheet.git | ||
$ cd react-native-action-sheet | ||
$ yarn install | ||
``` | ||
### Build | ||
We use [bob](https://github.com/react-native-community/bob). | ||
``` | ||
$ yarn build | ||
``` | ||
### Lint & Format | ||
``` | ||
// tsc | ||
$ yarn type-check | ||
// ESLint | ||
$ yarn lint | ||
// prettier | ||
$ yarn fmt | ||
``` |
import * as React from 'react'; | ||
import { ActionSheetOptions } from './types'; | ||
export type Context = { | ||
export interface Context { | ||
showActionSheetWithOptions: (options: ActionSheetOptions, callback: (i: number) => void) => void; | ||
}; | ||
} | ||
@@ -8,0 +8,0 @@ const { Provider, Consumer } = React.createContext<Context>({ |
@@ -16,3 +16,3 @@ import * as React from 'react'; | ||
export interface ActionSheetOptions extends ActionSheetIOSOptions { | ||
icons?: Array<React.ReactNode>; | ||
icons?: React.ReactNode[]; | ||
tintIcons?: boolean; | ||
@@ -19,0 +19,0 @@ textStyle?: TextStyle; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 4 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
56
168
133184
15
806
8