-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfe7c56
commit 1e23d7b
Showing
10 changed files
with
293 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// RNIModalViewManager.m | ||
// react-native-ios-modal | ||
// | ||
// Created by Dominic Go on 6/6/24. | ||
// | ||
|
||
#import "RNIModalView.h" | ||
#import <objc/runtime.h> | ||
|
||
#import "react-native-ios-utilities/RNIBaseViewUtils.h" | ||
|
||
#import "RCTBridge.h" | ||
#import <React/RCTViewManager.h> | ||
#import <React/RCTUIManager.h> | ||
|
||
|
||
@interface RNIModalViewManager : RCTViewManager | ||
@end | ||
|
||
@implementation RNIModalViewManager | ||
|
||
RCT_EXPORT_MODULE(RNIModalView) | ||
|
||
#ifndef RCT_NEW_ARCH_ENABLED | ||
- (UIView *)view | ||
{ | ||
return [[RNIModalView new] initWithBridge:self.bridge]; | ||
} | ||
#endif | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { default as IosModalView } from './IosModalViewNativeComponent'; | ||
export * from './IosModalViewNativeComponent'; | ||
// TEMP | ||
export * from './native_components/RNIModalView'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as React from 'react'; | ||
|
||
import { RNIModalNativeView } from './RNIModalNativeView'; | ||
|
||
import type { | ||
RNIContextMenuViewProps, | ||
RNIModalViewRef, | ||
StateReactTag, | ||
StateViewID | ||
} from './RNIModalViewTypes'; | ||
|
||
export const RNIModalView = React.forwardRef< | ||
RNIModalViewRef, | ||
RNIContextMenuViewProps | ||
>((props, ref) => { | ||
|
||
const [viewID, setViewID] = React.useState<StateViewID>(); | ||
const [reactTag, setReactTag] = React.useState<StateReactTag>(); | ||
|
||
React.useImperativeHandle(ref, () => ({ | ||
getReactTag: () => { | ||
return reactTag; | ||
}, | ||
getViewID: () => { | ||
return viewID; | ||
}, | ||
})); | ||
|
||
return ( | ||
<RNIModalNativeView | ||
{...props} | ||
onDidSetViewID={(event) => { | ||
setViewID(event.nativeEvent.viewID); | ||
setReactTag(event.nativeEvent.reactTag); | ||
props.onDidSetViewID?.(event); | ||
}} | ||
> | ||
{props.children} | ||
</RNIModalNativeView> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { PropsWithChildren } from "react"; | ||
import type { ViewProps } from "react-native"; | ||
|
||
import type { OnDidSetViewIDEventPayload } from "react-native-ios-utilities"; | ||
import type { RNIModalNativeViewProps } from "./RNIModalNativeView"; | ||
|
||
export type StateViewID = OnDidSetViewIDEventPayload['viewID'] | undefined; | ||
export type StateReactTag = OnDidSetViewIDEventPayload['reactTag'] | undefined; | ||
|
||
export type RNIModalViewRef = { | ||
getViewID: () => StateViewID; | ||
getReactTag: () => StateReactTag; | ||
}; | ||
|
||
export type RNIModalViewInheritedOptionalProps = Partial<Pick<RNIModalNativeViewProps, | ||
| 'onDidSetViewID' | ||
>>; | ||
|
||
export type RNIModalViewInheritedRequiredProps = {}; | ||
|
||
export type RNIModalViewInheritedProps = | ||
RNIModalViewInheritedOptionalProps | ||
& RNIModalViewInheritedRequiredProps; | ||
|
||
export type RNIModalViewBaseProps = { | ||
// TBA | ||
}; | ||
|
||
export type RNIContextMenuViewProps = PropsWithChildren< | ||
RNIModalViewInheritedProps | ||
& RNIModalViewBaseProps | ||
& ViewProps | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './RNIModalNativeView'; | ||
export * from './RNIModalView'; | ||
export * from './RNIModalViewTypes'; |