Compare commits

...
9 Commits
8 changed files with 46 additions and 36 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
+2 -2
View File
@@ -6,13 +6,13 @@
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "Changelog"
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md"]
"assets": ["CHANGELOG.md", "package.json"]
}
],
"@semantic-release/npm",
+8 -3
View File
@@ -1,4 +1,11 @@
Changelog
# Changelog
# [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)
@@ -7,8 +14,6 @@ Changelog
* **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))
# Changelog
# [3.4.0](https://github.com/expo/react-native-action-sheet/compare/v3.3.2...v3.4.0) (2019-11-19)
+10 -1
View File
@@ -90,12 +90,21 @@ class AppContainer extends React.Component {
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
@@ -31,6 +31,7 @@ export default class ActionSheet extends React.Component<Props> {
// A null title or message on iOS causes a crash
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