Socket
Book a DemoInstallSign in
Socket

rn-custom-modal

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-custom-modal

The rn-custom-modal package provides a customizable and reusable CustomModal component for React Native applications. Designed to simplify the creation of modal-based bottom sheets, it offers a clean and flexible way to display prompts, menus, actions, an

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

RNCustomModal

The rn-custom-modal package provides a customizable and reusable CustomModal component for React Native applications. Designed to simplify the creation of modal-based bottom sheets, it offers a clean and flexible way to display prompts, menus, actions, and other modal content in your app.

RNCustomModal Example

Using title

Using sheetCustomHeader

Installation

Download the package with npm or yarn

Using npm

npm i rn-custom-modal

Usage

  import CustomModal from "rn-custom-modal";
  const [isVisible, setIsVisible] = useState(false);

  const handleOpenModal = () => setIsVisible(true);

  const handleCloseModal = () => setIsVisible(false);

  <Text onPress={handleOpenModal}>Open Custom Modal</Text>

   <CustomModal
      title="Sheet Title"
      isModalVisible={isVisible}
      onCloseModal={handleCloseModal}
      showCloseButton={true}
      renderModalContent={() => (
          <View style={{ paddingVertical: 20 }}>
            <Text style={{ fontSize: 16, textAlign: 'center' }}>
              This is your modal content.
            </Text>
            <Button title="Close" onPress={handleCloseModal} />
          </View>
        )}
    />
 Example with custom header 
      const CustomHeader = () => {
        return (
          <TextInput
            placeholder="Enter something..."
            style={{
              height: 30,
              borderWidth: 1,
              borderColor: '#ccc',
              borderRadius: 8,
              paddingHorizontal: 10,
            }}
          />
        );
      };

      <CustomModal
        sheetCustomHeader={<CustomHeader />}
        isModalVisible={isVisible}
        onCloseModal={handleCloseModal}
        showCloseButton={true}
        renderModalContent={() => (
          <View style={{ paddingVertical: 20 }}>
            <Text style={{ fontSize: 16, textAlign: 'center' }}>
              This is your modal content.
            </Text>
            <Button title="Close" onPress={handleCloseModal} />
          </View>
        )}
      /> 

Props

All the Modal props can be passed.

PropTypeDefaultRequiredDescription
isModalVisiblebooleanfalseYesControls the visibility of the modal.
onCloseModal() => void() => {}YesCalled when the modal or backdrop is pressed to close.
titlestring'Provide Sheet Title'NoTitle to show at the top of the modal. Ignored if sheetCustomHeader is used.
containerStyleStyleProp<ViewStyle>{}NoCustom style for the inner modal sheet container.
backdropStyleStyleProp<ViewStyle>{}NoStyle applied to the semi-transparent backdrop.
animationTypestring'slide'No('slide','fade','none') Type of animation for the modal appearance.
showCloseButtonbooleantrueNoShow or hide the close (X) icon in the modal header.
closeIconImageImageSourcePropTypeclose_icon.pngNoCustom image source for the close icon.
SheetHeaderStyleStyleProp<ViewStyle>{}NoStyle for the header container (title and close icon row).
titleStyleStyleProp<TextStyle>{}NoStyle for the title text inside the modal.
sheetCustomHeaderReactNodenullNoFully override the default header with a custom component.
renderModalContent() => ReactNode() => nullNoFunction that returns the content rendered inside the modal body.

FAQs

Package last updated on 23 Jun 2025

Did you know?

Socket

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.

Install

Related posts