@expressive-ui/native 0.2.0 → 0.3.0
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/README.md +10 -0
- package/dist/Feedback.d.ts +3 -3
- package/dist/Feedback.d.ts.map +1 -1
- package/dist/Feedback.js +73 -14
- package/dist/Feedback.js.map +1 -1
- package/dist/Fields.d.ts +10 -6
- package/dist/Fields.d.ts.map +1 -1
- package/dist/Fields.js +125 -29
- package/dist/Fields.js.map +1 -1
- package/dist/FileUpload.d.ts.map +1 -1
- package/dist/FileUpload.js +61 -19
- package/dist/FileUpload.js.map +1 -1
- package/dist/NumberField.d.ts +6 -2
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +71 -11
- package/dist/NumberField.js.map +1 -1
- package/dist/Pickers.d.ts.map +1 -1
- package/dist/Pickers.js +227 -36
- package/dist/Pickers.js.map +1 -1
- package/dist/RenderUI.d.ts +3 -0
- package/dist/RenderUI.d.ts.map +1 -0
- package/dist/RenderUI.js +45 -0
- package/dist/RenderUI.js.map +1 -0
- package/dist/Search.js +1 -1
- package/dist/Search.js.map +1 -1
- package/dist/Select.d.ts +5 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +52 -10
- package/dist/Select.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +3 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +36 -11
- package/dist/theme.js.map +1 -1
- package/package.json +4 -4
- package/src/Feedback.tsx +211 -16
- package/src/Fields.tsx +341 -58
- package/src/FileUpload.tsx +169 -7
- package/src/NumberField.tsx +187 -9
- package/src/Pickers.tsx +783 -86
- package/src/RenderUI.tsx +47 -0
- package/src/Search.tsx +1 -1
- package/src/Select.tsx +209 -27
- package/src/index.ts +2 -0
- package/src/theme.tsx +77 -14
package/src/RenderUI.tsx
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createUIRenderer } from '@expressive-ui/core';
|
|
2
|
+
export type { UIValueChange, UIBindings, RenderUIProps } from '@expressive-ui/core';
|
|
3
|
+
import { ExpressiveCard } from './ExpressiveCard.js';
|
|
4
|
+
import { Grid } from './Grid.js';
|
|
5
|
+
import { Button, IconButton, ButtonGroup, SplitButton } from './Button.js';
|
|
6
|
+
import { Fab } from './Fab.js';
|
|
7
|
+
import { Toolbar } from './Toolbar.js';
|
|
8
|
+
import { ChipGroup, Chip } from './Chips.js';
|
|
9
|
+
import { Carousel } from './Carousel.js';
|
|
10
|
+
import { ProgressIndicator, LoadingIndicator } from './Progress.js';
|
|
11
|
+
import { ListGroup, ListItem } from './List.js';
|
|
12
|
+
import { TextField, Checkbox } from './Fields.js';
|
|
13
|
+
import { Select, Autocomplete } from './Select.js';
|
|
14
|
+
import { NumberField } from './NumberField.js';
|
|
15
|
+
import { Switch } from './Inputs.js';
|
|
16
|
+
import { Alert, EmptyState, Skeleton } from './Feedback.js';
|
|
17
|
+
import { Dialog } from './Dialogs.js';
|
|
18
|
+
|
|
19
|
+
const components = {
|
|
20
|
+
ExpressiveCard,
|
|
21
|
+
Grid,
|
|
22
|
+
Button,
|
|
23
|
+
IconButton,
|
|
24
|
+
ButtonGroup,
|
|
25
|
+
SplitButton,
|
|
26
|
+
Fab,
|
|
27
|
+
Toolbar,
|
|
28
|
+
ChipGroup,
|
|
29
|
+
Chip,
|
|
30
|
+
Carousel,
|
|
31
|
+
ProgressIndicator,
|
|
32
|
+
LoadingIndicator,
|
|
33
|
+
ListGroup,
|
|
34
|
+
ListItem,
|
|
35
|
+
TextField,
|
|
36
|
+
Checkbox,
|
|
37
|
+
Select,
|
|
38
|
+
Autocomplete,
|
|
39
|
+
NumberField,
|
|
40
|
+
Switch,
|
|
41
|
+
Alert,
|
|
42
|
+
EmptyState,
|
|
43
|
+
Skeleton,
|
|
44
|
+
Dialog,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const RenderUI = createUIRenderer(components);
|
package/src/Search.tsx
CHANGED
|
@@ -254,7 +254,7 @@ export function SearchView<K extends string = string>({
|
|
|
254
254
|
<T variant="bodyLarge" color="onSurfaceVariant" numberOfLines={1} style={{ flex: 1 }}>
|
|
255
255
|
{term}
|
|
256
256
|
</T>
|
|
257
|
-
<SearchIconButton icon="close" label={
|
|
257
|
+
<SearchIconButton icon="close" label={labels.removeRecentSearch(term)} onPress={() => remove(term)} size={40} />
|
|
258
258
|
</Pressable>
|
|
259
259
|
))}
|
|
260
260
|
</>
|
package/src/Select.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
ScrollView,
|
|
5
|
+
View,
|
|
6
|
+
type PressableProps,
|
|
7
|
+
type StyleProp,
|
|
8
|
+
type ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import { useOptionSearch, type SelectOption, type OptionLoader } from '@expressive-ui/core';
|
|
4
11
|
import { Dialog } from './Dialogs.js';
|
|
5
12
|
import { TextField } from './Fields.js';
|
|
@@ -7,30 +14,205 @@ import { Button } from './Button.js';
|
|
|
7
14
|
import { Icon, T } from './primitives.js';
|
|
8
15
|
import { useExpressiveTheme } from './theme.js';
|
|
9
16
|
export type { SelectOption, OptionLoader } from '@expressive-ui/core';
|
|
10
|
-
export type SelectProps = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
export type SelectProps = {
|
|
18
|
+
id?: string;
|
|
19
|
+
ref?: Parameters<typeof Pressable>[0]['ref'];
|
|
20
|
+
controlProps?: Omit<PressableProps, 'onPress' | 'children' | 'style'>;
|
|
21
|
+
label: string;
|
|
22
|
+
options: readonly SelectOption[];
|
|
23
|
+
value?: string;
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
onChange?: (value: string, option: SelectOption) => void;
|
|
26
|
+
variant?: 'filled' | 'outlined';
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
supportingText?: string;
|
|
29
|
+
error?: string | boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
leadingIcon?: string;
|
|
33
|
+
maxHeight?: number;
|
|
34
|
+
style?: StyleProp<ViewStyle>;
|
|
35
|
+
};
|
|
36
|
+
export type AutocompleteProps = SelectProps & {
|
|
37
|
+
loadOptions?: OptionLoader;
|
|
38
|
+
onQueryChange?: (query: string) => void;
|
|
39
|
+
debounce?: number;
|
|
40
|
+
emptyText?: string;
|
|
41
|
+
loadingText?: string;
|
|
42
|
+
loadErrorText?: string;
|
|
43
|
+
preload?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export function Select(props: SelectProps) {
|
|
46
|
+
return <SelectionField {...props} editable={false} />;
|
|
47
|
+
}
|
|
48
|
+
export function Autocomplete(props: AutocompleteProps) {
|
|
49
|
+
return <SelectionField {...props} editable />;
|
|
50
|
+
}
|
|
51
|
+
export const Combobox = Autocomplete;
|
|
52
|
+
function SelectionField({
|
|
53
|
+
id,
|
|
54
|
+
ref,
|
|
55
|
+
controlProps,
|
|
56
|
+
label,
|
|
57
|
+
options,
|
|
58
|
+
value: controlled,
|
|
59
|
+
defaultValue = '',
|
|
60
|
+
onChange,
|
|
61
|
+
variant = 'outlined',
|
|
62
|
+
placeholder,
|
|
63
|
+
supportingText,
|
|
64
|
+
error,
|
|
65
|
+
required,
|
|
66
|
+
disabled,
|
|
67
|
+
leadingIcon,
|
|
68
|
+
maxHeight = 320,
|
|
69
|
+
style,
|
|
70
|
+
editable,
|
|
71
|
+
loadOptions,
|
|
72
|
+
onQueryChange,
|
|
73
|
+
debounce,
|
|
74
|
+
emptyText,
|
|
75
|
+
loadingText,
|
|
76
|
+
loadErrorText,
|
|
77
|
+
preload = false,
|
|
78
|
+
}: AutocompleteProps & { editable: boolean }) {
|
|
79
|
+
const { colors, labels } = useExpressiveTheme();
|
|
80
|
+
const [inner, setInner] = useState(defaultValue),
|
|
81
|
+
value = controlled ?? inner,
|
|
82
|
+
[open, setOpen] = useState(false),
|
|
83
|
+
[query, setQuery] = useState('');
|
|
84
|
+
const cached = useRef<SelectOption | undefined>(undefined),
|
|
85
|
+
selected =
|
|
86
|
+
options.find((option) => option.value === value) ??
|
|
87
|
+
(cached.current?.value === value ? cached.current : undefined);
|
|
88
|
+
const result = useOptionSearch(
|
|
89
|
+
editable && open ? query : '',
|
|
90
|
+
options,
|
|
91
|
+
editable ? loadOptions : undefined,
|
|
92
|
+
debounce,
|
|
93
|
+
open || preload,
|
|
94
|
+
),
|
|
95
|
+
shown = editable ? result.options : options;
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (disabled) setOpen(false);
|
|
98
|
+
}, [disabled]);
|
|
99
|
+
return (
|
|
100
|
+
<View style={[{ gap: 6, opacity: disabled ? 0.38 : 1 }, style]}>
|
|
101
|
+
<T variant="labelMedium">
|
|
102
|
+
{label}
|
|
103
|
+
{required ? ' *' : ''}
|
|
104
|
+
</T>
|
|
105
|
+
<Pressable
|
|
106
|
+
{...controlProps}
|
|
107
|
+
ref={ref}
|
|
108
|
+
nativeID={id}
|
|
109
|
+
accessibilityRole="combobox"
|
|
110
|
+
accessibilityLabel={`${label}${required ? labels.requiredSuffix : ''}`}
|
|
111
|
+
accessibilityValue={{ text: selected?.label ?? '' }}
|
|
112
|
+
accessibilityState={{ expanded: open, disabled: !!disabled }}
|
|
113
|
+
accessibilityHint={typeof error === 'string' ? error : supportingText}
|
|
114
|
+
disabled={disabled}
|
|
115
|
+
onPress={() => {
|
|
116
|
+
setQuery('');
|
|
117
|
+
setOpen(true);
|
|
118
|
+
}}
|
|
119
|
+
style={{
|
|
120
|
+
minHeight: 56,
|
|
121
|
+
padding: 14,
|
|
122
|
+
borderWidth: variant === 'outlined' ? 1 : 0,
|
|
123
|
+
borderBottomWidth: 1,
|
|
124
|
+
borderColor: error ? colors.error : colors.outline,
|
|
125
|
+
borderRadius: 12,
|
|
126
|
+
backgroundColor: variant === 'filled' ? colors.surfaceContainerHighest : colors.surface,
|
|
127
|
+
flexDirection: 'row',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
gap: 12,
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
{leadingIcon ? <Icon name={leadingIcon} /> : null}
|
|
133
|
+
<T style={{ flex: 1 }}>{selected?.label ?? placeholder ?? labels.select}</T>
|
|
134
|
+
<Icon name="arrow_drop_down" />
|
|
135
|
+
</Pressable>
|
|
136
|
+
{error || supportingText ? (
|
|
137
|
+
<T variant="bodySmall" color={error ? 'error' : 'onSurfaceVariant'}>
|
|
138
|
+
{typeof error === 'string' ? error : supportingText}
|
|
139
|
+
</T>
|
|
140
|
+
) : null}
|
|
141
|
+
<Dialog
|
|
142
|
+
open={open}
|
|
143
|
+
onClose={() => setOpen(false)}
|
|
144
|
+
headline={label}
|
|
145
|
+
actions={[{ label: labels.close, onPress: () => setOpen(false) }]}
|
|
146
|
+
>
|
|
147
|
+
{editable ? (
|
|
148
|
+
<TextField
|
|
149
|
+
label={label}
|
|
150
|
+
value={query}
|
|
151
|
+
onChange={(next) => {
|
|
152
|
+
setQuery(next);
|
|
153
|
+
onQueryChange?.(next);
|
|
154
|
+
}}
|
|
155
|
+
placeholder={placeholder}
|
|
156
|
+
/>
|
|
157
|
+
) : null}
|
|
158
|
+
<ScrollView style={{ maxHeight }} keyboardShouldPersistTaps="handled">
|
|
159
|
+
{result.loading ? (
|
|
160
|
+
<T accessibilityLiveRegion="polite">{loadingText ?? labels.loadingOptions}</T>
|
|
161
|
+
) : result.error ? (
|
|
162
|
+
<View>
|
|
163
|
+
<T accessibilityRole="alert">{loadErrorText ?? labels.loadError}</T>
|
|
164
|
+
<Button
|
|
165
|
+
variant="text"
|
|
166
|
+
action={{ id: 'select.retry', label: labels.retry }}
|
|
167
|
+
onPress={result.retry}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
) : !shown.length ? (
|
|
171
|
+
<T accessibilityLiveRegion="polite">{emptyText ?? labels.noResults}</T>
|
|
172
|
+
) : (
|
|
173
|
+
shown.map((option) => (
|
|
174
|
+
<Pressable
|
|
175
|
+
key={option.value}
|
|
176
|
+
accessibilityRole="button"
|
|
177
|
+
accessibilityState={{
|
|
178
|
+
selected: option.value === value,
|
|
179
|
+
disabled: !!option.disabled,
|
|
180
|
+
}}
|
|
181
|
+
disabled={option.disabled}
|
|
182
|
+
onPress={() => {
|
|
183
|
+
cached.current = option;
|
|
184
|
+
setInner(option.value);
|
|
185
|
+
onChange?.(option.value, option);
|
|
186
|
+
setOpen(false);
|
|
187
|
+
}}
|
|
188
|
+
style={{
|
|
189
|
+
minHeight: 48,
|
|
190
|
+
padding: 14,
|
|
191
|
+
marginVertical: 2,
|
|
192
|
+
borderRadius: 12,
|
|
193
|
+
flexDirection: 'row',
|
|
194
|
+
alignItems: 'center',
|
|
195
|
+
gap: 12,
|
|
196
|
+
opacity: option.disabled ? 0.38 : 1,
|
|
197
|
+
backgroundColor:
|
|
198
|
+
option.value === value ? colors.secondaryContainer : colors.surface,
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
{option.icon ? <Icon name={option.icon} /> : null}
|
|
202
|
+
<View style={{ flex: 1 }}>
|
|
203
|
+
<T>{option.label}</T>
|
|
204
|
+
{option.supportingText ? (
|
|
205
|
+
<T variant="bodySmall" color="onSurfaceVariant">
|
|
206
|
+
{option.supportingText}
|
|
207
|
+
</T>
|
|
208
|
+
) : null}
|
|
209
|
+
</View>
|
|
210
|
+
{option.value === value ? <Icon name="check" /> : null}
|
|
211
|
+
</Pressable>
|
|
212
|
+
))
|
|
213
|
+
)}
|
|
214
|
+
</ScrollView>
|
|
215
|
+
</Dialog>
|
|
216
|
+
</View>
|
|
217
|
+
);
|
|
36
218
|
}
|
package/src/index.ts
CHANGED
package/src/theme.tsx
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { AccessibilityInfo, Animated, Easing, View, useColorScheme } from 'react-native';
|
|
11
|
+
import {
|
|
12
|
+
resolveLabels,
|
|
13
|
+
springConfig,
|
|
14
|
+
surfaceTiming,
|
|
15
|
+
type ExpressiveLabels,
|
|
16
|
+
} from '@expressive-ui/core';
|
|
17
|
+
import {
|
|
18
|
+
schemes,
|
|
19
|
+
type ColorScheme,
|
|
20
|
+
type MotionScheme,
|
|
21
|
+
type SchemePair,
|
|
22
|
+
type SpringToken,
|
|
23
|
+
type ThemeMode,
|
|
24
|
+
} from '@expressive-ui/tokens';
|
|
5
25
|
|
|
6
|
-
export type IconRenderer = (
|
|
26
|
+
export type IconRenderer = (
|
|
27
|
+
name: string,
|
|
28
|
+
options: { size: number; color: string; filled: boolean },
|
|
29
|
+
) => ReactNode;
|
|
7
30
|
|
|
8
31
|
type ExpressiveTheme = {
|
|
9
32
|
mode: ThemeMode;
|
|
@@ -32,6 +55,8 @@ export type ExpressiveThemeProviderProps = {
|
|
|
32
55
|
scheme?: SchemePair;
|
|
33
56
|
/** Idioma dos textos de acessibilidade embutidos: pt-* usa português, os demais inglês. */
|
|
34
57
|
locale?: string;
|
|
58
|
+
/** Opt-in root direction; otherwise uses the native platform direction. */
|
|
59
|
+
dir?: 'ltr' | 'rtl';
|
|
35
60
|
/** Sobrescreve textos embutidos (rótulos de fechar, anúncios de reordenação etc.). */
|
|
36
61
|
labels?: Partial<ExpressiveLabels>;
|
|
37
62
|
/** Esquema de movimento do M3: expressive (molas que ultrapassam) ou standard (amortecidas). */
|
|
@@ -44,15 +69,36 @@ export type ExpressiveThemeProviderProps = {
|
|
|
44
69
|
children: ReactNode;
|
|
45
70
|
};
|
|
46
71
|
|
|
47
|
-
export function ExpressiveThemeProvider({
|
|
72
|
+
export function ExpressiveThemeProvider({
|
|
73
|
+
mode = 'system',
|
|
74
|
+
scheme,
|
|
75
|
+
locale = 'pt-BR',
|
|
76
|
+
dir,
|
|
77
|
+
motion = 'expressive',
|
|
78
|
+
labels,
|
|
79
|
+
renderIcon,
|
|
80
|
+
children,
|
|
81
|
+
}: ExpressiveThemeProviderProps) {
|
|
48
82
|
const system = useColorScheme();
|
|
49
83
|
const reduceMotion = useReduceMotion();
|
|
50
84
|
const resolved: ThemeMode = mode === 'system' ? (system === 'dark' ? 'dark' : 'light') : mode;
|
|
51
85
|
const value = useMemo(
|
|
52
|
-
() => ({
|
|
86
|
+
() => ({
|
|
87
|
+
mode: resolved,
|
|
88
|
+
colors: (scheme ?? schemes)[resolved],
|
|
89
|
+
locale,
|
|
90
|
+
labels: resolveLabels(locale, labels),
|
|
91
|
+
reduceMotion,
|
|
92
|
+
motion,
|
|
93
|
+
renderIcon: renderIcon ?? null,
|
|
94
|
+
}),
|
|
53
95
|
[resolved, scheme, locale, labels, reduceMotion, motion, renderIcon],
|
|
54
96
|
);
|
|
55
|
-
return
|
|
97
|
+
return (
|
|
98
|
+
<ThemeContext.Provider value={value}>
|
|
99
|
+
{dir ? <View style={{ flex: 1, direction: dir }}>{children}</View> : children}
|
|
100
|
+
</ThemeContext.Provider>
|
|
101
|
+
);
|
|
56
102
|
}
|
|
57
103
|
|
|
58
104
|
// Mesmo comportamento do useReduceMotion do mobile-app-rhosse.
|
|
@@ -82,7 +128,11 @@ export function useSpringValue(target: number, token: SpringToken) {
|
|
|
82
128
|
useEffect(() => {
|
|
83
129
|
const animation = reduceMotion
|
|
84
130
|
? Animated.timing(value, { toValue: target, duration: 0, useNativeDriver: false })
|
|
85
|
-
: Animated.spring(value, {
|
|
131
|
+
: Animated.spring(value, {
|
|
132
|
+
toValue: target,
|
|
133
|
+
...springConfig(token, motion),
|
|
134
|
+
useNativeDriver: false,
|
|
135
|
+
});
|
|
86
136
|
animation.start();
|
|
87
137
|
return () => animation.stop();
|
|
88
138
|
}, [target, token, reduceMotion, motion, value]);
|
|
@@ -92,7 +142,12 @@ export function useSpringValue(target: number, token: SpringToken) {
|
|
|
92
142
|
const exit = surfaceTiming('exit');
|
|
93
143
|
/** Saída de superfície do M3: mais curta que a entrada e acelerando (emphasizedAccelerate). */
|
|
94
144
|
export function exitTiming(value: Animated.Value, toValue = 0, useNativeDriver = true) {
|
|
95
|
-
return Animated.timing(value, {
|
|
145
|
+
return Animated.timing(value, {
|
|
146
|
+
toValue,
|
|
147
|
+
duration: exit.duration,
|
|
148
|
+
easing: Easing.bezier(...exit.bezier),
|
|
149
|
+
useNativeDriver,
|
|
150
|
+
});
|
|
96
151
|
}
|
|
97
152
|
|
|
98
153
|
/**
|
|
@@ -110,13 +165,21 @@ export function usePresence(open: boolean, useNativeDriver = true) {
|
|
|
110
165
|
const animation = reduceMotion
|
|
111
166
|
? Animated.timing(progress, { toValue: open ? 1 : 0, duration: 0, useNativeDriver })
|
|
112
167
|
: open
|
|
113
|
-
|
|
114
|
-
|
|
168
|
+
? Animated.spring(progress, {
|
|
169
|
+
toValue: 1,
|
|
170
|
+
...springConfig('spatialDefault', motion),
|
|
171
|
+
useNativeDriver,
|
|
172
|
+
})
|
|
173
|
+
: exitTiming(progress, 0, useNativeDriver);
|
|
115
174
|
const effect = reduceMotion
|
|
116
175
|
? Animated.timing(opacity, { toValue: open ? 1 : 0, duration: 0, useNativeDriver })
|
|
117
176
|
: open
|
|
118
|
-
|
|
119
|
-
|
|
177
|
+
? Animated.spring(opacity, {
|
|
178
|
+
toValue: 1,
|
|
179
|
+
...springConfig('effectsDefault', motion),
|
|
180
|
+
useNativeDriver,
|
|
181
|
+
})
|
|
182
|
+
: exitTiming(opacity, 0, useNativeDriver);
|
|
120
183
|
const group = Animated.parallel([animation, effect]);
|
|
121
184
|
group.start(({ finished }) => finished && !open && setMounted(false));
|
|
122
185
|
return () => group.stop();
|