Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for configurable animationType #22

Merged
merged 2 commits into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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