![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-native-swipeable-modal
Advanced tools
react-native-swipeable-modal is a JavaScript library for react-native allowing you to display modals which can be swiped away in any direction
It uses the great react-native-gesture-handler
to handle the pan events. This module needs to be installed within your application for react-native-swipeable-modal
to work.
For details please check React Native Gesture Handler.
React Native Swipeable Modal is available as react-native-swipeable-modal
package on npm
With npm
$ npm install react-native-swipeable-modal --save
If using yarn
$ yarn add react-native-swipeable-modal
react-native-swipeable-modal
exports a SwipeableModal
component which displays its children in a fullscreen mode and can then be swiped away.
You can use SwipeableModal
in any direction:
import React, {Component} from 'react';
import {Text, View, Button} from 'react-native';
import { SwipeableModal } from 'react-native-swipeable-modal';
class Container extends Component {
state = {
showModal: false,
};
closeModal = () => this.setState({ showModal: false });
render() {
return (
<View style={{ flex: 1 }}>
<View style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#FFFFFF'
}}>
<Button title="Show Modal" onPress={() => this.setState({ showModal: true })} />
</View>
{this.state.showModal && <SwipeableModal
closeModal={this.closeModal}
style={{
backgroundColor: '#888888',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Button title="Close" raised onPress={this.closeModal} />
</SwipeableModal>}
</View>
);
}
}
showModal
registerScreen.js
import { Navigation } from 'react-native-navigation';
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
import { ContainerScreen } from './ContainerScreen';
import { ModalScreen } from './ModalScreen';
Navigation.registerComponent(`navigation.Container`, () => ContainerScreen);
Navigation.registerComponent(`navigation.Modal`, () => gestureHandlerRootHOC(ModalScreen));
ContainerScreen.js
import React, {Component} from 'react';
import {Text, View, Button} from 'react-native';
import { Navigation } from 'react-native-navigation';
class ContainerScreen extends Component {
showModal = () => {
Navigation.showModal({
component: {
name: 'navigation.Modal',
options: {
modalPresentationStyle: Platform.OS === 'ios' ? 'overFullScreen' : 'overCurrentContext' // 'overfullScreen' on IOS allows us to see the back content while swiping the modal
}
}
});
};
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Show Modal" onPress={this.showModal} />
</View>
);
}
}
ModalScreen.js
import React, {Component} from 'react';
import { Text, Button } from 'react-native';
import { Navigation } from 'react-native-navigation';
import { SwipeableModal } from 'react-native-swipeable-modal';
export class ModalScreen extends Component {
closeModal = () => {
Navigation.dismissModal(this.props.componentId)
.catch(() => 1));
};
render() {
return (
<SwipeableModal
closeModal={this.closeModal}
style={{
backgroundColor: '#999999',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Button title="Close" onPress={this.closeModal} />
</SwipeableModal>
);
}
}
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
direction | string | ✘ | "bottom" | One of "bottom" , "top" , "left" , "right" |
closeModal | Function | ✓ | - | The function to call when the modal has been swiped away beyond it's limit |
style | Object | ✘ | - | A style to overload the default style of the modal container. Note that you cannot overload the translate properties |
panClose | number | ✘ | 0.6 | A number between 0 and 1 used to select the breakpoint at which closeModal will be called |
minOffset | number | ✘ | 20 | See react-native-gesture-handler minOffset |
maxOffset | number | ✘ | 80 | See react-native-gesture-handler maxOffset |
FAQs
Display modals which can be swiped in any direction
The npm package react-native-swipeable-modal receives a total of 0 weekly downloads. As such, react-native-swipeable-modal popularity was classified as not popular.
We found that react-native-swipeable-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.