@fountain-ui/core 1.16.0 → 1.19.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/CHANGELOG.md +24 -0
- package/build/commonjs/Modal/Modal.js +10 -1
- package/build/commonjs/Modal/Modal.js.map +1 -1
- package/build/commonjs/Modal/index.js +10 -2
- package/build/commonjs/Modal/index.js.map +1 -1
- package/build/commonjs/Pagination/Pagination.js +2 -2
- package/build/commonjs/Pagination/Pagination.js.map +1 -1
- package/build/commonjs/hooks/useCollapsibleAppBar.js +7 -1
- package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useFadeInAppBar.js +7 -0
- package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
- package/build/commonjs/index.js +7 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronLeft.js +23 -0
- package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -0
- package/build/commonjs/internal/icons/ChevronRight.js +23 -0
- package/build/commonjs/internal/icons/ChevronRight.js.map +1 -0
- package/build/commonjs/internal/icons/index.js +16 -0
- package/build/commonjs/internal/icons/index.js.map +1 -1
- package/build/module/Modal/Modal.js +6 -1
- package/build/module/Modal/Modal.js.map +1 -1
- package/build/module/Modal/index.js +1 -1
- package/build/module/Modal/index.js.map +1 -1
- package/build/module/Pagination/Pagination.js +1 -1
- package/build/module/Pagination/Pagination.js.map +1 -1
- package/build/module/hooks/useCollapsibleAppBar.js +8 -2
- package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useFadeInAppBar.js +8 -1
- package/build/module/hooks/useFadeInAppBar.js.map +1 -1
- package/build/module/index.js +1 -1
- package/build/module/index.js.map +1 -1
- package/build/module/internal/icons/ChevronLeft.js +9 -0
- package/build/module/internal/icons/ChevronLeft.js.map +1 -0
- package/build/module/internal/icons/ChevronRight.js +9 -0
- package/build/module/internal/icons/ChevronRight.js.map +1 -0
- package/build/module/internal/icons/index.js +2 -0
- package/build/module/internal/icons/index.js.map +1 -1
- package/build/typescript/Modal/Modal.d.ts +11 -0
- package/build/typescript/Modal/ModalProps.d.ts +2 -1
- package/build/typescript/Modal/index.d.ts +2 -1
- package/build/typescript/hooks/useCollapsibleAppBar.d.ts +1 -0
- package/build/typescript/hooks/useFadeInAppBar.d.ts +1 -0
- package/build/typescript/index.d.ts +2 -1
- package/build/typescript/internal/icons/ChevronLeft.d.ts +113 -0
- package/build/typescript/internal/icons/ChevronRight.d.ts +113 -0
- package/build/typescript/internal/icons/index.d.ts +2 -0
- package/package.json +3 -3
- package/src/Modal/Modal.tsx +15 -1
- package/src/Modal/ModalProps.ts +2 -1
- package/src/Modal/index.ts +3 -2
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/hooks/useCollapsibleAppBar.ts +7 -2
- package/src/hooks/useFadeInAppBar.ts +9 -1
- package/src/index.ts +2 -1
- package/src/internal/icons/ChevronLeft.tsx +11 -0
- package/src/internal/icons/ChevronRight.tsx +11 -0
- package/src/internal/icons/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Pagination.tsx"],"names":["React","View","
|
|
1
|
+
{"version":3,"sources":["Pagination.tsx"],"names":["React","View","times","ChevronLeft","ChevronRight","css","useTheme","IconButton","PaginationItem","useStyles","theme","root","rootInline","flexDirection","alignItems","rootAnchor","items","justifyContent","marginTop","spacing","arrowContainer","prevInline","marginRight","prevAnchor","position","left","nextInline","marginLeft","nextAnchor","right","Pagination","props","bundleSize","children","count","disabled","hideIndicator","hideNextButton","hidePrevButton","infinite","onChange","page","renderItem","index","rest","style","otherProps","styles","firstPage","lastPage","handleChange","nextPage","handlePrevPress","prevPage","handleNextPress","prevButton","nextButton","i","selected","containerProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,KAAT,QAAsB,oBAAtB;AACA,SAASC,WAAT,EAAsB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AACV,wBACI,oBAAC,IAAD,EAAU0B,cAAV,eACI,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAEtD,GAAG,CAAC0C,MAAM,CAAC3B,cAAR;AAAhB,OACKa,QADL,EAEKsB,UAFL,EAGKC,UAHL,CADJ,eAOI,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAEnD,GAAG,CAAC0C,MAAM,CAAC/B,KAAR;AAAhB,OACKA,KADL,CAPJ,CADJ;AAaH;;AAED,sBACI,oBAAC,IAAD,EAAU2C,cAAV,EACKJ,UADL,EAEKvC,KAFL,EAGKwC,UAHL,CADJ;AAOH;AAAA","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { times } from '@fountain-ui/utils';\nimport { ChevronLeft, ChevronRight } from '../internal/icons';\nimport { css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport PaginationItem from '../PaginationItem';\nimport type PaginationProps from './PaginationProps';\n\ntype PaginationStyleKeys =\n | 'root'\n | 'rootInline'\n | 'rootAnchor'\n | 'items'\n | 'arrowContainer'\n | 'prevInline'\n | 'prevAnchor'\n | 'nextInline'\n | 'nextAnchor';\n\ntype PaginationStyles = NamedStylesStringUnion<PaginationStyleKeys>;\n\nconst useStyles: UseStyles<PaginationStyles> = function (): PaginationStyles {\n const theme = useTheme();\n\n return {\n root: {},\n rootInline: {\n flexDirection: 'row',\n alignItems: 'center',\n },\n rootAnchor: {\n flexDirection: 'column',\n },\n items: {\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: theme.spacing(2),\n },\n arrowContainer: {\n flexDirection: 'column',\n justifyContent: 'center',\n },\n prevInline: {\n marginRight: theme.spacing(1),\n },\n prevAnchor: {\n position: 'absolute',\n left: -24,\n },\n nextInline: {\n marginLeft: theme.spacing(1),\n },\n nextAnchor: {\n position: 'absolute',\n right: -24,\n },\n };\n};\n\nexport default function Pagination(props: PaginationProps) {\n const {\n bundleSize = 1,\n children,\n count,\n disabled = false,\n hideIndicator = false,\n hideNextButton = false,\n hidePrevButton = false,\n infinite = false,\n onChange,\n page,\n renderItem = ({ index, ...rest }) => <PaginationItem key={`${index}`} {...rest}/>,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const firstPage = 0;\n const lastPage = count - 1;\n\n const handleChange = (nextPage: number) => {\n if (nextPage >= firstPage && nextPage <= lastPage) {\n if (onChange) {\n onChange(nextPage);\n }\n }\n };\n\n const handlePrevPress = () => {\n const prevPage = page - bundleSize >= firstPage\n ? page - bundleSize\n : (infinite ? count - bundleSize + page : firstPage);\n\n handleChange(prevPage);\n };\n\n const handleNextPress = () => {\n const nextPage = page + bundleSize <= lastPage\n ? page + bundleSize\n : (infinite ? page + bundleSize - count : lastPage);\n\n handleChange(nextPage);\n };\n\n const prevButton = !hidePrevButton ? (\n <IconButton\n children={<ChevronLeft/>}\n color={'tertiary'}\n disabled={disabled || (!infinite && page <= firstPage)}\n onPress={handlePrevPress}\n size={'small'}\n style={children ? styles.prevAnchor : styles.prevInline}\n />\n ) : null;\n\n const nextButton = !hideNextButton ? (\n <IconButton\n children={<ChevronRight/>}\n color={'tertiary'}\n disabled={disabled || (!infinite && page + bundleSize > lastPage)}\n onPress={handleNextPress}\n size={'small'}\n style={children ? styles.nextAnchor : styles.nextInline}\n />\n ) : null;\n\n const items = !hideIndicator ? (\n times(i => renderItem({ index: i, disabled, selected: i === page }), count)\n ) : null;\n\n const containerProps = {\n style: css([\n styles.root,\n children ? styles.rootAnchor : styles.rootInline,\n style,\n ]),\n ...otherProps,\n };\n\n if (children) {\n return (\n <View {...containerProps}>\n <View style={css(styles.arrowContainer)}>\n {children}\n {prevButton}\n {nextButton}\n </View>\n\n <View style={css(styles.items)}>\n {items}\n </View>\n </View>\n );\n }\n\n return (\n <View {...containerProps}>\n {prevButton}\n {items}\n {nextButton}\n </View>\n );\n};\n"]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
2
|
+
import { Keyboard, Platform } from 'react-native';
|
|
3
3
|
import Animated from 'react-native-reanimated';
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { useHeight } from '../internal/hooks';
|
|
6
6
|
import useElevationStyle from './useElevationStyle';
|
|
7
7
|
import useAppbarStyles from './useAppbarStyles';
|
|
8
8
|
const defaultOptions = {
|
|
9
|
+
keyboardDismissMode: 'none',
|
|
9
10
|
translucent: false
|
|
10
11
|
};
|
|
11
12
|
const ANIMATION_DURATION_MILLIS = 100;
|
|
12
13
|
const SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';
|
|
13
14
|
export default function useCollapsibleAppBar(userOptions = defaultOptions) {
|
|
14
15
|
const {
|
|
15
|
-
translucent
|
|
16
|
+
translucent,
|
|
17
|
+
keyboardDismissMode
|
|
16
18
|
} = { ...defaultOptions,
|
|
17
19
|
...userOptions
|
|
18
20
|
};
|
|
@@ -71,6 +73,10 @@ export default function useCollapsibleAppBar(userOptions = defaultOptions) {
|
|
|
71
73
|
|
|
72
74
|
const scrollHandler = Animated.useAnimatedScrollHandler({
|
|
73
75
|
onBeginDrag: () => {
|
|
76
|
+
if (keyboardDismissMode === 'on-drag') {
|
|
77
|
+
Animated.runOnJS(Keyboard.dismiss)();
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
lastTranslateY.value = translateY.value;
|
|
75
81
|
},
|
|
76
82
|
onMomentumBegin: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCollapsibleAppBar.ts"],"names":["React","Platform","Animated","useSafeAreaInsets","useHeight","useElevationStyle","useAppbarStyles","defaultOptions","translucent","ANIMATION_DURATION_MILLIS","SUPPORTS_DRAG_DETECTION","OS","useCollapsibleAppBar","userOptions","styles","safeAreaInsets","appBarHeight","onAppBarLayout","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","elevationStyle","animatedStyle","useAnimatedStyle","transform","value","boxShadow","elevation","shadowColor","shadowOffset","shadowRadius","shadowOpacity","indexRef","useRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","current","savedOffsetY","withTiming","duration","scrollHandler","useAnimatedScrollHandler","onBeginDrag","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","ty","maxTy","dy","Math","min","max","onEndDrag","onMomentumEnd","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","undefined","floating","scrollContentInsets"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAgBC,QAAhB,QAAwF,cAAxF;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AA8BA,MAAMC,cAAiC,GAAG;AACtCC,EAAAA,WAAW,EAAE;AADyB,CAA1C;AAIA,MAAMC,yBAAyB,GAAG,GAAlC;AAEA,MAAMC,uBAAuB,GAAGT,QAAQ,CAACU,EAAT,KAAgB,KAAhD;AAEA,eAAe,SAASC,oBAAT,CAA8BC,WAAoB,GAAGN,cAArD,EAAwF;AACnG,QAAM;AAAEC,IAAAA;AAAF,MAAqC,EACvC,GAAGD,cADoC;AAEvC,OAAGM;AAFoC,GAA3C;AAKA,QAAMC,MAAM,GAAGR,eAAe,EAA9B;AAEA,QAAMS,cAAc,GAAGZ,iBAAiB,EAAxC;AAEA,QAAM,CAACa,YAAD,EAAeC,cAAf,IAAiCb,SAAS,EAAhD;AACA,QAAM,CAACc,wBAAD,EAA2BC,0BAA3B,IAAyDf,SAAS,EAAxE;AAEA,QAAMgB,aAAa,GAAGlB,QAAQ,CAACmB,eAAT,CAAyB,MAAM,CAACH,wBAAhC,CAAtB;AAEA,QAAMI,UAAU,GAAGpB,QAAQ,CAACqB,cAA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AEH,cAAc,GAAGnD,YAAH,GAAkB;AAAvC;AANlB,GAAP;AAQH;AAAA","sourcesContent":["import React from 'react';\nimport { Falsy, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useHeight } from '../internal/hooks';\nimport useElevationStyle from './useElevationStyle';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n translucent?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n}\n\nconst defaultOptions: Required<Options> = {\n translucent: false,\n};\n\nconst ANIMATION_DURATION_MILLIS = 100;\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\n\nexport default function useCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { translucent }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = Animated.useDerivedValue(() => -collapsibleToolbarHeight);\n\n const translateY = Animated.useSharedValue<number>(0);\n const lastTranslateY = Animated.useSharedValue<number>(0);\n const lastOffsetY = Animated.useSharedValue<number>(0);\n const overlapped = Animated.useSharedValue<boolean>(false);\n\n const elevationStyle = useElevationStyle(4);\n const animatedStyle = Animated.useAnimatedStyle(() => {\n return Platform.OS === 'web' ? ({\n transform: [{ translateY: translateY.value }],\n boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,\n }) : ({\n transform: [{ translateY: translateY.value }],\n elevation: overlapped.value ? elevationStyle?.elevation : 0,\n shadowColor: elevationStyle?.shadowColor,\n shadowOffset: elevationStyle?.shadowOffset,\n shadowRadius: elevationStyle?.shadowRadius,\n shadowOpacity: overlapped.value ? elevationStyle?.shadowOpacity : 0,\n });\n });\n\n const indexRef = React.useRef<number>(0);\n const offsetsRef = React.useRef<Array<number>>([]);\n\n const onScrollViewChanged = (nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n };\n\n const scrollHandler = Animated.useAnimatedScrollHandler({\n onBeginDrag: () => {\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n if (offsetY > -maxTy) {\n if (ty === 0) {\n translateY.value = Animated.withTiming(Math.min(Math.max(-offsetY, maxTy), 0), {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n } else {\n if (ty === maxTy) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n }\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = Animated.withTiming(nextTranslateY, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n },\n });\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n translucent ? { paddingTop: safeAreaInsets.top } : undefined,\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["useCollapsibleAppBar.ts"],"names":["React","Keyboard","Platform","Animated","useSafeAreaInsets","useHeight","useElevationStyle","useAppbarStyles","defaultOptions","keyboardDismissMode","translucent","ANIMATION_DURATION_MILLIS","SUPPORTS_DRAG_DETECTION","OS","useCollapsibleAppBar","userOptions","styles","safeAreaInsets","appBarHeight","onAppBarLayout","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","elevationStyle","animatedStyle","useAnimatedStyle","transform","value","boxShadow","elevation","shadowColor","shadowOffset","shadowRadius","shadowOpacity","indexRef","useRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","current","savedOffsetY","withTiming","duration","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","dismiss","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","ty","maxTy","dy","Math","min","max","onEndDrag","onMomentumEnd","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","undefined","floating","scrollContentInsets"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAgBC,QAAhB,EAA0BC,QAA1B,QAAkG,cAAlG;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AA+BA,MAAMC,cAAiC,GAAG;AACtCC,EAAAA,mBAAmB,EAAE,MADiB;AAEtCC,EAAAA,WAAW,EAAE;AAFyB,CAA1C;AAKA,MAAMC,yBAAyB,GAAG,GAAlC;AAEA,MAAMC,uBAAuB,GAAGV,QAAQ,CAACW,EAAT,KAAgB,KAAhD;AAEA,eAAe,SAASC,oBAAT,CAA8BC,WAAoB,GAAGP,cAArD,EAAwF;AACnG,QAAM;AAAEE,IAAAA,WAAF;AAAeD,IAAAA;AAAf,MAA0D,EAC5D,GAAGD,cADyD;AAE5D,OAAGO;AAFyD,GAAhE;AAKA,QAAMC,MAAM,GAAGT,eAAe,EAA9B;AAEA,QAAMU,cAAc,GAAGb,iBAAiB,EAAxC;AAEA,QAAM,CAACc,YAAD,EAAeC,cAAf,IAAiCd,SAAS,EAAhD;AACA,QAAM,CAACe,wBAAD,EAA2BC,0BAA3B,IAAyDhB,SAAS,EAAxE;AAEA,QAAMiB,aAAa,GAAGnB,QAAQ,CAACoB,eAAT,CAAyB,MAAM,CAACH,wBAAhC,CAAtB;AAEA,QAAMI,UAAU,GAAGrB,QAAQ,CAACsB,cAAT,CAAgC,CAAhC,CAAnB;AACA,Q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;AAKHP,IAAAA,mBALG;AAMHkC,IAAAA,mBAAmB,EAAE;AAAEH,MAAAA,GAAG,EAAEH,cAAc,GAAGrD,YAAH,GAAkB;AAAvC;AANlB,GAAP;AAQH;AAAA","sourcesContent":["import React from 'react';\nimport { Falsy, Keyboard, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useHeight } from '../internal/hooks';\nimport useElevationStyle from './useElevationStyle';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n keyboardDismissMode?: 'none' | 'on-drag';\n translucent?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n}\n\nconst defaultOptions: Required<Options> = {\n keyboardDismissMode: 'none',\n translucent: false,\n};\n\nconst ANIMATION_DURATION_MILLIS = 100;\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\n\nexport default function useCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { translucent, keyboardDismissMode }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = Animated.useDerivedValue(() => -collapsibleToolbarHeight);\n\n const translateY = Animated.useSharedValue<number>(0);\n const lastTranslateY = Animated.useSharedValue<number>(0);\n const lastOffsetY = Animated.useSharedValue<number>(0);\n const overlapped = Animated.useSharedValue<boolean>(false);\n\n const elevationStyle = useElevationStyle(4);\n const animatedStyle = Animated.useAnimatedStyle(() => {\n return Platform.OS === 'web' ? ({\n transform: [{ translateY: translateY.value }],\n boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,\n }) : ({\n transform: [{ translateY: translateY.value }],\n elevation: overlapped.value ? elevationStyle?.elevation : 0,\n shadowColor: elevationStyle?.shadowColor,\n shadowOffset: elevationStyle?.shadowOffset,\n shadowRadius: elevationStyle?.shadowRadius,\n shadowOpacity: overlapped.value ? elevationStyle?.shadowOpacity : 0,\n });\n });\n\n const indexRef = React.useRef<number>(0);\n const offsetsRef = React.useRef<Array<number>>([]);\n\n const onScrollViewChanged = (nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n };\n\n const scrollHandler = Animated.useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n Animated.runOnJS(Keyboard.dismiss)();\n }\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n if (offsetY > -maxTy) {\n if (ty === 0) {\n translateY.value = Animated.withTiming(Math.min(Math.max(-offsetY, maxTy), 0), {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n } else {\n if (ty === maxTy) {\n translateY.value = Animated.withTiming(0, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n }\n }\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = Animated.withTiming(nextTranslateY, {\n duration: ANIMATION_DURATION_MILLIS,\n });\n },\n });\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n translucent ? { paddingTop: safeAreaInsets.top } : undefined,\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n };\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
2
|
+
import { Keyboard, Platform } from 'react-native';
|
|
3
3
|
import Animated from 'react-native-reanimated';
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { rgb } from '@fountain-ui/utils';
|
|
@@ -10,6 +10,7 @@ const defaultOptions = {
|
|
|
10
10
|
fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,
|
|
11
11
|
fadeInEndY: appBarHeight => appBarHeight,
|
|
12
12
|
floating: true,
|
|
13
|
+
keyboardDismissMode: 'none',
|
|
13
14
|
translucent: false
|
|
14
15
|
};
|
|
15
16
|
const shadowOffset = Platform.OS === 'ios' ? {
|
|
@@ -22,6 +23,7 @@ export default function useFadeInAppBar(userOptions = defaultOptions) {
|
|
|
22
23
|
fadeInBeginY,
|
|
23
24
|
fadeInEndY,
|
|
24
25
|
floating,
|
|
26
|
+
keyboardDismissMode,
|
|
25
27
|
translucent
|
|
26
28
|
} = { ...defaultOptions,
|
|
27
29
|
...userOptions
|
|
@@ -50,6 +52,11 @@ export default function useFadeInAppBar(userOptions = defaultOptions) {
|
|
|
50
52
|
opacity: normalized.value
|
|
51
53
|
}));
|
|
52
54
|
const scrollHandler = Animated.useAnimatedScrollHandler({
|
|
55
|
+
onBeginDrag: () => {
|
|
56
|
+
if (keyboardDismissMode === 'on-drag') {
|
|
57
|
+
Animated.runOnJS(Keyboard.dismiss)();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
53
60
|
onScroll: event => {
|
|
54
61
|
const offsetY = event.contentOffset.y;
|
|
55
62
|
const distance = Math.max(toOffsetY - fromOffsetY, 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useFadeInAppBar.ts"],"names":["React","Platform","Animated","useSafeAreaInsets","rgb","useHeight","useAppbarStyles","defaultOptions","backgroundColor","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","translucent","shadowOffset","OS","width","height","undefined","useFadeInAppBar","userOptions","styles","safeAreaInsets","onAppBarLayout","fromOffsetY","toOffsetY","useMemo","beginY","dy","useSharedValue","lastOffsetY","normalized","r","g","b","animatedAppBarStyle","useAnimatedStyle","value","elevation","shadowColor","shadowRadius","shadowOpacity","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","titleStyle"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAgBC,QAAhB,
|
|
1
|
+
{"version":3,"sources":["useFadeInAppBar.ts"],"names":["React","Keyboard","Platform","Animated","useSafeAreaInsets","rgb","useHeight","useAppbarStyles","defaultOptions","backgroundColor","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","keyboardDismissMode","translucent","shadowOffset","OS","width","height","undefined","useFadeInAppBar","userOptions","styles","safeAreaInsets","onAppBarLayout","fromOffsetY","toOffsetY","useMemo","beginY","dy","useSharedValue","lastOffsetY","normalized","r","g","b","animatedAppBarStyle","useAnimatedStyle","value","elevation","shadowColor","shadowRadius","shadowOpacity","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","dismiss","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","titleStyle"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAgBC,QAAhB,EAA0BC,QAA1B,QAAkG,cAAlG;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,GAAT,QAAoB,oBAApB;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AA0BA,MAAMC,cAAiC,GAAG;AACtCC,EAAAA,eAAe,EAAE,SADqB;AAEtCC,EAAAA,YAAY,EAAE,CAACC,IAAD,EAAOC,YAAP,KAAwBD,IAAI,GAAGC,YAFP;AAGtCC,EAAAA,UAAU,EAAGD,YAAD,IAAkBA,YAHQ;AAItCE,EAAAA,QAAQ,EAAE,IAJ4B;AAKtCC,EAAAA,mBAAmB,EAAE,MALiB;AAMtCC,EAAAA,WAAW,EAAE;AANyB,CAA1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ACM,KAAX,GAAmBkB,IAAI,CAACG,GAAL,CAASH,IAAI,CAACC,GAAL,CAASC,YAAY,GAAGH,QAAxB,EAAkC,CAAlC,CAAT,EAA+C,CAA/C,CAAnB;AACH,KAfmD;AAgBpDK,IAAAA,SAAS,EAAGT,KAAD,IAAW;AAClBpB,MAAAA,WAAW,CAACO,KAAZ,GAAoBa,KAAK,CAACE,aAAN,CAAoBC,CAAxC;AACH,KAlBmD;AAmBpDO,IAAAA,aAAa,EAAGV,KAAD,IAAW;AACtBpB,MAAAA,WAAW,CAACO,KAAZ,GAAoBa,KAAK,CAACE,aAAN,CAAoBC,CAAxC;AACH;AArBmD,GAAlC,CAAtB;AAwBA,QAAMQ,WAAW,GAAG,CAChB1B,mBADgB,EAEhBtB,WAAW,GAAG;AAAEiD,IAAAA,UAAU,EAAExC,cAAc,CAACyC;AAA7B,GAAH,GAAwC7C,SAFnC,EAGhBP,QAAQ,GAAGU,MAAM,CAACV,QAAV,GAAqBO,SAHb,CAApB;AAMA,SAAO;AACH2C,IAAAA,WADG;AAEHG,IAAAA,UAAU,EAAE,CAACtB,kBAAD,CAFT;AAGHnB,IAAAA,cAHG;AAIH0B,IAAAA,QAAQ,EAAEL,aAJP;AAKHhB,IAAAA,EALG;AAMHG,IAAAA;AANG,GAAP;AAQH;AAAA","sourcesContent":["import React from 'react';\nimport { Falsy, Keyboard, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport Animated from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { rgb } from '@fountain-ui/utils';\nimport { useHeight } from '../internal/hooks';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface Options {\n backgroundColor?: string;\n fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);\n fadeInEndY?: number | ((appBarHeight: number) => number);\n floating?: boolean;\n keyboardDismissMode?: 'none' | 'on-drag';\n translucent?: boolean;\n}\n\nexport interface FadeInAppBar {\n appBarStyle: ViewStyleProp;\n titleStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n dy: Animated.SharedValue<number>;\n normalized: Animated.SharedValue<number>;\n}\n\nconst defaultOptions: Required<Options> = {\n backgroundColor: '#ffffff',\n fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,\n fadeInEndY: (appBarHeight) => appBarHeight,\n floating: true,\n keyboardDismissMode: 'none',\n translucent: false,\n};\n\nconst shadowOffset = Platform.OS === 'ios' ? { width: 0, height: 3 } : undefined;\n\nexport default function useFadeInAppBar(userOptions: Options = defaultOptions): FadeInAppBar {\n const {\n backgroundColor,\n fadeInBeginY,\n fadeInEndY,\n floating,\n keyboardDismissMode,\n translucent,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n\n const [fromOffsetY, toOffsetY] = React.useMemo(() => {\n const endY = typeof fadeInEndY === 'function'\n ? fadeInEndY(appBarHeight)\n : fadeInEndY;\n\n const beginY = typeof fadeInBeginY === 'function'\n ? fadeInBeginY(endY, appBarHeight)\n : fadeInBeginY;\n\n return [beginY, endY];\n }, [fadeInBeginY, fadeInBeginY, appBarHeight]);\n\n const dy = Animated.useSharedValue<number>(0);\n const lastOffsetY = Animated.useSharedValue<number>(0);\n const normalized = Animated.useSharedValue<number>(0);\n\n const [r, g, b] = React.useMemo(() => rgb(backgroundColor), [backgroundColor]);\n\n const animatedAppBarStyle = Animated.useAnimatedStyle(() => ({\n backgroundColor: `rgba(${r}, ${g}, ${b}, ${normalized.value})`,\n elevation: normalized.value >= 1 ? 6 : 0,\n shadowColor: '#000',\n shadowOffset,\n shadowRadius: 4.65,\n shadowOpacity: normalized.value >= 1 ? 0.25 : 0,\n }));\n\n const animatedTitleStyle = Animated.useAnimatedStyle(() => ({\n opacity: normalized.value,\n }));\n\n const scrollHandler = Animated.useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n Animated.runOnJS(Keyboard.dismiss)();\n }\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n const distance = Math.max(toOffsetY - fromOffsetY, 1);\n const localOffsetY = offsetY - fromOffsetY;\n\n dy.value = offsetY - lastOffsetY.value;\n\n normalized.value = Math.min(Math.max(localOffsetY / distance, 0), 1);\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n });\n\n const appBarStyle = [\n animatedAppBarStyle,\n translucent ? { paddingTop: safeAreaInsets.top } : undefined,\n floating ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n titleStyle: [animatedTitleStyle],\n onAppBarLayout,\n onScroll: scrollHandler,\n dy,\n normalized,\n };\n};\n"]}
|
package/build/module/index.js
CHANGED
|
@@ -68,7 +68,7 @@ export { default as Menu } from './Menu';
|
|
|
68
68
|
export * from './Menu';
|
|
69
69
|
export { default as MenuItem } from './MenuItem';
|
|
70
70
|
export * from './MenuItem';
|
|
71
|
-
export { default as Modal } from './Modal';
|
|
71
|
+
export { default as Modal, createModalCloseEvent } from './Modal';
|
|
72
72
|
export * from './Modal';
|
|
73
73
|
export { default as Pagination } from './Pagination';
|
|
74
74
|
export * from './Pagination';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","Accordion","AppBar","AspectRatio","Avatar","Badge","Button","ButtonBase","Card","CardActions","CardContent","CardMedia","Checkbox","Chip","CircularProgress","Column","Dialog","DialogActions","DialogContent","DialogMedia","DialogTitle","Divider","Fab","IconButton","Image","Link","List","ListItem","ListItemIcon","ListItemSecondaryAction","ListItemText","ListSubheader","Menu","MenuItem","Modal","Pagination","PaginationItem","Paper","Portal","Radio","RadioGroup","Row","Slide","Slider","Snackbar","SnackbarContent","Spacer","SvgIcon","Switch","Tab","TabBase","Tabs","TextField","Toolbar","Tooltip","Typography"],"mappings":"AAAA,cAAc,UAAd;AAEA,cAAc,SAAd;AAEA,cAAc,SAAd;AAEA,cAAc,SAAd;AAEA,SAASA,OAAO,IAAIC,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASD,OAAO,IAAIE,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASF,OAAO,IAAIG,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASH,OAAO,IAAII,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASJ,OAAO,IAAIK,KAApB,QAAiC,SAAjC;AACA,cAAc,SAAd;AAEA,SAASL,OAAO,IAAIM,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASN,OAAO,IAAIO,UAApB,QAAsC,cAAtC;AACA,cAAc,cAAd;AAEA,SAASP,OAAO,IAAIQ,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAASR,OAAO,IAAIS,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASV,OAAO,IAAIW,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASX,OAAO,IAAIY,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASZ,OAAO,IAAIa,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAASb,OAAO,IAAIc,gBAApB,QAA4C,oBAA5C;AACA,cAAc,oBAAd;AAEA,SAASd,OAAO,IAAIe,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASf,OAAO,IAAIgB,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAAShB,OAAO,IAAIiB,aAApB,QAAyC,iBAAzC;AACA,cAAc,iBAAd;AAEA,SAASjB,OAAO,IAAIkB,aAApB,QAAyC,iBAAzC;AACA,cAAc,iBAAd;AAEA,SAASlB,OAAO,IAAImB,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASnB,OAAO,IAAIoB,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASpB,OAAO,IAAIqB,OAApB,QAAmC,WAAnC;AACA,cAAc,WAAd;AAEA,SAASrB,OAAO,IAAIsB,GAApB,QAA+B,OAA/B;AACA,cAAc,OAAd;AAEA,SAAStB,OAAO,IAAIuB,UAApB,QAAsC,cAAtC;AACA,cAAc,cAAd;AAEA,SAASvB,OAAO,IAAIwB,KAApB,QAAiC,SAAjC;AACA,cAAc,SAAd;AAEA,SAASxB,OAAO,IAAIyB,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAASzB,OAAO,IAAI0B,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAAS1B,OAAO,IAAI2B,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAAS3B,OAAO,IAAI4B,YAApB,QAAwC,gBAAxC;AACA,cAAc,gBAAd;AAEA,SAAS5B,OAAO,IAAI6B,uBAApB,QAAmD,2BAAnD;AACA,cAAc,2BAAd;AAEA,SAAS7B,OAAO,IAAI8B,YAApB,QAAwC,gBAAxC;AACA,cAAc,gBAAd;AAEA,SAAS9B,OAAO,IAAI+B,aAApB,QAAyC,iBAAzC;AACA,cAAc,iBAAd;AAEA,SAAS/B,OAAO,IAAIgC,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAAShC,OAAO,IAAIiC,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASjC,OAAO,IAAIkC,KAApB,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["default","Accordion","AppBar","AspectRatio","Avatar","Badge","Button","ButtonBase","Card","CardActions","CardContent","CardMedia","Checkbox","Chip","CircularProgress","Column","Dialog","DialogActions","DialogContent","DialogMedia","DialogTitle","Divider","Fab","IconButton","Image","Link","List","ListItem","ListItemIcon","ListItemSecondaryAction","ListItemText","ListSubheader","Menu","MenuItem","Modal","createModalCloseEvent","Pagination","PaginationItem","Paper","Portal","Radio","RadioGroup","Row","Slide","Slider","Snackbar","SnackbarContent","Spacer","SvgIcon","Switch","Tab","TabBase","Tabs","TextField","Toolbar","Tooltip","Typography"],"mappings":"AAAA,cAAc,UAAd;AAEA,cAAc,SAAd;AAEA,cAAc,SAAd;AAEA,cAAc,SAAd;AAEA,SAASA,OAAO,IAAIC,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASD,OAAO,IAAIE,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASF,OAAO,IAAIG,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASH,OAAO,IAAII,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASJ,OAAO,IAAIK,KAApB,QAAiC,SAAjC;AACA,cAAc,SAAd;AAEA,SAASL,OAAO,IAAIM,MAApB,QAAkC,UAAlC;AACA,cAAc,UAAd;AAEA,SAASN,OAAO,IAAIO,UAApB,QAAsC,cAAtC;AACA,cAAc,cAAd;AAEA,SAASP,OAAO,IAAIQ,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAASR,OAAO,IAAIS,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAAST,OAAO,IAAIU,WAApB,QAAuC,eAAvC;AACA,cAAc,eAAd;AAEA,SAASV,OAAO,IAAIW,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASX,OAAO,IAAIY,QAApB,QAAoC,YAApC;AACA,cAAc,YAAd;AAEA,SAASZ,OAAO,IAAIa,IAApB,QAAgC,QAAhC;AACA,cAAc,QAAd;AAEA,SAASb,OAAO,IAAIc,gB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AhC;AACA,cAAc,QAAd;AAEA,SAASpD,OAAO,IAAIqD,SAApB,QAAqC,aAArC;AACA,cAAc,aAAd;AAEA,SAASrD,OAAO,IAAIsD,OAApB,QAAmC,WAAnC;AACA,cAAc,WAAd;AAEA,SAAStD,OAAO,IAAIuD,OAApB,QAAmC,WAAnC;AACA,cAAc,WAAd;AAEA,SAASvD,OAAO,IAAIwD,UAApB,QAAsC,cAAtC;AACA,cAAc,cAAd;AAEA,cAAc,YAAd","sourcesContent":["export * from './styles';\n\nexport * from './types';\n\nexport * from './hooks';\n\nexport * from './utils';\n\nexport { default as Accordion } from './Accordion';\nexport * from './Accordion';\n\nexport { default as AppBar } from './AppBar';\nexport * from './AppBar';\n\nexport { default as AspectRatio } from './AspectRatio';\nexport * from './AspectRatio';\n\nexport { default as Avatar } from './Avatar';\nexport * from './Avatar';\n\nexport { default as Badge } from './Badge';\nexport * from './Badge';\n\nexport { default as Button } from './Button';\nexport * from './Button';\n\nexport { default as ButtonBase } from './ButtonBase';\nexport * from './ButtonBase';\n\nexport { default as Card } from './Card';\nexport * from './Card';\n\nexport { default as CardActions } from './CardActions';\nexport * from './CardActions';\n\nexport { default as CardContent } from './CardContent';\nexport * from './CardContent';\n\nexport { default as CardMedia } from './CardMedia';\nexport * from './CardMedia';\n\nexport { default as Checkbox } from './Checkbox';\nexport * from './Checkbox';\n\nexport { default as Chip } from './Chip';\nexport * from './Chip';\n\nexport { default as CircularProgress } from './CircularProgress';\nexport * from './CircularProgress';\n\nexport { default as Column } from './Column';\nexport * from './Column';\n\nexport { default as Dialog } from './Dialog';\nexport * from './Dialog';\n\nexport { default as DialogActions } from './DialogActions';\nexport * from './DialogActions';\n\nexport { default as DialogContent } from './DialogContent';\nexport * from './DialogContent';\n\nexport { default as DialogMedia } from './DialogMedia';\nexport * from './DialogMedia';\n\nexport { default as DialogTitle } from './DialogTitle';\nexport * from './DialogTitle';\n\nexport { default as Divider } from './Divider';\nexport * from './Divider';\n\nexport { default as Fab } from './Fab';\nexport * from './Fab';\n\nexport { default as IconButton } from './IconButton';\nexport * from './IconButton';\n\nexport { default as Image } from './Image';\nexport * from './Image';\n\nexport { default as Link } from './Link';\nexport * from './Link';\n\nexport { default as List } from './List';\nexport * from './List';\n\nexport { default as ListItem } from './ListItem';\nexport * from './ListItem';\n\nexport { default as ListItemIcon } from './ListItemIcon';\nexport * from './ListItemIcon';\n\nexport { default as ListItemSecondaryAction } from './ListItemSecondaryAction';\nexport * from './ListItemSecondaryAction';\n\nexport { default as ListItemText } from './ListItemText';\nexport * from './ListItemText';\n\nexport { default as ListSubheader } from './ListSubheader';\nexport * from './ListSubheader';\n\nexport { default as Menu } from './Menu';\nexport * from './Menu';\n\nexport { default as MenuItem } from './MenuItem';\nexport * from './MenuItem';\n\nexport { default as Modal, createModalCloseEvent } from './Modal';\nexport type { ModalCloseEvent } from './Modal';\nexport * from './Modal';\n\nexport { default as Pagination } from './Pagination';\nexport * from './Pagination';\n\nexport { default as PaginationItem } from './PaginationItem';\nexport * from './PaginationItem';\n\nexport { default as Paper } from './Paper';\nexport * from './Paper';\n\nexport { default as Portal } from './Portal';\nexport * from './Portal';\n\nexport { default as Radio } from './Radio';\nexport * from './Radio';\n\nexport { default as RadioGroup } from './RadioGroup';\nexport * from './RadioGroup';\n\nexport { default as Row } from './Row';\nexport * from './Row';\n\nexport { default as Slide } from './Slide';\nexport * from './Slide';\n\nexport { default as Slider } from './Slider';\nexport * from './Slider';\n\nexport { default as Snackbar } from './Snackbar';\nexport * from './Snackbar';\n\nexport { default as SnackbarContent } from './SnackbarContent';\nexport * from './SnackbarContent';\n\nexport { default as Spacer } from './Spacer';\nexport * from './Spacer';\n\nexport { default as SvgIcon } from './SvgIcon';\nexport * from './SvgIcon';\n\nexport { default as Switch } from './Switch';\nexport * from './Switch';\n\nexport { default as Tab } from './Tab';\nexport * from './Tab';\n\nexport { default as TabBase } from './TabBase';\nexport * from './TabBase';\n\nexport { default as Tabs } from './Tabs';\nexport * from './Tabs';\n\nexport { default as TextField } from './TextField';\nexport * from './TextField';\n\nexport { default as Toolbar } from './Toolbar';\nexport * from './Toolbar';\n\nexport { default as Tooltip } from './Tooltip';\nexport * from './Tooltip';\n\nexport { default as Typography } from './Typography';\nexport * from './Typography';\n\nexport * from './animated';\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Path } from 'react-native-svg';
|
|
3
|
+
import { createSvgIcon } from '../../utils';
|
|
4
|
+
export default createSvgIcon( /*#__PURE__*/React.createElement(Path, {
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
clipRule: "evenodd",
|
|
7
|
+
d: "M6.76965 9.46973L12.2697 3.96973L13.3303 5.03039L8.36064 10.0001L13.3303 14.9697L12.2697 16.0304L6.76965 10.5304L6.76965 9.46973Z"
|
|
8
|
+
}), 'ChevronLeft');
|
|
9
|
+
//# sourceMappingURL=ChevronLeft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChevronLeft.tsx"],"names":["React","Path","createSvgIcon"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAeA,aAAa,eACxB,oBAAC,IAAD;AACI,EAAA,QAAQ,EAAC,SADb;AAEI,EAAA,QAAQ,EAAC,SAFb;AAGI,EAAA,CAAC,EAAC;AAHN,EADwB,EAMtB,aANsB,CAA5B","sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6.76965 9.46973L12.2697 3.96973L13.3303 5.03039L8.36064 10.0001L13.3303 14.9697L12.2697 16.0304L6.76965 10.5304L6.76965 9.46973Z\"\n />\n , 'ChevronLeft');\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Path } from 'react-native-svg';
|
|
3
|
+
import { createSvgIcon } from '../../utils';
|
|
4
|
+
export default createSvgIcon( /*#__PURE__*/React.createElement(Path, {
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
clipRule: "evenodd",
|
|
7
|
+
d: "M13.3303 10.5303L7.83032 16.0303L6.76966 14.9697L11.7393 10L6.76966 5.03033L7.83032 3.96968L13.3303 9.46967V10.5303Z"
|
|
8
|
+
}), 'ChevronRight');
|
|
9
|
+
//# sourceMappingURL=ChevronRight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ChevronRight.tsx"],"names":["React","Path","createSvgIcon"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAeA,aAAa,eACxB,oBAAC,IAAD;AACI,EAAA,QAAQ,EAAC,SADb;AAEI,EAAA,QAAQ,EAAC,SAFb;AAGI,EAAA,CAAC,EAAC;AAHN,EADwB,EAMtB,cANsB,CAA5B","sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M13.3303 10.5303L7.83032 16.0303L6.76966 14.9697L11.7393 10L6.76966 5.03033L7.83032 3.96968L13.3303 9.46967V10.5303Z\"\n />\n , 'ChevronRight');\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as Checkbox } from './Checkbox';
|
|
2
2
|
export { default as CheckboxChecked } from './CheckboxChecked';
|
|
3
3
|
export { default as ChevronDown } from './ChevronDown';
|
|
4
|
+
export { default as ChevronLeft } from './ChevronLeft';
|
|
5
|
+
export { default as ChevronRight } from './ChevronRight';
|
|
4
6
|
export { default as CircularProgress } from './CircularProgress';
|
|
5
7
|
export { default as Close } from './Close';
|
|
6
8
|
export { default as Radio } from './Radio';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","Checkbox","CheckboxChecked","ChevronDown","CircularProgress","Close","Radio","RadioChecked"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,mBAA3C;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,eAAvC;AACA,SAASH,OAAO,IAAII,gBAApB,QAA4C,oBAA5C;AACA,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["default","Checkbox","CheckboxChecked","ChevronDown","ChevronLeft","ChevronRight","CircularProgress","Close","Radio","RadioChecked"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,mBAA3C;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,eAAvC;AACA,SAASH,OAAO,IAAII,WAApB,QAAuC,eAAvC;AACA,SAASJ,OAAO,IAAIK,YAApB,QAAwC,gBAAxC;AACA,SAASL,OAAO,IAAIM,gBAApB,QAA4C,oBAA5C;AACA,SAASN,OAAO,IAAIO,KAApB,QAAiC,SAAjC;AACA,SAASP,OAAO,IAAIQ,KAApB,QAAiC,SAAjC;AACA,SAASR,OAAO,IAAIS,YAApB,QAAwC,gBAAxC","sourcesContent":["export { default as Checkbox } from './Checkbox';\nexport { default as CheckboxChecked } from './CheckboxChecked';\nexport { default as ChevronDown } from './ChevronDown';\nexport { default as ChevronLeft } from './ChevronLeft';\nexport { default as ChevronRight } from './ChevronRight';\nexport { default as CircularProgress } from './CircularProgress';\nexport { default as Close } from './Close';\nexport { default as Radio } from './Radio';\nexport { default as RadioChecked } from './RadioChecked';\n"]}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type ModalProps from './ModalProps';
|
|
3
|
+
export declare type ModalCloseReasonType = 'OUTSIDE_PRESS' | 'HARDWARE_BACK_PRESS' | 'CLOSE_BUTTON_PRESS' | 'UNKNOWN';
|
|
4
|
+
export interface ModalCloseEvent {
|
|
5
|
+
metadata: {
|
|
6
|
+
reason: ModalCloseReasonType;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const createModalCloseEvent: (reason: ModalCloseReasonType) => {
|
|
10
|
+
metadata: {
|
|
11
|
+
reason: ModalCloseReasonType;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
3
14
|
export default function Modal(props: ModalProps): JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
import type { ComponentProps, OverridableComponentProps } from '../types';
|
|
4
|
+
import { ModalCloseEvent } from './Modal';
|
|
4
5
|
export default interface ModalProps extends OverridableComponentProps<ViewProps, {
|
|
5
6
|
/**
|
|
6
7
|
* Style object provided to animation component.
|
|
@@ -28,7 +29,7 @@ export default interface ModalProps extends OverridableComponentProps<ViewProps,
|
|
|
28
29
|
/**
|
|
29
30
|
* Callback fired when the component requests to be closed.
|
|
30
31
|
*/
|
|
31
|
-
onClose?: () => void;
|
|
32
|
+
onClose?: (event?: ModalCloseEvent) => void;
|
|
32
33
|
/**
|
|
33
34
|
* If `true`, the modal is visible.
|
|
34
35
|
*/
|
|
@@ -8,6 +8,7 @@ export interface Options {
|
|
|
8
8
|
fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);
|
|
9
9
|
fadeInEndY?: number | ((appBarHeight: number) => number);
|
|
10
10
|
floating?: boolean;
|
|
11
|
+
keyboardDismissMode?: 'none' | 'on-drag';
|
|
11
12
|
translucent?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export interface FadeInAppBar {
|
|
@@ -68,7 +68,8 @@ export { default as Menu } from './Menu';
|
|
|
68
68
|
export * from './Menu';
|
|
69
69
|
export { default as MenuItem } from './MenuItem';
|
|
70
70
|
export * from './MenuItem';
|
|
71
|
-
export { default as Modal } from './Modal';
|
|
71
|
+
export { default as Modal, createModalCloseEvent } from './Modal';
|
|
72
|
+
export type { ModalCloseEvent } from './Modal';
|
|
72
73
|
export * from './Modal';
|
|
73
74
|
export { default as Pagination } from './Pagination';
|
|
74
75
|
export * from './Pagination';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: React.MemoExoticComponent<{
|
|
3
|
+
(props: {
|
|
4
|
+
readonly style?: import("@emotion/native").ReactNativeStyle | import("@emotion/native").ReactNativeStyle[] | undefined;
|
|
5
|
+
readonly width?: import("react-native-svg").NumberProp | undefined;
|
|
6
|
+
readonly height?: import("react-native-svg").NumberProp | undefined;
|
|
7
|
+
readonly viewBox?: string | undefined;
|
|
8
|
+
preserveAspectRatio?: string | undefined;
|
|
9
|
+
readonly color?: import("react-native-svg").Color | undefined;
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
opacity?: import("react-native-svg").NumberProp | undefined;
|
|
12
|
+
readonly fill?: import("react-native-svg").Color | undefined;
|
|
13
|
+
fillOpacity?: import("react-native-svg").NumberProp | undefined;
|
|
14
|
+
fillRule?: import("react-native-svg").FillRule | undefined;
|
|
15
|
+
stroke?: import("react-native-svg").Color | undefined;
|
|
16
|
+
strokeWidth?: import("react-native-svg").NumberProp | undefined;
|
|
17
|
+
strokeOpacity?: import("react-native-svg").NumberProp | undefined;
|
|
18
|
+
strokeDasharray?: import("react-native-svg").NumberProp | readonly import("react-native-svg").NumberProp[] | undefined;
|
|
19
|
+
strokeDashoffset?: import("react-native-svg").NumberProp | undefined;
|
|
20
|
+
strokeLinecap?: import("react-native-svg").Linecap | undefined;
|
|
21
|
+
strokeLinejoin?: import("react-native-svg").Linejoin | undefined;
|
|
22
|
+
strokeMiterlimit?: import("react-native-svg").NumberProp | undefined;
|
|
23
|
+
clipRule?: import("react-native-svg").FillRule | undefined;
|
|
24
|
+
clipPath?: string | undefined;
|
|
25
|
+
transform?: string | import("react-native-svg").TransformObject | import("react-native-svg").ColumnMajorTransformMatrix | undefined;
|
|
26
|
+
translate?: import("react-native-svg").NumberArray | undefined;
|
|
27
|
+
translateX?: import("react-native-svg").NumberProp | undefined;
|
|
28
|
+
translateY?: import("react-native-svg").NumberProp | undefined;
|
|
29
|
+
origin?: import("react-native-svg").NumberArray | undefined;
|
|
30
|
+
originX?: import("react-native-svg").NumberProp | undefined;
|
|
31
|
+
originY?: import("react-native-svg").NumberProp | undefined;
|
|
32
|
+
scale?: import("react-native-svg").NumberArray | undefined;
|
|
33
|
+
scaleX?: import("react-native-svg").NumberProp | undefined;
|
|
34
|
+
scaleY?: import("react-native-svg").NumberProp | undefined;
|
|
35
|
+
skew?: import("react-native-svg").NumberArray | undefined;
|
|
36
|
+
skewX?: import("react-native-svg").NumberProp | undefined;
|
|
37
|
+
skewY?: import("react-native-svg").NumberProp | undefined;
|
|
38
|
+
rotation?: import("react-native-svg").NumberProp | undefined;
|
|
39
|
+
x?: import("react-native-svg").NumberArray | undefined;
|
|
40
|
+
y?: import("react-native-svg").NumberArray | undefined;
|
|
41
|
+
vectorEffect?: "none" | "inherit" | "non-scaling-stroke" | "nonScalingStroke" | "default" | "uri" | undefined;
|
|
42
|
+
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
43
|
+
onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
44
|
+
onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
45
|
+
onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
46
|
+
onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
47
|
+
onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
48
|
+
onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
49
|
+
onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
50
|
+
onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
51
|
+
onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
52
|
+
onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
53
|
+
onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
54
|
+
onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
55
|
+
disabled?: boolean | undefined;
|
|
56
|
+
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
57
|
+
onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
58
|
+
onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
59
|
+
onLongPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
60
|
+
delayPressIn?: number | undefined;
|
|
61
|
+
delayPressOut?: number | undefined;
|
|
62
|
+
delayLongPress?: number | undefined;
|
|
63
|
+
id?: string | undefined;
|
|
64
|
+
marker?: string | undefined;
|
|
65
|
+
markerStart?: string | undefined;
|
|
66
|
+
markerMid?: string | undefined;
|
|
67
|
+
markerEnd?: string | undefined;
|
|
68
|
+
mask?: string | undefined;
|
|
69
|
+
hitSlop?: import("react-native").Insets | undefined;
|
|
70
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
71
|
+
removeClippedSubviews?: boolean | undefined;
|
|
72
|
+
testID?: string | undefined;
|
|
73
|
+
nativeID?: string | undefined;
|
|
74
|
+
collapsable?: boolean | undefined;
|
|
75
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
76
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
77
|
+
focusable?: boolean | undefined;
|
|
78
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
79
|
+
isTVSelectable?: boolean | undefined;
|
|
80
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
81
|
+
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
82
|
+
tvParallaxShiftDistanceX?: number | undefined;
|
|
83
|
+
tvParallaxShiftDistanceY?: number | undefined;
|
|
84
|
+
tvParallaxTiltAngle?: number | undefined;
|
|
85
|
+
tvParallaxMagnification?: number | undefined;
|
|
86
|
+
onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
87
|
+
onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
88
|
+
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
89
|
+
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
90
|
+
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
91
|
+
accessible?: boolean | undefined;
|
|
92
|
+
accessibilityActions?: readonly Readonly<{
|
|
93
|
+
name: string;
|
|
94
|
+
label?: string | undefined;
|
|
95
|
+
}>[] | undefined;
|
|
96
|
+
accessibilityLabel?: string | undefined;
|
|
97
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
98
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
99
|
+
accessibilityHint?: string | undefined;
|
|
100
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
101
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
102
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
103
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
104
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
105
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
106
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
107
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
108
|
+
onMagicTap?: (() => void) | undefined;
|
|
109
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
110
|
+
}): JSX.Element;
|
|
111
|
+
displayName: string;
|
|
112
|
+
}>;
|
|
113
|
+
export default _default;
|