react-native-navigation 7.42.0-snapshot.1529 → 7.99.1-testbla
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/lib/Mock/Components/ComponentScreen.tsx +15 -29
- package/lib/Mock/Components/LayoutComponent.tsx +2 -2
- package/lib/Mock/index.js +2 -2
- package/lib/android/app/build.gradle +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +4 -20
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +2 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +10 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +14 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +13 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +11 -24
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +10 -13
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/{TopBarAppearanceAnimator.kt → TopBarAnimator.kt} +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarCollapseBehavior.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +27 -122
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt +4 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +6 -79
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/{BaseViewAppearanceAnimator.kt → BaseViewAnimator.kt} +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/DefaultViewAnimatorCreator.kt +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewAnimatorCreator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorAnimator.kt +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorEvaluator.kt +2 -4
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +6 -6
- package/lib/dist/Mock/Application.d.ts +6 -4
- package/lib/dist/Mock/Components/BottomTabs.d.ts +13 -9
- package/lib/dist/Mock/Components/ComponentScreen.d.ts +7 -5
- package/lib/dist/Mock/Components/ComponentScreen.js +3 -10
- package/lib/dist/Mock/Components/LayoutComponent.d.ts +13 -9
- package/lib/dist/Mock/Components/Modals.d.ts +13 -9
- package/lib/dist/Mock/Components/NavigationButton.d.ts +15 -11
- package/lib/dist/Mock/Components/Overlays.d.ts +13 -9
- package/lib/dist/Mock/Components/Stack.d.ts +13 -9
- package/lib/dist/Mock/Components/TopBar.d.ts +9 -7
- package/lib/dist/Mock/connect.js +1 -2
- package/lib/dist/Mock/index.js +2 -2
- package/lib/dist/src/adapters/NativeEventsReceiver.js +1 -1
- package/lib/dist/src/adapters/TouchablePreview.d.ts +2 -2
- package/lib/dist/src/commands/LayoutType.js +1 -1
- package/lib/dist/src/commands/OptionsProcessor.js +1 -8
- package/lib/dist/src/components/Modal.d.ts +1 -1
- package/lib/dist/src/interfaces/CommandName.js +1 -1
- package/lib/dist/src/interfaces/Options.d.ts +3 -33
- package/lib/dist/src/interfaces/Options.js +2 -2
- package/lib/dist/src/types.d.ts +0 -1
- package/lib/ios/BottomTabsBasePresenter.m +2 -3
- package/lib/ios/RNNAppDelegate.mm +2 -1
- package/lib/ios/RNNConvert.h +0 -2
- package/lib/ios/RNNConvert.m +0 -4
- package/lib/ios/RNNStackPresenter.m +2 -3
- package/lib/src/adapters/NativeEventsReceiver.ts +3 -3
- package/lib/src/adapters/TouchablePreview.tsx +3 -3
- package/lib/src/commands/OptionsProcessor.ts +2 -13
- package/lib/src/interfaces/Options.ts +3 -38
- package/package.json +31 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/FeatureToggles.kt +0 -60
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt +0 -19
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarController.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarPresenter.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ColorAnimator.kt +0 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewBkgColorProperty.kt +0 -17
|
@@ -20,8 +20,6 @@ import {
|
|
|
20
20
|
OptionsSearchBar,
|
|
21
21
|
OptionsTopBar,
|
|
22
22
|
StackAnimationOptions,
|
|
23
|
-
StatusBarAnimationOptions,
|
|
24
|
-
TopBarAnimationOptions,
|
|
25
23
|
ViewAnimationOptions,
|
|
26
24
|
} from '../interfaces/Options';
|
|
27
25
|
import { Deprecations } from './Deprecations';
|
|
@@ -119,7 +117,7 @@ export class OptionsProcessor {
|
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
private processColor(key: string, value: any, options: Record<string, any>) {
|
|
122
|
-
if (
|
|
120
|
+
if (isEqual(key, 'color') || endsWith(key, 'Color')) {
|
|
123
121
|
if (Platform.OS === 'ios') this.processColorIOS(key, value, options);
|
|
124
122
|
else this.processColorAndroid(key, value, options);
|
|
125
123
|
}
|
|
@@ -401,16 +399,7 @@ export class OptionsProcessor {
|
|
|
401
399
|
}
|
|
402
400
|
if (animation.topBar && !has(animation, 'topBar.enter') && !has(animation, 'topBar.exit')) {
|
|
403
401
|
parentOptions.push!!.topBar = {
|
|
404
|
-
enter: animation.topBar as
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
if (
|
|
408
|
-
animation.statusBar &&
|
|
409
|
-
!has(animation, 'statusBar.enter') &&
|
|
410
|
-
!has(animation, 'statusBar.exit')
|
|
411
|
-
) {
|
|
412
|
-
parentOptions.push!!.statusBar = {
|
|
413
|
-
enter: animation.statusBar as StatusBarAnimationOptions,
|
|
402
|
+
enter: animation.topBar as ViewAnimationOptions,
|
|
414
403
|
};
|
|
415
404
|
}
|
|
416
405
|
if (
|
|
@@ -1267,13 +1267,6 @@ export interface IconInsets {
|
|
|
1267
1267
|
right?: number;
|
|
1268
1268
|
}
|
|
1269
1269
|
|
|
1270
|
-
export interface ColorAnimationOptions {
|
|
1271
|
-
/**
|
|
1272
|
-
* Color duration time; Default is as determined by the OS
|
|
1273
|
-
*/
|
|
1274
|
-
duration?: number;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
1270
|
export interface ViewAnimationOptions extends ScreenAnimationOptions {
|
|
1278
1271
|
/**
|
|
1279
1272
|
* ID of the Top Bar we want to animate
|
|
@@ -1281,24 +1274,6 @@ export interface ViewAnimationOptions extends ScreenAnimationOptions {
|
|
|
1281
1274
|
id?: string;
|
|
1282
1275
|
}
|
|
1283
1276
|
|
|
1284
|
-
export interface TopBarAnimationOptions extends ViewAnimationOptions {
|
|
1285
|
-
/**
|
|
1286
|
-
* Animation of the top-bar's background color, in case the top-bar background color
|
|
1287
|
-
* has been explicitly specified.
|
|
1288
|
-
*
|
|
1289
|
-
* Applicable only in transition of screens with color (non-component) backgrounds.
|
|
1290
|
-
*/
|
|
1291
|
-
bkgColor?: ColorAnimationOptions;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
export interface StatusBarAnimationOptions extends ViewAnimationOptions {
|
|
1295
|
-
/**
|
|
1296
|
-
* Animation of the status-bar's background color, in case its background color
|
|
1297
|
-
* has been explicitly specified.
|
|
1298
|
-
*/
|
|
1299
|
-
bkgColor?: ColorAnimationOptions;
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
1277
|
export interface EnterExitAnimationOptions {
|
|
1303
1278
|
/**
|
|
1304
1279
|
* Animate opening component
|
|
@@ -1357,20 +1332,10 @@ export interface StackAnimationOptions {
|
|
|
1357
1332
|
* Configure animations for the top bar
|
|
1358
1333
|
*/
|
|
1359
1334
|
topBar?:
|
|
1360
|
-
|
|
|
1361
|
-
| {
|
|
1362
|
-
enter?: TopBarAnimationOptions;
|
|
1363
|
-
exit?: TopBarAnimationOptions;
|
|
1364
|
-
};
|
|
1365
|
-
/**
|
|
1366
|
-
* Configure animations for the status bar (typically aligned
|
|
1367
|
-
* with the top-bar's)
|
|
1368
|
-
*/
|
|
1369
|
-
statusBar?:
|
|
1370
|
-
| StatusBarAnimationOptions
|
|
1335
|
+
| ViewAnimationOptions
|
|
1371
1336
|
| {
|
|
1372
|
-
enter?:
|
|
1373
|
-
exit?:
|
|
1337
|
+
enter?: ViewAnimationOptions;
|
|
1338
|
+
exit?: ViewAnimationOptions;
|
|
1374
1339
|
};
|
|
1375
1340
|
/**
|
|
1376
1341
|
* Configure animations for the bottom tabs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.99.1-testbla",
|
|
4
4
|
"description": "React Native Navigation - truly native navigation for iOS and Android",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"nativePackage": true,
|
|
@@ -64,43 +64,40 @@
|
|
|
64
64
|
"hoist-non-react-statics": "3.x.x",
|
|
65
65
|
"lodash": "4.17.x",
|
|
66
66
|
"prop-types": "15.x.x",
|
|
67
|
-
"react-lifecycles-compat": "
|
|
67
|
+
"react-lifecycles-compat": "2.0.0",
|
|
68
68
|
"tslib": "1.9.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@babel/core": "
|
|
71
|
+
"@babel/core": "7.22.9",
|
|
72
72
|
"@babel/plugin-proposal-export-default-from": "7.10.1",
|
|
73
73
|
"@babel/plugin-proposal-export-namespace-from": "7.10.1",
|
|
74
|
-
"@babel/
|
|
75
|
-
"@babel/
|
|
76
|
-
"@babel/
|
|
77
|
-
"@react-native-
|
|
78
|
-
"@react-native
|
|
79
|
-
"@react-native
|
|
80
|
-
"@react-native-community/
|
|
81
|
-
"@react-native-community/
|
|
82
|
-
"@react-native-community/
|
|
83
|
-
"@react-native/
|
|
84
|
-
"@react-native/eslint-config": "0.76.6",
|
|
85
|
-
"@react-native/metro-config": "0.76.6",
|
|
86
|
-
"@react-native/typescript-config": "0.76.6",
|
|
74
|
+
"@babel/runtime": "7.22.6",
|
|
75
|
+
"@babel/types": "7.22.5",
|
|
76
|
+
"@babel/preset-env": "^7.22.9",
|
|
77
|
+
"@react-native/metro-config": "^0.73.2",
|
|
78
|
+
"@react-native/babel-preset": "^0.73.18",
|
|
79
|
+
"@react-native/typescript-config": "^0.73.1",
|
|
80
|
+
"@react-native-community/blur": "^4.4.1",
|
|
81
|
+
"@react-native-community/datetimepicker": "^3.4.7",
|
|
82
|
+
"@react-native-community/eslint-config": "2.0.0",
|
|
83
|
+
"@react-native-community/netinfo": "^5.9.4",
|
|
87
84
|
"@testing-library/jest-native": "^5.4.2",
|
|
88
|
-
"@testing-library/react-native": "^
|
|
89
|
-
"@types/hoist-non-react-statics": "^3.
|
|
85
|
+
"@testing-library/react-native": "^12.0.1",
|
|
86
|
+
"@types/hoist-non-react-statics": "^3.0.1",
|
|
90
87
|
"@types/jasmine": "3.5.10",
|
|
91
88
|
"@types/jest": "27.0.2",
|
|
92
89
|
"@types/lodash": "^4.14.149",
|
|
93
|
-
"@types/react": "
|
|
94
|
-
"@types/react-
|
|
95
|
-
"@
|
|
96
|
-
"@typescript-eslint/
|
|
90
|
+
"@types/react": "16.9.41",
|
|
91
|
+
"@types/react-native": "0.63.1",
|
|
92
|
+
"@types/react-test-renderer": "16.9.2",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "4.33.0",
|
|
94
|
+
"@typescript-eslint/parser": "4.33.0",
|
|
97
95
|
"babel-jest": "^27.0.0",
|
|
98
96
|
"clang-format": "^1.4.0",
|
|
99
|
-
"detox": "20.
|
|
97
|
+
"detox": "20.19.5",
|
|
100
98
|
"detox-testing-library-rnn-adapter": "^2.0.3",
|
|
101
|
-
"eslint": "
|
|
99
|
+
"eslint": "7.32.0",
|
|
102
100
|
"eslint-config-prettier": "6.11.0",
|
|
103
|
-
"eslint-formatter-codeframe": "^7.32.1",
|
|
104
101
|
"eslint-plugin-prettier": "3.1.4",
|
|
105
102
|
"github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58",
|
|
106
103
|
"husky": "4.2.5",
|
|
@@ -110,22 +107,22 @@
|
|
|
110
107
|
"metro-react-native-babel-preset": "^0.76.2",
|
|
111
108
|
"pixelmatch": "^5.2.1",
|
|
112
109
|
"pngjs": "^6.0.0",
|
|
113
|
-
"prettier": "2.
|
|
114
|
-
"react": "18.
|
|
115
|
-
"react-native": "0.
|
|
110
|
+
"prettier": "2.1.2",
|
|
111
|
+
"react": "18.2.0",
|
|
112
|
+
"react-native": "0.73.3",
|
|
116
113
|
"react-native-fast-image": "^8.6.3",
|
|
117
|
-
"react-native-gesture-handler": "
|
|
118
|
-
"react-native-reanimated": "3.16.
|
|
114
|
+
"react-native-gesture-handler": "2.14.1",
|
|
115
|
+
"react-native-reanimated": "3.16.1",
|
|
119
116
|
"react-native-ui-lib": "7.3.6",
|
|
120
117
|
"react-redux": "5.x.x",
|
|
121
|
-
"react-test-renderer": "18.
|
|
118
|
+
"react-test-renderer": "18.2.0",
|
|
122
119
|
"redux": "3.x.x",
|
|
123
120
|
"remx": "3.x.x",
|
|
124
121
|
"semver": "5.x.x",
|
|
125
122
|
"shell-utils": "1.x.x",
|
|
126
123
|
"ts-mockito": "^2.3.1",
|
|
127
124
|
"typedoc": "0.x.x",
|
|
128
|
-
"typescript": "5.
|
|
125
|
+
"typescript": "5.5.4"
|
|
129
126
|
},
|
|
130
127
|
"husky": {
|
|
131
128
|
"hooks": {
|
|
@@ -171,7 +168,7 @@
|
|
|
171
168
|
"emulator": {
|
|
172
169
|
"type": "android.emulator",
|
|
173
170
|
"device": {
|
|
174
|
-
"avdName": "
|
|
171
|
+
"avdName": "Pixel_API_28"
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
},
|
|
@@ -191,10 +188,7 @@
|
|
|
191
188
|
"type": "android.apk",
|
|
192
189
|
"binaryPath": "playground/android/app/build/outputs/apk/debug/app-debug.apk",
|
|
193
190
|
"start": "npm start -- --e2e",
|
|
194
|
-
"build": "cd playground/android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug"
|
|
195
|
-
"reversePorts": [
|
|
196
|
-
8081
|
|
197
|
-
]
|
|
191
|
+
"build": "cd playground/android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug"
|
|
198
192
|
},
|
|
199
193
|
"android.release": {
|
|
200
194
|
"type": "android.apk",
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.VisibleForTesting
|
|
4
|
-
|
|
5
|
-
enum class RNNToggles {
|
|
6
|
-
TOP_BAR_COLOR_ANIMATION,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
private val ToggleDefaults = mapOf(
|
|
10
|
-
RNNToggles.TOP_BAR_COLOR_ANIMATION to false
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
object RNNFeatureToggles {
|
|
14
|
-
private var init = false
|
|
15
|
-
private var toggles = mutableMapOf<RNNToggles, Boolean>()
|
|
16
|
-
|
|
17
|
-
@JvmStatic
|
|
18
|
-
fun init() {
|
|
19
|
-
assertNotInitialized()
|
|
20
|
-
|
|
21
|
-
init = true
|
|
22
|
-
toggles = ToggleDefaults.toMutableMap()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@JvmStatic
|
|
26
|
-
fun init(overrides: Map<RNNToggles, Boolean>) {
|
|
27
|
-
init()
|
|
28
|
-
this.toggles.putAll(overrides)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@JvmStatic
|
|
32
|
-
fun init(vararg overrides: Pair<RNNToggles, Boolean>) {
|
|
33
|
-
init(mapOf(*overrides))
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@JvmStatic
|
|
37
|
-
fun isEnabled(toggleName: RNNToggles): Boolean {
|
|
38
|
-
assertInitialized()
|
|
39
|
-
return toggles.getOrElse(toggleName) { false }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@VisibleForTesting
|
|
43
|
-
@JvmStatic
|
|
44
|
-
fun clear() {
|
|
45
|
-
init = false
|
|
46
|
-
toggles.clear()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private fun assertNotInitialized() {
|
|
50
|
-
if (init) {
|
|
51
|
-
throw IllegalStateException("FeatureToggles already initialized")
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private fun assertInitialized() {
|
|
56
|
-
if (!init) {
|
|
57
|
-
throw IllegalStateException("FeatureToggles not initialized")
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.utils
|
|
2
|
-
|
|
3
|
-
import android.animation.Animator
|
|
4
|
-
|
|
5
|
-
open class StubAnimationListener: Animator.AnimatorListener {
|
|
6
|
-
override fun onAnimationStart(animation: Animator) {}
|
|
7
|
-
override fun onAnimationEnd(animation: Animator) {}
|
|
8
|
-
override fun onAnimationCancel(animation: Animator) {}
|
|
9
|
-
override fun onAnimationRepeat(animation: Animator) {}
|
|
10
|
-
|
|
11
|
-
companion object {
|
|
12
|
-
@JvmStatic
|
|
13
|
-
fun onAnimatorEnd(onEnd: (animation: Animator) -> Unit) = object: StubAnimationListener() {
|
|
14
|
-
override fun onAnimationEnd(animation: Animator) {
|
|
15
|
-
onEnd(animation)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.viewcontrollers.stack.statusbar
|
|
2
|
-
|
|
3
|
-
import android.animation.Animator
|
|
4
|
-
import com.reactnativenavigation.options.Options
|
|
5
|
-
|
|
6
|
-
interface StatusBarController {
|
|
7
|
-
fun getStatusBarPushAnimation(appearingOptions: Options): Animator?
|
|
8
|
-
fun getStatusBarPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator?
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.viewcontrollers.stack.statusbar
|
|
2
|
-
|
|
3
|
-
import android.animation.Animator
|
|
4
|
-
import com.reactnativenavigation.options.Options
|
|
5
|
-
|
|
6
|
-
interface StatusBarPresenter {
|
|
7
|
-
fun getStatusBarPushAnimation(appearingOptions: Options): Animator?
|
|
8
|
-
fun getStatusBarPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator?
|
|
9
|
-
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ColorAnimator.kt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.views.animations
|
|
2
|
-
|
|
3
|
-
import android.animation.ObjectAnimator
|
|
4
|
-
import android.animation.ValueAnimator
|
|
5
|
-
import android.view.View
|
|
6
|
-
|
|
7
|
-
class ColorAnimator {
|
|
8
|
-
fun getAnimation(from: Int, to: Int): ValueAnimator = createObjectAnimator(null, from, to)
|
|
9
|
-
fun getAnimation(view: View, from: Int, to: Int): ValueAnimator = createObjectAnimator(view, from, to)
|
|
10
|
-
|
|
11
|
-
private fun createObjectAnimator(view: View?, from: Int, to: Int) =
|
|
12
|
-
if (view == null) {
|
|
13
|
-
ObjectAnimator.ofArgb(from, to)
|
|
14
|
-
} else {
|
|
15
|
-
ObjectAnimator.ofArgb(
|
|
16
|
-
view,
|
|
17
|
-
view.BkgColorProperty,
|
|
18
|
-
from,
|
|
19
|
-
to,
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation.views.animations
|
|
2
|
-
|
|
3
|
-
import android.graphics.drawable.ColorDrawable
|
|
4
|
-
import android.util.Property
|
|
5
|
-
import android.view.View
|
|
6
|
-
|
|
7
|
-
val View.BkgColorProperty: Property<View, Int>
|
|
8
|
-
// TODO Replace Property with IntProperty (Requires SDK≥24)
|
|
9
|
-
get() = object: Property<View, Int>(Int::class.java, "bkgColor") {
|
|
10
|
-
override fun set(view: View, value: Int) {
|
|
11
|
-
(view.background as ColorDrawable).color = value
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
override fun get(view: View): Int {
|
|
15
|
-
return (view.background as ColorDrawable).color
|
|
16
|
-
}
|
|
17
|
-
}
|