-
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
8fce587
commit 7eb0a9e
Showing
7 changed files
with
101 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// RNIModalView.swift | ||
// ReactNativeIosModal | ||
// | ||
// Created by Dominic Go on 10/6/23. | ||
// | ||
|
||
import ExpoModulesCore | ||
|
||
public class RNIModalView: ExpoView { | ||
|
||
// MARK: Properties | ||
// ---------------- | ||
|
||
public override var reactTag: NSNumber! { | ||
didSet { | ||
guard let newValue = self.reactTag, | ||
newValue != oldValue | ||
else { return }; | ||
|
||
self.onReactTagDidSetEvent.callAsFunction([ | ||
"reactTag": newValue | ||
]); | ||
} | ||
}; | ||
|
||
// MARK: Properties - Prop - Events | ||
// -------------------------------- | ||
|
||
let onReactTagDidSetEvent = EventDispatcher("onReactTagDidSet"); | ||
|
||
// MARK: Init + Lifecycle | ||
// ---------------------- | ||
|
||
public required init(appContext: AppContext? = nil) { | ||
super.init(appContext: appContext); | ||
}; | ||
|
||
public override func layoutSubviews() { | ||
super.layoutSubviews(); | ||
}; | ||
|
||
public override func insertReactSubview(_ subview: UIView!, at atIndex: Int) { | ||
super.insertReactSubview(subview, at: atIndex); | ||
}; | ||
}; |
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,18 @@ | ||
// | ||
// RNIModalViewModule.swift | ||
// ReactNativeIosModal | ||
// | ||
// Created by Dominic Go on 10/6/23. | ||
// | ||
|
||
import ExpoModulesCore | ||
|
||
public class RNIModalViewModule: Module { | ||
|
||
public func definition() -> ModuleDefinition { | ||
Name("RNIModalViewModule"); | ||
|
||
View(RNIModalView.self) { | ||
}; | ||
}; | ||
}; |
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,5 @@ | ||
import { requireNativeViewManager } from 'expo-modules-core'; | ||
import type { RNIModalViewProps } from './RNIModalViewTypes'; | ||
|
||
export const RNIModalView: React.ComponentType<RNIModalViewProps> = | ||
requireNativeViewManager('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,7 @@ | ||
export type OnModalViewReactTagDidSetEventPayload = { | ||
reactTag?: number; | ||
}; | ||
|
||
export type OnModalViewReactTagDidSetEvent = (event: { | ||
nativeEvent: OnModalViewReactTagDidSetEventPayload | ||
}) => void; |
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,11 @@ | ||
import { requireNativeModule } from 'expo-modules-core'; | ||
|
||
interface RNIModalViewModule { | ||
notifyComponentWillUnmount( | ||
reactTag: number, | ||
isManuallyTriggered: boolean | ||
): void; | ||
}; | ||
|
||
export const RNIModalViewModule: RNIModalViewModule = | ||
requireNativeModule('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,10 @@ | ||
import { ViewProps } from 'react-native'; | ||
import type { OnModalViewReactTagDidSetEvent } from './RNIModalViewEvents'; | ||
|
||
export type RNIModalViewBaseProps = { | ||
shouldCleanupOnComponentWillUnmount: boolean; | ||
onReactTagDidSet: OnModalViewReactTagDidSetEvent; | ||
}; | ||
|
||
export type RNIModalViewProps = | ||
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
export * from './RNIModalView'; | ||
export * from './RNIModalViewTypes'; | ||
export * from './RNIModalViewEvents'; |