Compare commits

...
20 Commits
Author SHA1 Message Date
semantic-release-bot fe8c66dd0b chore(release): 3.6.0 [skip ci]
# [3.6.0](https://github.com/expo/react-native-action-sheet/compare/v3.5.0...v3.6.0) (2020-03-30)

### Bug Fixes

* Android 'Super expression must either be null or a function' ([37156da](https://github.com/expo/react-native-action-sheet/commit/37156dacf114aa5146da153db9ee00c1aea8eaca))

### Features

* Add accessibility label to Action options ([#158](https://github.com/expo/react-native-action-sheet/issues/158)) ([bc3c27d](https://github.com/expo/react-native-action-sheet/commit/bc3c27d767a5657032b73f70aa1aacfea0481f66))
2020-03-30 08:29:47 -05:00
David Smith bc3c27d767 feat: Add accessibility label to Action options (#158)
* Add accessibility Label to Action options

* Commit Build

* Revert "Commit Build"

This reverts commit 9d891a6d3a.
2020-03-30 08:11:06 -05:00
Brad Bumbalough 33c7d9301c Merge pull request #160 from jdmunro/clarify-docs
Clarify setup documentation
2020-03-30 08:10:30 -05:00
Brad Bumbalough b20bf029ee Merge pull request #162 from Mitch528/fix-android
Fix Android 'Super expression must either be null or a function'
2020-03-30 08:09:36 -05:00
Mitchell Kutchuk 37156dacf1 fix: Android 'Super expression must either be null or a function' 2020-03-26 16:26:39 -07:00
James Munro 0d98570861 Update README.md 2020-03-14 16:06:11 +00:00
dependabot[bot] 6fe293d4e2 Bump acorn from 6.2.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.2.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.2.0...6.4.1)

Signed-off-by: dependabot[bot] <[email protected]>
2020-03-13 16:27:46 -07:00
semantic-release-bot ead0ed7dc1 chore(release): 3.5.0 [skip ci]
# [3.5.0](https://github.com/expo/react-native-action-sheet/compare/v3.4.1...v3.5.0) (2020-02-04)

### Features

* add anchor option for iPads ([#155](https://github.com/expo/react-native-action-sheet/issues/155)) ([370e6e8](https://github.com/expo/react-native-action-sheet/commit/370e6e855fbacbfc683cc6ab16304f26c159e6b5))
2020-02-04 06:13:09 -06:00
Brad Bumbalough 27cef1a658 Merge pull request #157 from expo/chore/ipad-example
chore: ipad anchor in example app
2020-02-04 06:07:22 -06:00
Brad Bumbalough bfae6b4ebc chore: update readme with anchor option 2020-02-04 06:03:58 -06:00
Brad Bumbalough eecc79ffb0 chore: update example app with iPad anchor 2020-02-04 06:03:49 -06:00
Kashish Grover 370e6e855f feat: add anchor option for iPads (#155) 2020-02-04 05:54:18 -06:00
Brad Bumbalough 6fa494f9de Merge pull request #156 from expo/chore/remove-gh-action
chore: remove github actions
2020-02-04 05:53:25 -06:00
Brad Bumbalough fc86afb87e chore: remove github actions 2020-02-04 05:52:30 -06:00
Evan Bacon 40aee02227 Update README.md 2019-12-31 23:08:24 -08:00
Brad Bumbalough ac6f9f6ccd chore: cleanup changelog file 2019-12-13 07:50:40 -06:00
semantic-release-bot 0131ebbb44 chore(release): 3.4.1 [skip ci]
## [3.4.1](https://github.com/expo/react-native-action-sheet/compare/v3.4.0...v3.4.1) (2019-12-13)

### Bug Fixes

* **iOS:** crash when using Android only options ([#144](https://github.com/expo/react-native-action-sheet/issues/144)) ([8016008](https://github.com/expo/react-native-action-sheet/commit/8016008781cbe418dc03f04a324d5e5ef5bcdaa7))
2019-12-13 07:46:57 -06:00
Brad Bumbalough 0627e77fba Merge pull request #148 from expo/chore/changelog
chore: commit changelog when releasing
2019-12-13 07:46:06 -06:00
Brad Bumbalough d114cfb321 chore: commit changelog when releasing 2019-12-13 07:43:56 -06:00
Hashir Ch 8016008781 fix(iOS): crash when using Android only options (#144) 2019-12-13 07:15:56 -06:00
12 changed files with 3443 additions and 117 deletions

No files matched your search

-27
View File
@@ -1,27 +0,0 @@
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: yarn
- name: Type check
run: npm run type-check
- name: Lint
run: npm run lint
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
+13 -1
View File
@@ -2,7 +2,19 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "package.json"]
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
+34
View File
@@ -1 +1,35 @@
# Changelog
# [3.6.0](https://github.com/expo/react-native-action-sheet/compare/v3.5.0...v3.6.0) (2020-03-30)
### Bug Fixes
* Android 'Super expression must either be null or a function' ([37156da](https://github.com/expo/react-native-action-sheet/commit/37156dacf114aa5146da153db9ee00c1aea8eaca))
### Features
* Add accessibility label to Action options ([#158](https://github.com/expo/react-native-action-sheet/issues/158)) ([bc3c27d](https://github.com/expo/react-native-action-sheet/commit/bc3c27d767a5657032b73f70aa1aacfea0481f66))
# [3.5.0](https://github.com/expo/react-native-action-sheet/compare/v3.4.1...v3.5.0) (2020-02-04)
### Features
* add anchor option for iPads ([#155](https://github.com/expo/react-native-action-sheet/issues/155)) ([370e6e8](https://github.com/expo/react-native-action-sheet/commit/370e6e855fbacbfc683cc6ab16304f26c159e6b5))
## [3.4.1](https://github.com/expo/react-native-action-sheet/compare/v3.4.0...v3.4.1) (2019-12-13)
### Bug Fixes
* **iOS:** crash when using Android only options ([#144](https://github.com/expo/react-native-action-sheet/issues/144)) ([8016008](https://github.com/expo/react-native-action-sheet/commit/8016008781cbe418dc03f04a324d5e5ef5bcdaa7))
# [3.4.0](https://github.com/expo/react-native-action-sheet/compare/v3.3.2...v3.4.0) (2019-11-19)
### Features
* **android:** allow customizing container styles ([#142](https://github.com/expo/react-native-action-sheet/issues/142)) ([39fc431](https://github.com/expo/react-native-action-sheet/commit/39fc431c97cb0ec03ab2a8386bd1b836d9f1cd2f))
* Allow pointerEvents prop to pass through to containing view ([#124](https://github.com/expo/react-native-action-sheet/issues/124)) ([76397fa](https://github.com/expo/react-native-action-sheet/commit/76397fa7c4bff7318780ac72600156d753fad3f0))
+28 -19
View File
@@ -23,7 +23,24 @@ $ yarn add @expo/react-native-action-sheet
## A basic ActionSheet Setup
### 1. Connect your component which uses showActionSheetWithOptions.
### 1. Wrap your top-level component with `<ActionSheetProvider />`
```es6
import { ActionSheetProvider } from '@expo/react-native-action-sheet'
class AppContainer extends React.Component {
render() {
return (
<ActionSheetProvider>
<ConnectedApp />
</ActionSheetProvider>
);
}
}
```
### 2. Connect your component which uses showActionSheetWithOptions.
```es6
import { connectActionSheet } from '@expo/react-native-action-sheet'
@@ -69,33 +86,25 @@ export default function App () {
}
```
### 2. Wrap your top-level component with `<ActionSheetProvider />`
```es6
import { ActionSheetProvider } from '@expo/react-native-action-sheet'
class AppContainer extends React.Component {
render() {
return (
<ActionSheetProvider>
<ConnectedApp />
</ActionSheetProvider>
);
}
}
```
## Options
The goal of this library is to mimic the native iOS and Android ActionSheets as closely as possible.
This library can also be used with on web with Expo.
This library can also be used in the browser with Expo for web.
### Universal Props
The same options available on React Native's [ActionSheetIOS](https://facebook.github.io/react-native/docs/actionsheetios.html#showactionsheetwithoptions) component exist for both iOS and Android in this library.
### iOS Only Props
| Name | Type | Required | Default |
| -----------------| -------| -------- | ------- |
| anchor | number | No | |
#### `anchor` (optional)
iPad only option that allows for docking the action sheet to a node. See [ShowActionSheetButton.tsx](/example/ShowActionSheetButton.tsx) for an example on how to implement this.
### Android/Web-Only Props
The below props allow modification of the Android ActionSheet. They have no effect on the look on iOS as the native iOS Action Sheet does not have options for modifying these options.
+7
View File
@@ -62,6 +62,13 @@ class App extends React.Component<Props, State> {
onSelection={this._updateSelectionText}
showActionSheetWithOptions={showActionSheetWithOptions}
/>
<ShowActionSheetButton
title="iPad Anchor"
withAnchor
withTitle
onSelection={this._updateSelectionText}
showActionSheetWithOptions={showActionSheetWithOptions}
/>
<ShowActionSheetButton
title="Nested Action Sheets"
onSelection={index => {
+17 -3
View File
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text, View, TextStyle, ViewStyle } from 'react-native';
import { Text, View, TextStyle, ViewStyle, findNodeHandle, Button } from 'react-native';
import { MaterialIcons, Entypo } from '@expo/vector-icons';
import { ActionSheetOptions } from '@expo/react-native-action-sheet';
@@ -17,6 +17,7 @@ interface Props {
withIcons?: boolean;
withSeparators?: boolean;
withCustomStyles?: boolean;
withAnchor?: boolean;
}
// A custom button that shows examples of different share sheet configurations
@@ -27,11 +28,15 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
withIcons: false,
withSeparators: false,
withCustomStyles: false,
withAnchor: false,
onSelection: null,
};
_anchorRef = React.createRef<Button>();
_showActionSheet = () => {
const {
withAnchor,
withTitle,
withMessage,
withIcons,
@@ -79,6 +84,9 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
backgroundColor: 'lightgrey',
}
: undefined;
const anchor: number | null = this._anchorRef.current
? findNodeHandle(this._anchorRef.current)
: null;
showActionSheetWithOptions(
{
@@ -88,6 +96,8 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
title,
message,
icons,
//iPad only
anchor: withAnchor && anchor ? anchor : undefined,
// Android only
tintIcons: true,
// Android only; default is true
@@ -101,7 +111,7 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
// Android only,
containerStyle,
},
buttonIndex => {
(buttonIndex: number) => {
// Do something here depending on the button index selected
onSelection(buttonIndex);
}
@@ -115,7 +125,11 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
style={{
margin: 6,
}}>
<Entypo.Button name="code" backgroundColor="#3e3e3e" onPress={this._showActionSheet}>
<Entypo.Button
name="code"
backgroundColor="#3e3e3e"
onPress={this._showActionSheet}
ref={this._anchorRef}>
<Text
style={{
fontSize: 15,
+1
View File
@@ -36,6 +36,7 @@
"@react-native-community/bob": "^0.6.1",
"@react-native-community/eslint-config": "^0.0.5",
"@semantic-release/changelog": "^3.0.5",
"@semantic-release/git": "^7.0.18",
"@types/react": "^16.8.23",
"@types/react-native": "^0.57.65",
"@typescript-eslint/eslint-plugin": "^1.12.0",
+2 -1
View File
@@ -101,7 +101,8 @@ export default class ActionGroup extends React.Component<Props> {
pressInDelay={0}
background={nativeFeedbackBackground}
onPress={() => onSelect(i)}
style={styles.button}>
style={styles.button}
accessibilityLabel={options[i]}>
{this._renderIconElement(iconSource, color)}
<Text style={[styles.text, textStyle, { color }]}>{options[i]}</Text>
</TouchableNativeFeedbackSafe>
@@ -8,10 +8,14 @@ import {
} from 'react-native';
// This TouchableOpacity has the same staic method of TouchableNativeFeedback
class CustomTouchableOpacity extends TouchableOpacity {
class CustomTouchableOpacity extends React.Component {
static SelectableBackground = () => ({});
static SelectableBackgroundBorderless = () => ({});
static Ripple = (color: string, borderless?: boolean) => ({});
render() {
return <TouchableOpacity {...this.props}>{this.props.children}</TouchableOpacity>;
}
}
const TouchableComponent = Platform.select({
+12 -4
View File
@@ -1,5 +1,7 @@
import * as React from 'react';
import { ActionSheetIOS, View, ViewProps } from 'react-native';
import { ActionSheetIOSOptions } from '../types';
interface Props {
@@ -18,12 +20,18 @@ export default class ActionSheet extends React.Component<Props> {
);
}
showActionSheetWithOptions(options: ActionSheetIOSOptions, onSelect: onSelect) {
showActionSheetWithOptions(dataOptions: ActionSheetIOSOptions, onSelect: onSelect) {
// ...dataOptions include other keys which use in android and web, thats why `Android-Only options` Crash on IOS
const { cancelButtonIndex, destructiveButtonIndex, options, tintColor } = dataOptions;
const iosOptions: ActionSheetIOSOptions = {
...options,
cancelButtonIndex,
destructiveButtonIndex,
options,
tintColor,
// A null title or message on iOS causes a crash
title: options.title || undefined,
message: options.message || undefined,
title: dataOptions.title || undefined,
message: dataOptions.message || undefined,
anchor: dataOptions.anchor || undefined,
};
ActionSheetIOS.showActionSheetWithOptions(iosOptions, onSelect);
}
+1
View File
@@ -13,6 +13,7 @@ export interface ActionSheetIOSOptions {
tintColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
anchor?: number;
}
// for Android or Web
+3323 -61
View File
File diff suppressed because it is too large. Load diff