1.0.0 • Published 4 years ago

react-native-simple-animated-modal v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-native-animated-modal

Animated simple modal on React Native.

Installation

npm install react-native-animated-modal

Documentation

PropDescriptionTypeDefaultRequired
isOpenOpen state of modal.booleanfalseYES
toggleFuncChanging open state of modal function.func'indigo'YES
easingAnimation easing. Please readstring'linear'NO
animationTimeAnimation running time.number750NO
widthWidth of modal. (device screen width percentage)number80NO
heightHeight of modal. (device screen height percentage)numbernullNO
modalColorBackground color of modal.string'white'NO
backdropColorBackground color of modal backdrop.string'rgba(0, 0, 0, 0.8)'NO
modalRadiusBorder radius value of modal view. (px)number15NO
modalStyleCustom style of modal view.objectnullNO
isFullScreenSize of modal view. (full screen or not)booleanfalseNO
onShowThe function you want to work while modal is turned on.func-NO
onCloseThe function you want to work while modal is turned off.func-NO

Usage

const [isOpen, setIsOpen] = useState(false);

const toggleFunc = () => {
    setIsOpen(!isOpen);
};

<TouchableOpacity onPress={() => toggleFunc()}>
    <View style={{padding: 30}}>
        <Text>Open modal</Text>
    </View>
</TouchableOpacity>

// Add end of the view that has flexibility of 1.
<Modal
    isOpen={isOpen}
    toggleFunc={toggleFunc}
    animationType='bounce'
>
    <View style={{padding: 30}}>
        <TouchableOpacity
            style={{alignSelf: 'flex-end', marginBottom: 10,}}
            onPress={() => toggleFunc()}>
            <Text>Close</Text>
        </TouchableOpacity>
        <Text>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
            labore et dolore magna aliqua.
        </Text>
    </View>
</Modal>