Skip to content

Commit

Permalink
add support for configurable animationType (#22)
Browse files Browse the repository at this point in the history
* add support for configurable animationType

* updated documentation
  • Loading branch information
mvanroon authored and mikaello committed Sep 5, 2017
1 parent d9ad661 commit 6eed2fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class SampleApp extends Component {
* `style` (object, optional) style definitions for the root element
* `onChange` (function, optional) callback function, when the users has selected an option
* `initValue` (string, optional) text that is initially shown on the button
* `animationType` (string, optional) type of animation to be used to show the modal. Must be one of `none`, `slide` or `fade`. Defaults to `slide`
* `cancelText` (string, optional) text of the cancel button
* `selectStyle` (object, optional) style definitions for the select element (available in default mode only!).
NOTE: Due to breaking changes in React Native, RN < 0.39.0 should pass `flex:1` explicitly to `selectStyle` as a prop.
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const propTypes = {
data: PropTypes.array,
onChange: PropTypes.func,
initValue: PropTypes.string,
animationType: Modal.propTypes.animationType,
style: ViewPropTypes.style,
selectStyle: ViewPropTypes.style,
optionStyle: ViewPropTypes.style,
Expand All @@ -43,6 +44,7 @@ const defaultProps = {
data: [],
onChange: () => {},
initValue: 'Select me!',
animationType: 'slide',
style: {},
selectStyle: {},
optionStyle: {},
Expand Down Expand Up @@ -73,7 +75,6 @@ export default class ModalSelector extends BaseComponent {
);

this.state = {
animationType: 'slide',
modalVisible: false,
transparent: false,
selected: 'please select',
Expand Down Expand Up @@ -176,7 +177,7 @@ export default class ModalSelector extends BaseComponent {
supportedOrientations={this.props.supportedOrientations}
visible={this.state.modalVisible}
onRequestClose={this.close}
animationType={this.state.animationType}
animationType={this.props.animationType}
>
{this.renderOptionList()}
</Modal>
Expand Down

0 comments on commit 6eed2fa

Please sign in to comment.