react native swipe up down it's animation modal to swipe down or up as Facebook comments, profile picture animation. it support flat-list and scroll view inside it without conflict with animation down and scrolling down
npm install react-native-swipe-modal-up-downsh
$ npm install react-native-swipe-modal-up-down
`Usage
`sh
import SwipeUpDownModal from 'react-native-swipe-modal-up-down';
``javascript let [ShowComment, setShowModelComment] = useState(false);
let [animateModal, setanimateModal] = useState(false);
modalVisible={ShowComment}
PressToanimate={animateModal}
//if you don't pass HeaderContent you should pass marginTop in view of ContentModel to Make modal swipeable
ContentModal={
data={data}
renderItem={({item, index}) => (
)}
keyExtractor={item => item.id}
/>
}
HeaderStyle={styles.headerContent}
ContentModalStyle={styles.Modal}
HeaderContent={
Title={"Press Me"}
onPress={() => {
setanimateModal(true);
}}
/>
}
onClose={() => {
setModelComment(false);
setanimateModal(false);
}}
/>
const styles = StyleSheet.create({
containerContent: {flex: 1, marginTop: 40},
containerHeader: {
flex: 1,
alignContent: 'center',
alignItems: 'center',
justifyContent: 'center',
height: 40,
backgroundColor: '#F1F1F1',
},
headerContent:{
marginTop: 0,
},
Modal: {
backgroundColor: '#005252',
marginTop: 0,
}
});
`
props
Props | Type | default | Note
------------- | ------------- | ------------- | -------------
modalVisible | Boolean | false | Set visiablity of Modal
ContentModal | React Element | null | for example:
ContentModalStyle | any | opacity, flex: 1, marginTop: 55 | you shouldn't pass opacity or transform
HeaderContent | React Element | null | for example:
HeaderStyle | any | opacity, width: 700, marginTop: 50, position: 'absolute' | you shouldn't pass opacity or transform
onClose | func | () => null | Called when Modal closed
ImageBackgroundModal | image | null | you can set imagebackground of modal instead of backgroundColor
ImageBackgroundModalStyle | any | null | for example : borderTopLeftRadius: 25, borderTopRightRadius: 25`