react-native-navigation 7.21.0 → 7.22.0-snapshot.1649
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactNativeNavigation.podspec +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +1 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/BackButton.java +5 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ElementTransitionOptions.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt +2 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/LayoutFactory.java +120 -120
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/interpolators/SpringInterpolator.kt +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/TypefaceLoader.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/CommandListenerAdapter.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +7 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.kt +27 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java +50 -50
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/Events.kt +34 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalFrameLayout.kt +19 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt +78 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalLayoutController.kt +51 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt +131 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/CoordinatorLayoutUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/OutlineProvider.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReflectionUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/RenderChecker.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StatusBarUtils.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/UiUtils.java +5 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewParent.kt +0 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +6 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/BottomTabsAttacher.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachMode.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/OnSwitchToTab.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistry.java +5 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentPresenterBase.java +3 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +6 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +18 -18
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +12 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +22 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuPresenter.java +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/FabPresenter.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/IdStack.java +14 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +29 -29
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerBuilder.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +29 -28
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarAnimator.kt +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarBackgroundViewController.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/BackButtonHelper.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonSpan.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/IconResolver.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsAdapter.java +5 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +1 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/PropertyAnimatorCreator.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageBoundsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageMatrixAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactViewRotationAnimator.kt +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsLayoutCreator.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsViewPager.java +6 -6
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +0 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java +23 -28
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java +4 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java +3 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/OptionsTest.java +9 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/TopBarButtonsTest.kt +70 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/ColorParseTest.java +0 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/RenderCheckerTest.java +6 -6
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenterTest.java +3 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAttacherTest.java +1 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java +13 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachModeTest.java +5 -5
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllerTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistryTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +4 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +10 -10
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +25 -26
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.kt +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/parent/ParentControllerTest.java +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java +11 -11
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/BackButtonHelperTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimatorTest.kt +0 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenterTest.kt +17 -17
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarControllerTest.kt +3 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewControllerTest.java +9 -9
- package/lib/dist/Navigation.d.ts +1 -1
- package/lib/dist/Navigation.js +2 -2
- package/lib/dist/NavigationDelegate.d.ts +1 -1
- package/lib/dist/NavigationDelegate.js +2 -2
- package/lib/dist/adapters/TouchablePreview.js +1 -0
- package/lib/dist/commands/Commands.d.ts +1 -1
- package/lib/dist/commands/Commands.js +2 -2
- package/lib/dist/commands/OptionsProcessor.js +12 -6
- package/lib/dist/components/ComponentWrapper.d.ts +1 -1
- package/lib/dist/components/ComponentWrapper.js +2 -2
- package/lib/dist/components/Modal.d.ts +20 -0
- package/lib/dist/components/Modal.js +93 -0
- package/lib/dist/components/Store.d.ts +1 -1
- package/lib/dist/components/Store.js +2 -2
- package/lib/dist/index.d.ts +1 -0
- package/lib/dist/index.js +1 -0
- package/lib/dist/interfaces/Options.d.ts +15 -0
- package/lib/ios/BottomTabPresenter.h +4 -1
- package/lib/ios/BottomTabPresenter.m +11 -3
- package/lib/ios/BottomTabPresenterCreator.m +11 -4
- package/lib/ios/BottomTabsAppearancePresenter.m +29 -4
- package/lib/ios/RNNBackButtonOptions.h +1 -0
- package/lib/ios/RNNBackButtonOptions.m +4 -1
- package/lib/ios/RNNBottomTabOptions.h +2 -0
- package/lib/ios/RNNBottomTabOptions.m +7 -1
- package/lib/ios/RNNBottomTabsController.m +5 -0
- package/lib/ios/RNNDotIndicatorPresenter.m +12 -6
- package/lib/ios/RNNSegmentedControl.h +1 -1
- package/lib/ios/RNNTabBarItemCreator.h +4 -4
- package/lib/ios/RNNTabBarItemCreator.m +17 -7
- package/lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +8 -24
- package/lib/ios/TabBarItemAppearanceCreator.m +3 -3
- package/lib/ios/TabBarItemIOS15Creator.h +6 -0
- package/lib/ios/TabBarItemIOS15Creator.m +37 -0
- package/lib/ios/TopBarPresenter.m +13 -3
- package/lib/ios/UIViewController+RNNOptions.m +7 -0
- package/lib/src/Navigation.ts +2 -2
- package/lib/src/NavigationDelegate.ts +2 -2
- package/lib/src/adapters/TouchablePreview.tsx +1 -1
- package/lib/src/commands/Commands.ts +2 -2
- package/lib/src/commands/OptionsProcessor.ts +12 -7
- package/lib/src/components/ComponentWrapper.tsx +11 -8
- package/lib/src/components/Modal.tsx +109 -0
- package/lib/src/components/Store.ts +2 -2
- package/lib/src/index.ts +1 -1
- package/lib/src/interfaces/Options.ts +15 -0
- package/package.json +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.java +0 -41
- package/lib/ios/BottomTabAppearancePresenter.h +0 -6
- package/lib/ios/BottomTabAppearancePresenter.m +0 -12
- package/lib/ios/HMSegmentedControl.h +0 -287
- package/lib/ios/HMSegmentedControl.m +0 -1063
|
@@ -9,67 +9,67 @@ import androidx.annotation.NonNull;
|
|
|
9
9
|
|
|
10
10
|
public class NavigationReactInitializer implements ReactInstanceManager.ReactInstanceEventListener {
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
private final ReactInstanceManager reactInstanceManager;
|
|
13
|
+
private final DevPermissionRequest devPermissionRequest;
|
|
14
|
+
private boolean waitingForAppLaunchEvent = true;
|
|
15
|
+
private boolean isActivityReadyForUi = false;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
NavigationReactInitializer(ReactInstanceManager reactInstanceManager, boolean isDebug) {
|
|
18
|
+
this.reactInstanceManager = reactInstanceManager;
|
|
19
|
+
this.devPermissionRequest = new DevPermissionRequest(isDebug);
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
void onActivityCreated() {
|
|
23
|
+
reactInstanceManager.addReactInstanceEventListener(this);
|
|
24
|
+
waitingForAppLaunchEvent = true;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
void onActivityResumed(NavigationActivity activity) {
|
|
28
|
+
if (devPermissionRequest.shouldAskPermission(activity)) {
|
|
29
|
+
devPermissionRequest.askPermission(activity);
|
|
30
|
+
} else {
|
|
31
|
+
reactInstanceManager.onHostResume(activity, activity);
|
|
32
32
|
isActivityReadyForUi = true;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
prepareReactApp();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
void onActivityPaused(NavigationActivity activity) {
|
|
38
38
|
isActivityReadyForUi = false;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (reactInstanceManager.hasStartedCreatingInitialContext()) {
|
|
40
|
+
reactInstanceManager.onHostPause(activity);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
void onActivityDestroyed(NavigationActivity activity) {
|
|
45
|
+
reactInstanceManager.removeReactInstanceEventListener(this);
|
|
46
|
+
if (reactInstanceManager.hasStartedCreatingInitialContext()) {
|
|
47
|
+
reactInstanceManager.onHostDestroy(activity);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
private void prepareReactApp() {
|
|
52
|
+
if (shouldCreateContext()) {
|
|
53
|
+
reactInstanceManager.createReactContextInBackground();
|
|
54
|
+
} else if (waitingForAppLaunchEvent) {
|
|
55
55
|
if (reactInstanceManager.getCurrentReactContext() != null) {
|
|
56
|
-
|
|
56
|
+
emitAppLaunched(reactInstanceManager.getCurrentReactContext());
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
private void emitAppLaunched(@NonNull ReactContext context) {
|
|
62
|
+
if (!isActivityReadyForUi) return;
|
|
63
|
+
waitingForAppLaunchEvent = false;
|
|
64
|
+
new EventEmitter(context).appLaunched();
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
private boolean shouldCreateContext() {
|
|
68
|
+
return !reactInstanceManager.hasStartedCreatingInitialContext();
|
|
69
|
+
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
@Override
|
|
72
|
+
public void onReactContextInitialized(final ReactContext context) {
|
|
73
73
|
emitAppLaunched(context);
|
|
74
|
-
|
|
75
|
-
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.uimanager.events.Event
|
|
4
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
5
|
+
|
|
6
|
+
open class RequestCloseModalEvent(viewTag: Int) : Event<RequestCloseModalEvent>(viewTag) {
|
|
7
|
+
|
|
8
|
+
companion object{
|
|
9
|
+
const val EVENT_NAME = "topRequestClose"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override fun getEventName(): String {
|
|
13
|
+
return EVENT_NAME
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
17
|
+
rctEventEmitter.receiveEvent(viewTag, eventName, null)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
open class ShowModalEvent(viewTag: Int) : Event<ShowModalEvent>(viewTag) {
|
|
22
|
+
|
|
23
|
+
companion object{
|
|
24
|
+
const val EVENT_NAME = "topShow"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override fun getEventName(): String {
|
|
28
|
+
return EVENT_NAME
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
32
|
+
rctEventEmitter.receiveEvent(viewTag, eventName, null)
|
|
33
|
+
}
|
|
34
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.view.MotionEvent
|
|
5
|
+
import android.view.View
|
|
6
|
+
import com.facebook.react.bridge.*
|
|
7
|
+
import com.facebook.react.uimanager.*
|
|
8
|
+
import com.facebook.react.uimanager.events.EventDispatcher
|
|
9
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
13
|
+
private var hasAdjustedSize = false
|
|
14
|
+
private var viewWidth = 0
|
|
15
|
+
private var viewHeight = 0
|
|
16
|
+
private val mJSTouchDispatcher = JSTouchDispatcher(this)
|
|
17
|
+
|
|
18
|
+
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
|
19
|
+
super.onSizeChanged(w, h, oldw, oldh)
|
|
20
|
+
viewWidth = w
|
|
21
|
+
viewHeight = h
|
|
22
|
+
this.updateFirstChildView()
|
|
23
|
+
}
|
|
24
|
+
private fun updateFirstChildView() {
|
|
25
|
+
if (this.childCount > 0) {
|
|
26
|
+
hasAdjustedSize = false
|
|
27
|
+
val viewTag = getChildAt(0).id
|
|
28
|
+
val reactContext: ReactContext = this.getReactContext()
|
|
29
|
+
reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) {
|
|
30
|
+
override fun runGuarded() {
|
|
31
|
+
val uiManager = this@ModalContentLayout.getReactContext().getNativeModule(
|
|
32
|
+
UIManagerModule::class.java
|
|
33
|
+
) as UIManagerModule
|
|
34
|
+
uiManager.updateNodeSize(
|
|
35
|
+
viewTag,
|
|
36
|
+
this@ModalContentLayout.viewWidth,
|
|
37
|
+
this@ModalContentLayout.viewHeight
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
} else {
|
|
42
|
+
hasAdjustedSize = true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override fun addView(child: View?, index: Int, params: LayoutParams?) {
|
|
47
|
+
super.addView(child, index, params)
|
|
48
|
+
if (hasAdjustedSize) {
|
|
49
|
+
updateFirstChildView()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) {
|
|
53
|
+
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
54
|
+
}
|
|
55
|
+
override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}
|
|
56
|
+
private fun getEventDispatcher(): EventDispatcher? {
|
|
57
|
+
val reactContext: ReactContext = this.getReactContext()
|
|
58
|
+
return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
override fun handleException(t: Throwable?) {
|
|
63
|
+
getReactContext().handleException(RuntimeException(t))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private fun getReactContext(): ReactContext {
|
|
67
|
+
return this.context as ReactContext
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {
|
|
71
|
+
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
72
|
+
return super.onInterceptTouchEvent(event)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
|
76
|
+
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
77
|
+
super.onTouchEvent(event)
|
|
78
|
+
return true
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalFrameLayout.kt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.widget.FrameLayout
|
|
4
|
+
import com.facebook.react.bridge.ReactContext
|
|
5
|
+
import com.reactnativenavigation.utils.StatusBarUtils
|
|
6
|
+
|
|
7
|
+
class ModalFrameLayout(context: ReactContext) : FrameLayout(context) {
|
|
8
|
+
val modalContentLayout = ModalContentLayout(context)
|
|
9
|
+
|
|
10
|
+
init {
|
|
11
|
+
addView(modalContentLayout, MarginLayoutParams(MarginLayoutParams.WRAP_CONTENT, MarginLayoutParams.WRAP_CONTENT)
|
|
12
|
+
.apply {
|
|
13
|
+
val translucent = context.currentActivity?.window?.let {
|
|
14
|
+
StatusBarUtils.isTranslucent(context.currentActivity?.window)
|
|
15
|
+
} ?: false
|
|
16
|
+
topMargin = if (translucent) 0 else StatusBarUtils.getStatusBarHeight(context)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.annotation.TargetApi
|
|
5
|
+
import android.view.View
|
|
6
|
+
import android.view.ViewGroup
|
|
7
|
+
import android.view.ViewStructure
|
|
8
|
+
import android.view.accessibility.AccessibilityEvent
|
|
9
|
+
import com.facebook.react.bridge.LifecycleEventListener
|
|
10
|
+
import com.facebook.react.bridge.ReactContext
|
|
11
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
12
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
|
+
import com.reactnativenavigation.options.Options
|
|
14
|
+
import com.reactnativenavigation.options.params.Bool
|
|
15
|
+
import com.reactnativenavigation.utils.CompatUtils
|
|
16
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.YellowBoxDelegate
|
|
17
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay
|
|
18
|
+
import java.util.*
|
|
19
|
+
|
|
20
|
+
@SuppressLint("ViewConstructor")
|
|
21
|
+
open class ModalHostLayout(reactContext: ThemedReactContext) : ViewGroup(reactContext), LifecycleEventListener {
|
|
22
|
+
val viewController = ModalLayoutController(
|
|
23
|
+
reactContext,
|
|
24
|
+
reactContext.currentActivity, CompatUtils.generateViewId().toString(),
|
|
25
|
+
YellowBoxDelegate(reactContext), Options().apply {
|
|
26
|
+
hardwareBack.dismissModalOnPress = Bool(false)
|
|
27
|
+
}, ViewControllerOverlay(reactContext),
|
|
28
|
+
getHostId = { this.id }
|
|
29
|
+
)
|
|
30
|
+
private val mHostView = viewController.view.modalContentLayout
|
|
31
|
+
|
|
32
|
+
init {
|
|
33
|
+
(context as ReactContext).addLifecycleEventListener(this)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@TargetApi(23)
|
|
37
|
+
override fun dispatchProvideStructure(structure: ViewStructure?) {
|
|
38
|
+
mHostView.dispatchProvideStructure(structure)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {}
|
|
42
|
+
|
|
43
|
+
override fun addView(child: View?, index: Int) {
|
|
44
|
+
UiThreadUtil.assertOnUiThread()
|
|
45
|
+
mHostView.addView(child, index)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun getChildCount(): Int {
|
|
49
|
+
return mHostView.childCount
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override fun getChildAt(index: Int): View? {
|
|
53
|
+
return mHostView.getChildAt(index)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
override fun removeView(child: View?) {
|
|
57
|
+
UiThreadUtil.assertOnUiThread()
|
|
58
|
+
mHostView.removeView(child)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun removeViewAt(index: Int) {
|
|
62
|
+
UiThreadUtil.assertOnUiThread()
|
|
63
|
+
val child = getChildAt(index)
|
|
64
|
+
mHostView.removeView(child)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override fun addChildrenForAccessibility(outChildren: ArrayList<View?>?) {}
|
|
68
|
+
|
|
69
|
+
override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent?): Boolean { return false }
|
|
70
|
+
|
|
71
|
+
open fun onDropInstance() { (this.context as ReactContext).removeLifecycleEventListener(this) }
|
|
72
|
+
|
|
73
|
+
override fun onHostResume() {}
|
|
74
|
+
|
|
75
|
+
override fun onHostPause() {}
|
|
76
|
+
|
|
77
|
+
override fun onHostDestroy() { onDropInstance() }
|
|
78
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalLayoutController.kt
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import com.facebook.react.bridge.ReactContext
|
|
5
|
+
import com.facebook.react.uimanager.UIManagerModule
|
|
6
|
+
import com.reactnativenavigation.options.Options
|
|
7
|
+
import com.reactnativenavigation.react.Constants
|
|
8
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController
|
|
9
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.YellowBoxDelegate
|
|
10
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay
|
|
11
|
+
|
|
12
|
+
class ModalLayoutController(
|
|
13
|
+
val reactContext: ReactContext,
|
|
14
|
+
activity: Activity?,
|
|
15
|
+
id: String?,
|
|
16
|
+
yellowBoxDelegate: YellowBoxDelegate?,
|
|
17
|
+
initialOptions: Options?,
|
|
18
|
+
overlay: ViewControllerOverlay?,
|
|
19
|
+
val getHostId: () -> Int
|
|
20
|
+
) : ViewController<ModalFrameLayout>(activity, id, yellowBoxDelegate, initialOptions, overlay) {
|
|
21
|
+
override fun isViewShown(): Boolean {
|
|
22
|
+
return !isDestroyed && view != null && view!!.isShown
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun isRendered(): Boolean {
|
|
26
|
+
return isViewCreated
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override fun getCurrentComponentName(): String = "ModalLayoutController"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
override fun createView(): ModalFrameLayout {
|
|
33
|
+
return ModalFrameLayout(reactContext)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun sendOnNavigationButtonPressed(buttonId: String?) {
|
|
37
|
+
if (buttonId == Constants.HARDWARE_BACK_BUTTON_ID) {
|
|
38
|
+
val dispatcher = reactContext.getNativeModule(
|
|
39
|
+
UIManagerModule::class.java
|
|
40
|
+
).eventDispatcher
|
|
41
|
+
dispatcher.dispatchEvent(RequestCloseModalEvent(getHostId()))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fun sendShowEvent() {
|
|
46
|
+
val dispatcher = reactContext.getNativeModule(
|
|
47
|
+
UIManagerModule::class.java
|
|
48
|
+
).eventDispatcher
|
|
49
|
+
dispatcher.dispatchEvent(ShowModalEvent(getHostId()))
|
|
50
|
+
}
|
|
51
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Point
|
|
5
|
+
import android.view.WindowManager
|
|
6
|
+
import com.facebook.infer.annotation.Assertions
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap
|
|
8
|
+
import com.facebook.react.common.MapBuilder
|
|
9
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
10
|
+
import com.facebook.react.uimanager.LayoutShadowNode
|
|
11
|
+
import com.facebook.react.uimanager.ReactShadowNodeImpl
|
|
12
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
14
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
15
|
+
import com.reactnativenavigation.options.ModalPresentationStyle
|
|
16
|
+
import com.reactnativenavigation.options.Options
|
|
17
|
+
import com.reactnativenavigation.options.params.Bool
|
|
18
|
+
import com.reactnativenavigation.options.parseTransitionAnimationOptions
|
|
19
|
+
import com.reactnativenavigation.options.parsers.JSONParser
|
|
20
|
+
import com.reactnativenavigation.react.CommandListener
|
|
21
|
+
import com.reactnativenavigation.react.CommandListenerAdapter
|
|
22
|
+
import com.reactnativenavigation.utils.StatusBarUtils
|
|
23
|
+
import com.reactnativenavigation.viewcontrollers.navigator.Navigator
|
|
24
|
+
|
|
25
|
+
private const val MODAL_MANAGER_NAME = "RNNModalViewManager"
|
|
26
|
+
|
|
27
|
+
@ReactModule(name = MODAL_MANAGER_NAME)
|
|
28
|
+
class ModalViewManager(private val navigator: Navigator) : ViewGroupManager<ModalHostLayout>() {
|
|
29
|
+
private val jsonParser = JSONParser()
|
|
30
|
+
override fun getName(): String = MODAL_MANAGER_NAME
|
|
31
|
+
|
|
32
|
+
override fun createViewInstance(reactContext: ThemedReactContext): ModalHostLayout {
|
|
33
|
+
return ModalHostLayout(reactContext)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun createShadowNodeInstance(): LayoutShadowNode {
|
|
37
|
+
return ModalHostShadowNode()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun getShadowNodeClass(): Class<out LayoutShadowNode> {
|
|
41
|
+
return ModalHostShadowNode::class.java
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override fun onDropViewInstance(modal: ModalHostLayout) {
|
|
45
|
+
super.onDropViewInstance(modal)
|
|
46
|
+
navigator.dismissModal(modal.viewController.id, CommandListenerAdapter())
|
|
47
|
+
modal.onDropInstance()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override fun onAfterUpdateTransaction(modal: ModalHostLayout) {
|
|
51
|
+
super.onAfterUpdateTransaction(modal)
|
|
52
|
+
navigator.showModal(modal.viewController, CommandListenerAdapter(object : CommandListener {
|
|
53
|
+
override fun onSuccess(childId: String?) {
|
|
54
|
+
modal.viewController.sendShowEvent()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun onError(message: String?) {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
|
|
64
|
+
return MapBuilder.builder<String, Any>()
|
|
65
|
+
.put(RequestCloseModalEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRequestClose"))
|
|
66
|
+
.put(ShowModalEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShow"))
|
|
67
|
+
.build()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@ReactProp(name = "animation")
|
|
71
|
+
fun setAnimation(modal: ModalHostLayout, animation: ReadableMap) {
|
|
72
|
+
modal.viewController.mergeOptions(Options().apply {
|
|
73
|
+
val animationJson = jsonParser.parse(animation)
|
|
74
|
+
val showModal = parseTransitionAnimationOptions(animationJson.optJSONObject("showModal"))
|
|
75
|
+
val dismissModal = parseTransitionAnimationOptions(animationJson.optJSONObject("dismissModal"))
|
|
76
|
+
this.animations.showModal = showModal
|
|
77
|
+
this.animations.dismissModal = dismissModal
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
@ReactProp(name = "blurOnUnmount")
|
|
81
|
+
fun setBlurOnUnmount(modal: ModalHostLayout, blurOnUnmount: Boolean) {
|
|
82
|
+
modal.viewController.mergeOptions(Options().apply {
|
|
83
|
+
this.modal.blurOnUnmount = Bool(blurOnUnmount)
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
@ReactProp(name = "transparent")
|
|
87
|
+
fun setTransparent(modal: ModalHostLayout, transparent: Boolean) {
|
|
88
|
+
modal.viewController.mergeOptions(Options().apply {
|
|
89
|
+
this.modal.presentationStyle = if(transparent) ModalPresentationStyle.OverCurrentContext else ModalPresentationStyle.None
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private fun getModalHostSize(context: Context): Point {
|
|
95
|
+
val MIN_POINT = Point()
|
|
96
|
+
val MAX_POINT = Point()
|
|
97
|
+
val SIZE_POINT = Point()
|
|
98
|
+
val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
|
99
|
+
val display = Assertions.assertNotNull(wm).defaultDisplay
|
|
100
|
+
// getCurrentSizeRange will return the min and max width and height that the window can be
|
|
101
|
+
display.getCurrentSizeRange(MIN_POINT, MAX_POINT)
|
|
102
|
+
// getSize will return the dimensions of the screen in its current orientation
|
|
103
|
+
display.getSize(SIZE_POINT)
|
|
104
|
+
val attrs = intArrayOf(android.R.attr.windowFullscreen)
|
|
105
|
+
val theme = context.theme
|
|
106
|
+
val ta = theme.obtainStyledAttributes(attrs)
|
|
107
|
+
val windowFullscreen = ta.getBoolean(0, false)
|
|
108
|
+
|
|
109
|
+
// We need to add the status bar height to the height if we have a fullscreen window,
|
|
110
|
+
// because Display.getCurrentSizeRange doesn't include it.
|
|
111
|
+
var statusBarHeight = 0
|
|
112
|
+
if (windowFullscreen) {
|
|
113
|
+
statusBarHeight = StatusBarUtils.getStatusBarHeight(context)
|
|
114
|
+
}
|
|
115
|
+
return if (SIZE_POINT.x < SIZE_POINT.y) {
|
|
116
|
+
// If we are vertical the width value comes from min width and height comes from max height
|
|
117
|
+
Point(MIN_POINT.x, MAX_POINT.y + statusBarHeight)
|
|
118
|
+
} else {
|
|
119
|
+
// If we are horizontal the width value comes from max width and height comes from min height
|
|
120
|
+
Point(MAX_POINT.x, MIN_POINT.y + statusBarHeight)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private class ModalHostShadowNode : LayoutShadowNode() {
|
|
125
|
+
override fun addChildAt(child: ReactShadowNodeImpl, i: Int) {
|
|
126
|
+
super.addChildAt(child, i)
|
|
127
|
+
val modalSize = getModalHostSize(themedContext)
|
|
128
|
+
child.setStyleWidth(modalSize.x.toFloat())
|
|
129
|
+
child.setStyleHeight(modalSize.y.toFloat())
|
|
130
|
+
}
|
|
131
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/utils/CoordinatorLayoutUtils.java
CHANGED
|
@@ -13,7 +13,7 @@ public class CoordinatorLayoutUtils {
|
|
|
13
13
|
return new CoordinatorLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
public static CoordinatorLayout.LayoutParams matchParentWithBehaviour(CoordinatorLayout.Behavior behavior) {
|
|
16
|
+
public static CoordinatorLayout.LayoutParams matchParentWithBehaviour(CoordinatorLayout.Behavior<?> behavior) {
|
|
17
17
|
CoordinatorLayout.LayoutParams lp = new CoordinatorLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
|
18
18
|
lp.setBehavior(behavior);
|
|
19
19
|
return lp;
|
|
@@ -33,7 +33,7 @@ public class ReflectionUtils {
|
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
private static Field getField(Class clazz, String name) {
|
|
36
|
+
private static Field getField(Class<?> clazz, String name) {
|
|
37
37
|
try {
|
|
38
38
|
return clazz.getDeclaredField(name);
|
|
39
39
|
} catch (NoSuchFieldException nsfe) {
|
|
@@ -7,7 +7,7 @@ import java.util.Collection;
|
|
|
7
7
|
import static com.reactnativenavigation.utils.CollectionUtils.reduce;
|
|
8
8
|
|
|
9
9
|
public class RenderChecker {
|
|
10
|
-
public boolean areRendered(Collection<ViewController
|
|
10
|
+
public boolean areRendered(Collection<ViewController<?>> components) {
|
|
11
11
|
return reduce(components, true, ViewController::isRendered);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -9,8 +9,6 @@ import android.view.WindowManager;
|
|
|
9
9
|
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
|
|
10
10
|
import static com.reactnativenavigation.utils.UiUtils.dpToPx;
|
|
11
11
|
|
|
12
|
-
import androidx.annotation.VisibleForTesting;
|
|
13
|
-
|
|
14
12
|
public class StatusBarUtils {
|
|
15
13
|
private static final int STATUS_BAR_HEIGHT_M = 24;
|
|
16
14
|
private static final int STATUS_BAR_HEIGHT_L = 25;
|
|
@@ -11,7 +11,6 @@ import android.view.WindowManager;
|
|
|
11
11
|
|
|
12
12
|
import androidx.annotation.NonNull;
|
|
13
13
|
import androidx.annotation.Nullable;
|
|
14
|
-
import androidx.annotation.VisibleForTesting;
|
|
15
14
|
|
|
16
15
|
public class UiUtils {
|
|
17
16
|
private static final int DEFAULT_TOOLBAR_HEIGHT = 56;
|
|
@@ -81,13 +80,13 @@ public class UiUtils {
|
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
public static void runOnMainThread(Runnable runnable) {
|
|
84
|
+
new Handler(Looper.getMainLooper()).post(runnable);
|
|
85
|
+
}
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
public static float getWindowHeight(Context context) {
|
|
89
88
|
return getDisplayMetrics(context).heightPixels;
|
|
90
|
-
|
|
89
|
+
}
|
|
91
90
|
|
|
92
91
|
public static float getWindowWidth(Context context) {
|
|
93
92
|
return getDisplayMetrics(context).widthPixels;
|
|
@@ -2,9 +2,6 @@ package com.reactnativenavigation.utils
|
|
|
2
2
|
|
|
3
3
|
import android.view.View
|
|
4
4
|
import android.view.ViewParent
|
|
5
|
-
import androidx.core.view.doOnLayout
|
|
6
|
-
import kotlin.coroutines.resume
|
|
7
|
-
import kotlin.coroutines.suspendCoroutine
|
|
8
5
|
|
|
9
6
|
val ViewParent.scaleX: Float
|
|
10
7
|
get() = (this as View).scaleX
|
|
@@ -3,7 +3,6 @@ package com.reactnativenavigation.utils;
|
|
|
3
3
|
import android.graphics.Point;
|
|
4
4
|
import android.view.View;
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
|
-
import android.view.ViewManager;
|
|
7
6
|
import android.view.ViewParent;
|
|
8
7
|
|
|
9
8
|
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
|
|
@@ -34,11 +33,11 @@ public class ViewUtils {
|
|
|
34
33
|
return null;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class clazz) {
|
|
36
|
+
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class<?> clazz) {
|
|
38
37
|
return findChildrenByClassRecursive(root, clazz, child -> true);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class clazz, Matcher<T> matcher) {
|
|
40
|
+
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class<?> clazz, Matcher<T> matcher) {
|
|
42
41
|
ArrayList<T> ret = new ArrayList<>();
|
|
43
42
|
for (int i = 0; i < root.getChildCount(); i++) {
|
|
44
43
|
View view = root.getChildAt(i);
|
|
@@ -56,7 +55,7 @@ public class ViewUtils {
|
|
|
56
55
|
return findChildrenByClass(root, clazz, child -> true);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
public static <T> List<T> findChildrenByClass(ViewGroup root, Class clazz, Matcher<T> matcher) {
|
|
58
|
+
public static <T> List<T> findChildrenByClass(ViewGroup root, Class<?> clazz, Matcher<T> matcher) {
|
|
60
59
|
List<T> ret = new ArrayList<>();
|
|
61
60
|
for (int i = 0; i < root.getChildCount(); i++) {
|
|
62
61
|
View child = root.getChildAt(i);
|
|
@@ -114,7 +113,7 @@ public class ViewUtils {
|
|
|
114
113
|
}
|
|
115
114
|
throw new RuntimeException(view.getBackground().getClass().getSimpleName() + " is not ReactViewBackgroundDrawable");
|
|
116
115
|
}
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
|
|
119
118
|
public static boolean isVisible(View view) {
|
|
120
119
|
return perform(view, false, v -> v.getVisibility() == View.VISIBLE);
|