Compare commits

...
12 Commits
Author SHA1 Message Date
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
Colin Darie 39fc431c97 feat(android): allow customizing container styles (#142)
* Android: container style configurable (background)
* Add containerStyle prop description to readme
* Add containerStyle prop to example app
2019-11-18 22:12:18 -06:00
Hammad Jutt 76397fa7c4 feat: Allow pointerEvents prop to pass through to containing view (#124) 2019-11-18 21:41:57 -06:00
Brad Bumbalough 8448370658 Merge pull request #141 from expo/chore/yarn-release
chore: use yarn instead of npm for action
2019-11-05 07:31:39 -06:00
Brad Bumbalough 223d35fb85 chore: use yarn instead of npm for action 2019-11-05 07:30:58 -06:00
Brad Bumbalough 979da65d59 Merge pull request #140 from expo/fix/android-nested-action-sheet
[Android] Fix nested action sheets... again
2019-11-05 07:23:19 -06:00
Brad Bumbalough b4f1ae39f9 fix: android calling nested action sheets
- Shouldn't wait until isAnimating since onSelect gets called before _animateOut().
2019-11-04 22:48:40 -06:00
Brad Bumbalough 817582e054 chore: add nested action sheet example 2019-11-04 22:47:30 -06:00
Brad Bumbalough 1a34e86f43 chore: remove package-lock.json
- Accidentally commited this in #136.
2019-11-04 22:40:19 -06:00
13 changed files with 3408 additions and 15126 deletions

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
with:
node-version: 12
- name: Install dependencies
run: npm ci
run: yarn
- name: Type check
run: npm run type-check
- name: Lint
+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"]
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
+17
View File
@@ -1 +1,18 @@
Changelog
## [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))
# Changelog
# [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))
+4
View File
@@ -109,6 +109,7 @@ The below props allow modification of the Android ActionSheet. They have no effe
| titleTextStyle | TextStyle | No | |
| messageTextStyle | TextStyle | No | |
| showSeparators | boolean | No | false |
| containerStyle | ViewStyle | No | |
| separatorStyle | ViewStyle | No | |
#### `icons` (optional)
@@ -130,6 +131,9 @@ Apply any text style props to the message if present.
#### `showSeparators`: (optional)
Show separators between items. On iOS, separators always show so this prop has no effect.
#### `containerStyle`: (optional)
Apply any view style props to the container rather than use the default look (e.g. dark mode).
#### `separatorStyle`: (optional)
Modify the look of the separators rather than use the default look.
+16
View File
@@ -62,6 +62,22 @@ class App extends React.Component<Props, State> {
onSelection={this._updateSelectionText}
showActionSheetWithOptions={showActionSheetWithOptions}
/>
<ShowActionSheetButton
title="Nested Action Sheets"
onSelection={index => {
if (index < 3) {
showActionSheetWithOptions(
{
title: 'Sub Action Sheet',
options: ['One', 'Two', 'Three', 'Done'],
cancelButtonIndex: 3,
},
this._updateSelectionText
);
}
}}
showActionSheetWithOptions={showActionSheetWithOptions}
/>
{this._renderSectionHeader('Android-Only Options')}
<ShowActionSheetButton
title="Icons"
+10 -2
View File
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text, View, TextStyle } from 'react-native';
import { Text, View, TextStyle, ViewStyle } from 'react-native';
import { MaterialIcons, Entypo } from '@expo/vector-icons';
import { ActionSheetOptions } from '@expo/react-native-action-sheet';
@@ -74,6 +74,12 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
textAlign: 'right',
}
: undefined;
const containerStyle: ViewStyle | undefined = withCustomStyles
? {
backgroundColor: 'lightgrey',
}
: undefined;
showActionSheetWithOptions(
{
options,
@@ -91,7 +97,9 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
// Android only
titleTextStyle,
// Android only
messageTextStyle, // Android only
messageTextStyle,
// Android only,
containerStyle,
},
buttonIndex => {
// Do something here depending on the button index selected
-15052
View File
File diff suppressed because it is too large. Load diff
+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",
+1 -1
View File
@@ -25,7 +25,7 @@ export default class ActionGroup extends React.Component<Props> {
render() {
return (
<View style={styles.groupContainer}>
<View style={[styles.groupContainer, this.props.containerStyle]}>
{this._renderTitleContent()}
<ScrollView>{this._renderOptionViews()}</ScrollView>
</View>
+18 -6
View File
@@ -1,24 +1,36 @@
import * as React from 'react';
import { ActionSheetIOS, View } from 'react-native';
import { ActionSheetIOS, View, ViewProps } from 'react-native';
import { ActionSheetIOSOptions } from '../types';
interface Props {
readonly children: React.ReactNode;
readonly pointerEvents?: ViewProps['pointerEvents'];
}
type onSelect = (buttonIndex: number) => void;
export default class ActionSheet extends React.Component<Props> {
render() {
return <View style={{ flex: 1 }}>{React.Children.only(this.props.children)}</View>;
return (
<View pointerEvents={this.props.pointerEvents} style={{ flex: 1 }}>
{React.Children.only(this.props.children)}
</View>
);
}
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,
};
ActionSheetIOS.showActionSheetWithOptions(iosOptions, onSelect);
}
+6 -5
View File
@@ -6,6 +6,7 @@ import {
StyleSheet,
TouchableWithoutFeedback,
View,
ViewProps,
} from 'react-native';
import ActionGroup from './ActionGroup';
import { ActionSheetOptions } from '../types';
@@ -21,6 +22,7 @@ interface State {
interface Props {
readonly useNativeDriver: boolean | undefined;
readonly pointerEvents?: ViewProps['pointerEvents'];
}
const OPACITY_ANIMATION_IN_TIME = 225;
@@ -64,6 +66,7 @@ export default class ActionSheet extends React.Component<Props, State> {
) : null;
return (
<View
pointerEvents={this.props.pointerEvents}
style={{
flex: 1,
}}>
@@ -93,6 +96,7 @@ export default class ActionSheet extends React.Component<Props, State> {
message,
messageTextStyle,
showSeparators,
containerStyle,
separatorStyle,
} = options;
return (
@@ -129,6 +133,7 @@ export default class ActionSheet extends React.Component<Props, State> {
message={message || undefined}
messageTextStyle={messageTextStyle}
showSeparators={showSeparators}
containerStyle={containerStyle}
separatorStyle={separatorStyle}
/>
</View>
@@ -140,12 +145,8 @@ export default class ActionSheet extends React.Component<Props, State> {
showActionSheetWithOptions = (options: ActionSheetOptions, onSelect: (i: number) => void) => {
const { isVisible, isAnimating, overlayOpacity, sheetOpacity } = this.state;
if (isVisible && isAnimating) {
this._deferNextShow = this.showActionSheetWithOptions.bind(this, options, onSelect);
return;
}
if (isVisible) {
this._deferNextShow = this.showActionSheetWithOptions.bind(this, options, onSelect);
return;
}
+1
View File
@@ -23,5 +23,6 @@ export interface ActionSheetOptions extends ActionSheetIOSOptions {
titleTextStyle?: TextStyle;
messageTextStyle?: TextStyle;
showSeparators?: boolean;
containerStyle?: ViewStyle;
separatorStyle?: ViewStyle;
}
+3320 -58
View File
File diff suppressed because it is too large. Load diff