@webority-technologies/mobile 0.0.12 → 0.0.13
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/commonjs/components/Badge/Badge.js +1 -1
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +11 -3
- package/lib/commonjs/components/DatePicker/DatePicker.js +18 -12
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +14 -9
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/Modal/Modal.js +4 -4
- package/lib/commonjs/components/OTPInput/OTPInput.js +29 -9
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +23 -28
- package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
- package/lib/commonjs/components/Slider/Slider.js +11 -11
- package/lib/commonjs/components/Stepper/Stepper.js +10 -4
- package/lib/commonjs/components/Tabs/Tabs.js +7 -5
- package/lib/commonjs/components/TimePicker/TimePicker.js +3 -3
- package/lib/commonjs/components/Toast/Toast.js +2 -2
- package/lib/commonjs/theme/animatedValue.js +20 -1
- package/lib/commonjs/theme/index.js +8 -1
- package/lib/module/components/Badge/Badge.js +2 -2
- package/lib/module/components/BottomNavigation/BottomNavigation.js +11 -3
- package/lib/module/components/DatePicker/DatePicker.js +19 -13
- package/lib/module/components/DateRangePicker/DateRangePicker.js +15 -10
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +2 -2
- package/lib/module/components/Input/Input.js +2 -2
- package/lib/module/components/Modal/Modal.js +5 -5
- package/lib/module/components/OTPInput/OTPInput.js +30 -10
- package/lib/module/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/module/components/SegmentedControl/SegmentedControl.js +24 -29
- package/lib/module/components/Skeleton/Skeleton.js +2 -2
- package/lib/module/components/Slider/Slider.js +12 -12
- package/lib/module/components/Stepper/Stepper.js +10 -4
- package/lib/module/components/Tabs/Tabs.js +7 -5
- package/lib/module/components/TimePicker/TimePicker.js +4 -4
- package/lib/module/components/Toast/Toast.js +3 -3
- package/lib/module/theme/animatedValue.js +18 -0
- package/lib/module/theme/index.js +1 -1
- package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +7 -0
- package/lib/typescript/commonjs/theme/animatedValue.d.ts +11 -0
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +7 -0
- package/lib/typescript/module/theme/animatedValue.d.ts +11 -0
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -42,15 +42,17 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (!activeLayout) return;
|
|
44
44
|
const spring = theme.motion.spring.snappy;
|
|
45
|
-
Animated.parallel([
|
|
45
|
+
Animated.parallel([
|
|
46
|
+
// Both must use the JS driver: width can't run on native, and mixing
|
|
47
|
+
// drivers on the same view (transform native + width JS) trips RN's
|
|
48
|
+
// "node already moved to native" guard under the new architecture.
|
|
49
|
+
Animated.spring(indicatorTranslateX, {
|
|
46
50
|
toValue: activeLayout.x,
|
|
47
51
|
damping: spring.damping,
|
|
48
52
|
stiffness: spring.stiffness,
|
|
49
53
|
mass: spring.mass,
|
|
50
|
-
useNativeDriver:
|
|
51
|
-
}),
|
|
52
|
-
// width is a layout prop — must run on JS thread (useNativeDriver: false).
|
|
53
|
-
Animated.spring(indicatorWidth, {
|
|
54
|
+
useNativeDriver: false
|
|
55
|
+
}), Animated.spring(indicatorWidth, {
|
|
54
56
|
toValue: activeLayout.width,
|
|
55
57
|
damping: spring.damping,
|
|
56
58
|
stiffness: spring.stiffness,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { AccessibilityInfo, Animated, Easing, FlatList, Modal, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
5
|
+
import { useTheme, createAnimatedValue, setNativeValue } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import Button from "../Button/Button.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -68,7 +68,7 @@ const Wheel = ({
|
|
|
68
68
|
if (lastIndexRef.current !== selectedIndex) {
|
|
69
69
|
lastIndexRef.current = selectedIndex;
|
|
70
70
|
const offset = selectedIndex * ITEM_HEIGHT;
|
|
71
|
-
scrollY
|
|
71
|
+
setNativeValue(scrollY, offset);
|
|
72
72
|
// Defer to next frame so FlatList has measured.
|
|
73
73
|
requestAnimationFrame(() => {
|
|
74
74
|
listRef.current?.scrollToOffset({
|
|
@@ -275,8 +275,8 @@ const TimePicker = ({
|
|
|
275
275
|
useNativeDriver: true
|
|
276
276
|
})]).start();
|
|
277
277
|
} else {
|
|
278
|
-
opacity
|
|
279
|
-
translateY
|
|
278
|
+
setNativeValue(opacity, 0);
|
|
279
|
+
setNativeValue(translateY, 40);
|
|
280
280
|
}
|
|
281
281
|
}, [visible, opacity, translateY, theme.motion]);
|
|
282
282
|
const announce = useCallback(msg => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, PanResponder, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { fontFor, useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme, createAnimatedValue, setNativeValue } from "../../theme/index.js";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
const SWIPE_DISMISS_THRESHOLD = 80;
|
|
8
8
|
const SWIPE_VELOCITY_THRESHOLD = 0.5;
|
|
@@ -68,9 +68,9 @@ const Toast = ({
|
|
|
68
68
|
const panResponder = useMemo(() => PanResponder.create({
|
|
69
69
|
onMoveShouldSetPanResponder: (_evt, gesture) => Math.abs(gesture.dx) > Math.abs(gesture.dy) && Math.abs(gesture.dx) > 6,
|
|
70
70
|
onPanResponderMove: (_evt, gesture) => {
|
|
71
|
-
translateX
|
|
71
|
+
setNativeValue(translateX, gesture.dx);
|
|
72
72
|
const fade = 1 - Math.min(Math.abs(gesture.dx) / 200, 1) * 0.7;
|
|
73
|
-
opacity
|
|
73
|
+
setNativeValue(opacity, fade);
|
|
74
74
|
},
|
|
75
75
|
onPanResponderRelease: (_evt, gesture) => {
|
|
76
76
|
if (Math.abs(gesture.dx) > SWIPE_DISMISS_THRESHOLD || Math.abs(gesture.vx) > SWIPE_VELOCITY_THRESHOLD) {
|
|
@@ -21,4 +21,22 @@ import { Animated } from 'react-native';
|
|
|
21
21
|
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
22
22
|
*/
|
|
23
23
|
export const createAnimatedValue = (initial, config) => Object.seal(new Animated.Value(initial, config));
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Set an `Animated.Value` to a target without going through JS.
|
|
27
|
+
*
|
|
28
|
+
* Once a value has been driven by `useNativeDriver: true`, the underlying
|
|
29
|
+
* native node owns it — calling `value.setValue(x)` from JS throws
|
|
30
|
+
* "Attempting to run JS driven animation on animated node that has been moved to native".
|
|
31
|
+
* Use this helper for any value that is *also* used in a native-driven
|
|
32
|
+
* `Animated.timing/spring`. A zero-duration native timing routes the update
|
|
33
|
+
* through the same driver and stays valid across re-mounts and re-runs.
|
|
34
|
+
*/
|
|
35
|
+
export const setNativeValue = (value, to) => {
|
|
36
|
+
Animated.timing(value, {
|
|
37
|
+
toValue: to,
|
|
38
|
+
duration: 0,
|
|
39
|
+
useNativeDriver: true
|
|
40
|
+
}).start();
|
|
41
|
+
};
|
|
24
42
|
//# sourceMappingURL=animatedValue.js.map
|
|
@@ -46,6 +46,6 @@ export { ThemeProvider, useTheme, useThemeMode } from "./ThemeContext.js";
|
|
|
46
46
|
export { lightTheme, darkTheme } from "./tokens.js";
|
|
47
47
|
export { mergeTheme } from "./merge.js";
|
|
48
48
|
export { fontFor } from "./textStyle.js";
|
|
49
|
-
export { createAnimatedValue } from "./animatedValue.js";
|
|
49
|
+
export { createAnimatedValue, setNativeValue } from "./animatedValue.js";
|
|
50
50
|
export { Gradient, isGradientAvailable } from "./Gradient.js";
|
|
51
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,6 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
4
4
|
import type { HapticType } from '../../utils';
|
|
5
5
|
export type BottomNavigationVariant = 'pill' | 'underline';
|
|
6
|
+
export type BottomNavigationIndicatorPosition = 'top' | 'bottom';
|
|
6
7
|
export type TabBadge = number | string | boolean | null;
|
|
7
8
|
export interface TabIconProps {
|
|
8
9
|
color: string;
|
|
@@ -23,6 +24,12 @@ export interface BottomNavigationProps {
|
|
|
23
24
|
haptic?: HapticType | false;
|
|
24
25
|
showLabels?: boolean;
|
|
25
26
|
variant?: BottomNavigationVariant;
|
|
27
|
+
/**
|
|
28
|
+
* Where the active-tab line sits, for variants that draw a line
|
|
29
|
+
* (currently `underline`). Default `'bottom'` preserves the legacy look;
|
|
30
|
+
* `'top'` flips the line to sit just above the tab row.
|
|
31
|
+
*/
|
|
32
|
+
indicatorPosition?: BottomNavigationIndicatorPosition;
|
|
26
33
|
style?: StyleProp<ViewStyle>;
|
|
27
34
|
indicatorStyle?: StyleProp<ViewStyle>;
|
|
28
35
|
labelStyle?: StyleProp<TextStyle>;
|
|
@@ -18,4 +18,15 @@ import { Animated } from 'react-native';
|
|
|
18
18
|
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
19
19
|
*/
|
|
20
20
|
export declare const createAnimatedValue: (initial: number, config?: ConstructorParameters<typeof Animated.Value>[1]) => Animated.Value;
|
|
21
|
+
/**
|
|
22
|
+
* Set an `Animated.Value` to a target without going through JS.
|
|
23
|
+
*
|
|
24
|
+
* Once a value has been driven by `useNativeDriver: true`, the underlying
|
|
25
|
+
* native node owns it — calling `value.setValue(x)` from JS throws
|
|
26
|
+
* "Attempting to run JS driven animation on animated node that has been moved to native".
|
|
27
|
+
* Use this helper for any value that is *also* used in a native-driven
|
|
28
|
+
* `Animated.timing/spring`. A zero-duration native timing routes the update
|
|
29
|
+
* through the same driver and stays valid across re-mounts and re-runs.
|
|
30
|
+
*/
|
|
31
|
+
export declare const setNativeValue: (value: Animated.Value, to: number) => void;
|
|
21
32
|
//# sourceMappingURL=animatedValue.d.ts.map
|
|
@@ -11,7 +11,7 @@ export { lightTheme, darkTheme } from './tokens';
|
|
|
11
11
|
export { mergeTheme } from './merge';
|
|
12
12
|
export { fontFor } from './textStyle';
|
|
13
13
|
export type { FontWeightKey } from './textStyle';
|
|
14
|
-
export { createAnimatedValue } from './animatedValue';
|
|
14
|
+
export { createAnimatedValue, setNativeValue } from './animatedValue';
|
|
15
15
|
export { Gradient, isGradientAvailable } from './Gradient';
|
|
16
16
|
export type { GradientProps } from './Gradient';
|
|
17
17
|
export type { ColorMode, ColorPalette, GradientDefinition, GradientScale, RadiusScale, ShadowDefinition, ShadowScale, SpacingScale, Theme, ThemeOverrides, TypographyScale, MotionScale, DeepPartial } from './types';
|
|
@@ -3,6 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
4
4
|
import type { HapticType } from '../../utils';
|
|
5
5
|
export type BottomNavigationVariant = 'pill' | 'underline';
|
|
6
|
+
export type BottomNavigationIndicatorPosition = 'top' | 'bottom';
|
|
6
7
|
export type TabBadge = number | string | boolean | null;
|
|
7
8
|
export interface TabIconProps {
|
|
8
9
|
color: string;
|
|
@@ -23,6 +24,12 @@ export interface BottomNavigationProps {
|
|
|
23
24
|
haptic?: HapticType | false;
|
|
24
25
|
showLabels?: boolean;
|
|
25
26
|
variant?: BottomNavigationVariant;
|
|
27
|
+
/**
|
|
28
|
+
* Where the active-tab line sits, for variants that draw a line
|
|
29
|
+
* (currently `underline`). Default `'bottom'` preserves the legacy look;
|
|
30
|
+
* `'top'` flips the line to sit just above the tab row.
|
|
31
|
+
*/
|
|
32
|
+
indicatorPosition?: BottomNavigationIndicatorPosition;
|
|
26
33
|
style?: StyleProp<ViewStyle>;
|
|
27
34
|
indicatorStyle?: StyleProp<ViewStyle>;
|
|
28
35
|
labelStyle?: StyleProp<TextStyle>;
|
|
@@ -18,4 +18,15 @@ import { Animated } from 'react-native';
|
|
|
18
18
|
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
19
19
|
*/
|
|
20
20
|
export declare const createAnimatedValue: (initial: number, config?: ConstructorParameters<typeof Animated.Value>[1]) => Animated.Value;
|
|
21
|
+
/**
|
|
22
|
+
* Set an `Animated.Value` to a target without going through JS.
|
|
23
|
+
*
|
|
24
|
+
* Once a value has been driven by `useNativeDriver: true`, the underlying
|
|
25
|
+
* native node owns it — calling `value.setValue(x)` from JS throws
|
|
26
|
+
* "Attempting to run JS driven animation on animated node that has been moved to native".
|
|
27
|
+
* Use this helper for any value that is *also* used in a native-driven
|
|
28
|
+
* `Animated.timing/spring`. A zero-duration native timing routes the update
|
|
29
|
+
* through the same driver and stays valid across re-mounts and re-runs.
|
|
30
|
+
*/
|
|
31
|
+
export declare const setNativeValue: (value: Animated.Value, to: number) => void;
|
|
21
32
|
//# sourceMappingURL=animatedValue.d.ts.map
|
|
@@ -11,7 +11,7 @@ export { lightTheme, darkTheme } from './tokens';
|
|
|
11
11
|
export { mergeTheme } from './merge';
|
|
12
12
|
export { fontFor } from './textStyle';
|
|
13
13
|
export type { FontWeightKey } from './textStyle';
|
|
14
|
-
export { createAnimatedValue } from './animatedValue';
|
|
14
|
+
export { createAnimatedValue, setNativeValue } from './animatedValue';
|
|
15
15
|
export { Gradient, isGradientAvailable } from './Gradient';
|
|
16
16
|
export type { GradientProps } from './Gradient';
|
|
17
17
|
export type { ColorMode, ColorPalette, GradientDefinition, GradientScale, RadiusScale, ShadowDefinition, ShadowScale, SpacingScale, Theme, ThemeOverrides, TypographyScale, MotionScale, DeepPartial } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority-technologies/mobile",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components plus API/auth/logging/network/storage utilities for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|