-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patched react-native-navigation 0.75.x build issues
- Loading branch information
1 parent
aeda8cb
commit 2c3ed01
Showing
3 changed files
with
72 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,157 +1,121 @@ | ||
diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java | ||
index 834d734..0246ecc 100644 | ||
index 834d734..7d90437 100644 | ||
--- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java | ||
+++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java | ||
@@ -96,14 +96,14 @@ public class ReactTypefaceUtils { | ||
@@ -96,12 +96,12 @@ public class ReactTypefaceUtils { | ||
|
||
int want = 0; | ||
if ((weight == Typeface.BOLD) | ||
- || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) { | ||
- want |= Typeface.BOLD; | ||
- } | ||
+ || ((oldStyle & Typeface.BOLD) != 0)) { | ||
+ want |= Typeface.BOLD; | ||
+ } | ||
want |= Typeface.BOLD; | ||
} | ||
|
||
if ((style == Typeface.ITALIC) | ||
- || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) { | ||
- want |= Typeface.ITALIC; | ||
- } | ||
+ || ((oldStyle & Typeface.ITALIC) != 0)) { | ||
+ want |= Typeface.ITALIC; | ||
+ } | ||
want |= Typeface.ITALIC; | ||
} | ||
|
||
if (family != null) { | ||
typeface = ReactFontManager.getInstance().getTypeface(family, want, weight, assetManager); | ||
diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt | ||
index f92580c..9809d88 100644 | ||
index f92580c..04cf256 100644 | ||
--- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt | ||
+++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt | ||
@@ -4,4 +4,4 @@ import com.facebook.react.views.view.ReactViewBackgroundDrawable | ||
@@ -1,7 +1,15 @@ | ||
package com.reactnativenavigation.utils | ||
|
||
-import com.facebook.react.views.view.ReactViewBackgroundDrawable | ||
+import com.facebook.react.uimanager.LengthPercentage | ||
+import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable | ||
import com.facebook.react.views.view.ReactViewGroup | ||
|
||
val ReactViewGroup.borderRadius: Float | ||
- get() = (background as? ReactViewBackgroundDrawable)?.fullBorderRadius ?: 0f | ||
\ No newline at end of file | ||
+ get() = 0f | ||
+ get() { | ||
+ val uniform: LengthPercentage = (background as? CSSBackgroundDrawable)?.borderRadius?.uniform | ||
+ ?: return 0f | ||
+ | ||
+ return uniform.resolve( | ||
+ width.toFloat(), height.toFloat() | ||
+ ) | ||
+ } | ||
\ No newline at end of file | ||
diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt | ||
index 89216ae..20f3ffa 100644 | ||
index 89216ae..de104e2 100644 | ||
--- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt | ||
+++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt | ||
@@ -3,13 +3,15 @@ package com.reactnativenavigation.viewcontrollers.viewcontroller | ||
@@ -1,15 +1,19 @@ | ||
package com.reactnativenavigation.viewcontrollers.viewcontroller | ||
|
||
+import android.annotation.SuppressLint | ||
import com.facebook.react.ReactInstanceManager | ||
import com.facebook.react.modules.i18nmanager.I18nUtil | ||
import com.reactnativenavigation.options.Options | ||
+import com.facebook.react.bridge.ReactContext | ||
|
||
class LayoutDirectionApplier { | ||
+ @SuppressLint("WrongConstant") | ||
fun apply(root: ViewController<*>, options: Options, instanceManager: ReactInstanceManager) { | ||
- if (options.layout.direction.hasValue() && instanceManager.currentReactContext != null) { | ||
+ val reactContext = instanceManager.currentReactContext as? ReactContext | ||
+ if (options.layout.direction.hasValue() && reactContext != null) { | ||
root.activity.window.decorView.layoutDirection = options.layout.direction.get() | ||
- root.activity.window.decorView.layoutDirection = options.layout.direction.get() | ||
- I18nUtil.getInstance().allowRTL(instanceManager.currentReactContext, options.layout.direction.isRtl) | ||
- I18nUtil.getInstance().forceRTL(instanceManager.currentReactContext, options.layout.direction.isRtl) | ||
+ I18nUtil.getInstance().allowRTL(reactContext, options.layout.direction.isRtl) | ||
+ I18nUtil.getInstance().forceRTL(reactContext, options.layout.direction.isRtl) | ||
+ if (options.layout.direction.hasValue()) { | ||
+ instanceManager.currentReactContext?.let { context -> | ||
+ root.activity.window.decorView.layoutDirection = options.layout.direction.get() | ||
+ I18nUtil.getInstance().allowRTL(context, options.layout.direction.isRtl) | ||
+ I18nUtil.getInstance().forceRTL(context, options.layout.direction.isRtl) | ||
+ } | ||
} | ||
} | ||
} | ||
\ No newline at end of file | ||
diff --git a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt b/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt | ||
index ea8516f..ca02c01 100644 | ||
index ea8516f..17a60fc 100644 | ||
--- a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt | ||
+++ b/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt | ||
@@ -8,8 +8,7 @@ import com.facebook.react.uimanager.* | ||
import com.facebook.react.uimanager.events.EventDispatcher | ||
import com.facebook.react.views.view.ReactViewGroup | ||
|
||
- | ||
-class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
+class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView { | ||
private var hasAdjustedSize = false | ||
private var viewWidth = 0 | ||
private var viewHeight = 0 | ||
@@ -21,6 +20,7 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
viewHeight = h | ||
this.updateFirstChildView() | ||
} | ||
+ | ||
private fun updateFirstChildView() { | ||
if (this.childCount > 0) { | ||
hasAdjustedSize = false | ||
@@ -29,12 +29,12 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { | ||
override fun runGuarded() { | ||
val uiManager = [email protected]().getNativeModule( | ||
- UIManagerModule::class.java | ||
+ UIManagerModule::class.java | ||
) as UIManagerModule | ||
uiManager.updateNodeSize( | ||
- viewTag, | ||
- [email protected], | ||
- [email protected] | ||
+ viewTag, | ||
+ [email protected], | ||
+ [email protected] | ||
) | ||
} | ||
}) | ||
@@ -49,22 +49,32 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
@@ -49,22 +49,24 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
updateFirstChildView() | ||
} | ||
} | ||
+ | ||
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent?) { | ||
- mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
+ androidEvent?.let { | ||
+ mJSTouchDispatcher.onChildStartedNativeGesture(it, this.getEventDispatcher()!!) | ||
+ } | ||
- override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent?) { | ||
+ override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent) { | ||
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
} | ||
- override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { | ||
+ | ||
override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { | ||
- mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
+ androidEvent?.let { | ||
+ mJSTouchDispatcher.onChildStartedNativeGesture(it, this.getEventDispatcher()!!) | ||
+ } | ||
+ @Deprecated("Deprecated in Java") | ||
+ override fun onChildStartedNativeGesture(androidEvent: MotionEvent) { | ||
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
} | ||
+ | ||
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent?) { | ||
- mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
+ androidEvent?.let { | ||
+ mJSTouchDispatcher.onChildEndedNativeGesture(it, this.getEventDispatcher()!!) | ||
+ } | ||
- override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent?) { | ||
+ override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent) { | ||
mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher()) | ||
} | ||
+ | ||
override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} | ||
- private fun getEventDispatcher(): EventDispatcher? { | ||
+ | ||
private fun getEventDispatcher(): EventDispatcher? { | ||
+ private fun getEventDispatcher(): EventDispatcher { | ||
val reactContext: ReactContext = this.getReactContext() | ||
- return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher | ||
+ return reactContext.getNativeModule(UIManagerModule::class.java)?.eventDispatcher | ||
return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher | ||
} | ||
|
||
- | ||
override fun handleException(t: Throwable?) { | ||
getReactContext().handleException(RuntimeException(t)) | ||
} | ||
@@ -74,14 +84,17 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
@@ -73,12 +75,12 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ | ||
return this.context as ReactContext | ||
} | ||
|
||
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { | ||
- mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) | ||
+ event?.let { | ||
+ mJSTouchDispatcher.handleTouchEvent(it, getEventDispatcher()!!) | ||
+ } | ||
- override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { | ||
+ override fun onInterceptTouchEvent(event: MotionEvent): Boolean { | ||
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) | ||
return super.onInterceptTouchEvent(event) | ||
} | ||
|
||
override fun onTouchEvent(event: MotionEvent?): Boolean { | ||
- mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) | ||
+ event?.let { | ||
+ mJSTouchDispatcher.handleTouchEvent(it, getEventDispatcher()!!) | ||
+ } | ||
- override fun onTouchEvent(event: MotionEvent?): Boolean { | ||
+ override fun onTouchEvent(event: MotionEvent): Boolean { | ||
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) | ||
super.onTouchEvent(event) | ||
return true | ||
} | ||
- | ||
} |
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