Skip to content

Commit

Permalink
💫 Update: ModalView Content
Browse files Browse the repository at this point in the history
Summary: Revert - "Update `ModalView` content to become a dummy view."
  • Loading branch information
dominicstop committed Apr 19, 2023
1 parent 40cd1aa commit f55d4c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class RNIModalViewController: UIViewController {
private(set) public var prevBounds: CGRect?;

weak var lifecycleDelegate: RNIViewControllerLifeCycleNotifiable?;

weak var modalViewRef: RNIModalView?;

var isBGTransparent: Bool = true {
Expand Down Expand Up @@ -84,11 +85,8 @@ public class RNIModalViewController: UIViewController {
}();

if let modalContentWrapper = self.modalContentWrapper {
let parentView = self.view!;
let wrapperView = modalContentWrapper.reactViews.last!;

parentView.addSubview(wrapperView);
wrapperView.center = parentView.center;
self.view.addSubview(modalContentWrapper);
modalContentWrapper.notifyForBoundsChange(size: self.view.bounds.size);
};

self.updateBackgroundTransparency();
Expand All @@ -113,9 +111,7 @@ public class RNIModalViewController: UIViewController {

let prevBounds = self.prevBounds;
self.prevBounds = nextBounds;

let wrapperView = modalContentWrapper.reactViews.last!;


#if DEBUG
print(
"Log - RNIModalViewController.viewDidLayoutSubviews"
Expand All @@ -126,7 +122,7 @@ public class RNIModalViewController: UIViewController {
#endif

modalContentWrapper.notifyForBoundsChange(size: nextBounds.size);
wrapperView.center = self.view.center;
modalContentWrapper.center = self.view.center;

self.lifecycleDelegate?.viewDidLayoutSubviews(sender: self);
};
Expand Down
22 changes: 7 additions & 15 deletions src/components/ModalView/ModalView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'react';
import {
findNodeHandle,
StyleSheet,
View,
ScrollView,
Platform,
ViewProps,
NativeSyntheticEvent,
View,
} from 'react-native';

import { RNIWrapperView } from '../../temp';
Expand Down Expand Up @@ -640,21 +640,18 @@ export class ModalView extends
>
{shouldMountModalContent && (
<RNIWrapperView
style={[styles.modalContentWrapper]}
style={styles.modalContentWrapper}
nativeID={NATIVE_ID_KEYS.modalViewContent}
isDummyView={true}
isDummyView={false}
collapsable={false}
shouldAutoDetachSubviews={true}
shouldAutoDetachSubviews={false}
shouldCreateTouchHandlerForSubviews={true}
shouldNotifyComponentWillUnmount={props.shouldEnableAggressiveCleanup}
shouldAutoCleanupOnJSUnmount={props.shouldEnableAggressiveCleanup}
onLayout={this._handleOnLayoutModalContentContainer}
>
<View
style={[styles.modalContentContainer, props.containerStyle]}
nativeID={'modalViewContentContainer'}
>
{React.cloneElement(props.children as any, {
<View style={[styles.modalContentContainer, props.containerStyle]}>
{React.cloneElement(props.children as any, {
getModalRef: this._handleGetModalRef,
// pass down props received from setVisibility
...(Helpers.isObject(state.childProps) && state.childProps),
Expand Down Expand Up @@ -723,12 +720,7 @@ const styles = StyleSheet.create({
left: 0,
right: 0,
},
modalContentContainer: {
position: 'absolute',
overflow: 'visible',
width: '100%',
height: '100%',
},
modalContentContainer: {},
});

class ModalViewHelpers {
Expand Down
1 change: 0 additions & 1 deletion src/components/ModalView/ModalViewConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ScrollView } from 'react-native';

export const NATIVE_ID_KEYS = {
modalViewContent: 'modalViewContent',
modalViewContentContainer: 'modalViewContentContainer',
};

export const VirtualizedListContext = React.createContext(null);
Expand Down

0 comments on commit f55d4c2

Please sign in to comment.