-
-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: restore backward compat for new & old architecture #2730
Changes from 6 commits
2a12cbd
62c5ad2
042d3ac
44513aa
9f0af2d
5621b2f
4aa830b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused code that would required to be adjusted similarly to DimmingView & ScreensCoordinatorLayout. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.swmansion.rnscreens | ||
|
||
import com.facebook.react.uimanager.PointerEvents | ||
import com.facebook.react.uimanager.ReactPointerEventsView | ||
|
||
internal class ScreensCoordinatorLayoutPointerEventsImpl : ReactPointerEventsView { | ||
// We set pointer events to BOX_NONE, because we don't want the ScreensCoordinatorLayout | ||
// to be target of react gestures and effectively prevent interaction with screens | ||
// underneath the current screen (useful in `modal` & `formSheet` presentation). | ||
override fun getPointerEvents(): PointerEvents = PointerEvents.BOX_NONE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.swmansion.rnscreens.bottomsheet | ||
|
||
import com.facebook.react.uimanager.PointerEvents | ||
import com.facebook.react.uimanager.ReactPointerEventsView | ||
import com.swmansion.rnscreens.bottomsheet.DimmingView | ||
|
||
|
||
internal class DimmingViewPointerEventsImpl(val dimmingView: DimmingView) : ReactPointerEventsView { | ||
override fun getPointerEvents(): PointerEvents = if (dimmingView.blockGestures == false) PointerEvents.AUTO else PointerEvents.NONE | ||
} | ||
|
||
internal class DimmingViewPointerEventsProxy(var pointerEventsImpl: DimmingViewPointerEventsImpl?) : | ||
ReactPointerEventsView { | ||
override fun getPointerEvents(): PointerEvents = pointerEventsImpl?.pointerEvents ?: PointerEvents.NONE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.swmansion.rnscreens | ||
|
||
import com.facebook.react.uimanager.PointerEvents | ||
import com.facebook.react.uimanager.ReactPointerEventsView | ||
|
||
internal class ScreensCoordinatorLayoutPointerEventsImpl() : ReactPointerEventsView { | ||
// We set pointer events to BOX_NONE, because we don't want the ScreensCoordinatorLayout | ||
// to be target of react gestures and effectively prevent interaction with screens | ||
// underneath the current screen (useful in `modal` & `formSheet` presentation). | ||
override val pointerEvents: PointerEvents = PointerEvents.BOX_NONE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.swmansion.rnscreens.bottomsheet | ||
|
||
import com.facebook.react.uimanager.PointerEvents | ||
import com.facebook.react.uimanager.ReactPointerEventsView | ||
|
||
|
||
internal class DimmingViewPointerEventsImpl(val dimmingView: DimmingView) : ReactPointerEventsView { | ||
override val pointerEvents: PointerEvents | ||
get() = if (dimmingView.blockGestures == false) PointerEvents.AUTO else PointerEvents.NONE | ||
} | ||
|
||
internal class DimmingViewPointerEventsProxy(var pointerEventsImpl: DimmingViewPointerEventsImpl?) : | ||
ReactPointerEventsView { | ||
override val pointerEvents: PointerEvents | ||
get() = pointerEventsImpl?.pointerEvents ?: PointerEvents.NONE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,20 @@ | |
_Pragma("clang diagnostic ignored \"-Wobjc-missing-super-calls\"") | ||
|
||
#define RNS_IGNORE_SUPER_CALL_END _Pragma("clang diagnostic pop") | ||
|
||
#import <React-RCTAppDelegate/RCTReactNativeFactory.h> | ||
|
||
#if defined __has_include | ||
#if __has_include( \ | ||
<React-RCTAppDelegate/RCTReactNativeFactory.h>) // added in 78 | ||
#define RNS_REACT_NATIVE_VERSION_MINOR_BELOW_78 0 | ||
#else | ||
#define RNS_REACT_NATIVE_VERSION_MINOR_BELOW_78 1 | ||
#endif | ||
#endif | ||
Comment on lines
+9
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not pretty, but good enough for now. If we need to have more RN version dependent code in the future we should define I've also seen that |
||
|
||
#if RNS_REACT_NATIVE_VERSION_MINOR_BELOW_78 | ||
#define MUTATION_PARENT_TAG(mutation) mutation.parentShadowView.tag | ||
#else | ||
#define MUTATION_PARENT_TAG(mutation) mutation.parentTag | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing it it such convoluted way, because I want the interface implementation to be delegated, but the implementation requires reference to
this@DimmingView
which can not be passed while calling other constructor.This should not cause any timing problems since I'm initialising the implementation field just below in the
init
block.Delegation of the interface implementation allows me to not put whole logic under versioning but rather only its fragments related to pointer events.