Skip to content
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
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
'folders',
'filename-rules',
],
ignorePatterns: ["*", "!src/"],
ignorePatterns: [".eslintrc.js"],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run lint
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![NPM Version](https://img.shields.io/npm/v/react-native-multiple-modals)

# react-native-multiple-modals

Native Modal implementation which allows to display multiple Modals simultaneously.
Expand Down Expand Up @@ -86,3 +88,9 @@ Use to change the modals's rendering area. May be useful for foldable devices.
Default: Dimensions.get('screen')

---

## Integrations

### react-native-gesture-handler

Wrap your content with `<GestureHandlerRootView> ... </GestureHandlerRootView>` to make gestures work inside a modal
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.facebook.react.uimanager.events.Event

class PressBackEvent(surfaceId: Int, viewTag: Int) : Event<PressBackEvent>(surfaceId, viewTag) {
companion object {
const val NAME = "pressBack"
const val NAME = "topPressBackAndroid"
const val REGISTRATION_NAME = "onPressBackAndroid"
}

Expand Down
1 change: 0 additions & 1 deletion android/src/newarch/RNTModalViewManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.multiplemodals

import android.view.ViewGroup

import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewGroupManager
import com.facebook.react.uimanager.ViewManagerDelegate
import com.facebook.react.viewmanagers.RNTModalViewManagerDelegate
Expand Down
965 changes: 330 additions & 635 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"scripts": {
"lint": "npx eslint ./src",
"build": "tsup",
"release": "npm run build && npm publish"
"release": "npm run build && npm publish",
"prepare": "husky"
},
"files": [
"src",
Expand Down Expand Up @@ -82,14 +83,15 @@
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-testing-library": "^6.3.0",
"eslint-plugin-unicorn": "^55.0.0",
"husky": "^9.1.6",
"prettier": "^3.3.3",
"tsup": "^8.3.0"
},
"peerDependencies": {
"react": "^18",
"react-native": ">=0.70.0",
"@types/react": "*",
"@types/react-native": "*"
"@types/react-native": "*",
"react": "^18",
"react-native": ">=0.70.0"
},
"peerDependenciesMeta": {
"@types/react": {
Expand Down
11 changes: 7 additions & 4 deletions src/ModalView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import {
PressableProps,
StyleProp,
StyleSheet,
useWindowDimensions,
View,
ViewStyle,
} from 'react-native';

import { ScrollContextResetter } from './ScrollContextResetter';
import RNTModalView from './RNTModalView';
import RNTModalView from './newarch/RNTModalViewNativeComponent';
import { useScreenDimensions } from './useScreenDimensions';

export type BackdropProps = Omit<PressableProps, 'onPress' | 'style'> & {
Expand All @@ -32,7 +31,7 @@ export type ModalViewProps = {
containerSize?: {
width: number;
height: number;
}
};
};

const backdropAccessibilityLabel = 'Backdrop';
Expand Down Expand Up @@ -75,7 +74,11 @@ export const ModalView: FC<ModalViewProps> = ({
<ScrollContextResetter>
<View
pointerEvents='box-none'
style={[preferredContainerSize, styles.content, contentContainerStyle]}
style={[
preferredContainerSize,
styles.content,
contentContainerStyle,
]}
>
{children}
</View>
Expand Down
12 changes: 0 additions & 12 deletions src/RNTModalView.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/constants.ts

This file was deleted.

8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export { DismissalSource, ModalView, type BackdropProps, type ModalViewProps } from './ModalView';

export {
DismissalSource,
ModalView,
type BackdropProps,
type ModalViewProps,
} from './ModalView';
10 changes: 8 additions & 2 deletions src/newarch/RNTModalViewNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/* eslint-disable filename-rules/match */
/* eslint-disable @typescript-eslint/no-empty-object-type */
import type { ViewProps } from 'react-native';
import { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

interface NativeProps extends ViewProps {}
type PressBackAndroidEvent = Readonly<{}>;
interface NativeProps extends ViewProps {
onPressBackAndroid?: DirectEventHandler<PressBackAndroidEvent>;
}

// Doesn't accept variables, so component name is hardcoded
// Codegen doesn't accept variables, so component name is hardcoded
export default codegenNativeComponent<NativeProps>('RNTModalView');
31 changes: 0 additions & 31 deletions src/oldarch/RNTModalView.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/useScreenDimensions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';

import { Dimensions, ScaledSize } from 'react-native';

export const useScreenDimensions = (): ScaledSize => {
Expand Down