vitest-native 0.6.1 → 0.8.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.
@@ -746,12 +746,12 @@ function createMockNavigation() {
746
746
  * useNavigation() and useRoute() inside the screen component return values
747
747
  * consistent with the route/navigation props passed to the component.
748
748
  */
749
- function createMockScreen(NavContext, RouteContext) {
749
+ function createMockScreen(NavContext, RouteContext, defaultRouteParams) {
750
750
  const Screen = react.default.forwardRef(({ component: Component, children, ...rest }, ref) => {
751
751
  const route = {
752
752
  key: rest.name ?? "",
753
753
  name: rest.name ?? "",
754
- params: rest.initialParams
754
+ params: rest.initialParams ?? defaultRouteParams
755
755
  };
756
756
  const nav = createMockNavigation();
757
757
  const content = Component ? react.default.createElement(Component, {
@@ -769,7 +769,8 @@ function createMockScreen(NavContext, RouteContext) {
769
769
  Screen.displayName = "Screen";
770
770
  return Screen;
771
771
  }
772
- function navigation() {
772
+ function navigation(presetOptions = {}) {
773
+ const defaultRouteParams = presetOptions.defaultRouteParams ?? {};
773
774
  const NavigationContext = react.default.createContext(null);
774
775
  const NavigationRouteContext = react.default.createContext(null);
775
776
  const NavigationContainerRefContext = react.default.createContext(null);
@@ -780,9 +781,10 @@ function navigation() {
780
781
  colors: {}
781
782
  });
782
783
  const PreventRemoveContext = react.default.createContext(null);
783
- const Screen = createMockScreen(NavigationContext, NavigationRouteContext);
784
+ const Screen = createMockScreen(NavigationContext, NavigationRouteContext, defaultRouteParams);
784
785
  return {
785
786
  name: "navigation",
787
+ config: { defaultRouteParams },
786
788
  modules: {
787
789
  "@react-navigation/native": {
788
790
  exports: [
@@ -869,7 +871,7 @@ function navigation() {
869
871
  const defaultRoute = {
870
872
  key: "test-route-key",
871
873
  name: "TestScreen",
872
- params: {}
874
+ params: defaultRouteParams
873
875
  };
874
876
  function useNavigation() {
875
877
  try {
@@ -1800,12 +1802,645 @@ function vectorIcons() {
1800
1802
  };
1801
1803
  }
1802
1804
  //#endregion
1805
+ //#region src/presets/flash-list.ts
1806
+ function flashList() {
1807
+ return {
1808
+ name: "flashList",
1809
+ modules: { "@shopify/flash-list": {
1810
+ exports: [
1811
+ "FlashList",
1812
+ "AnimatedFlashList",
1813
+ "LayoutCommitObserver",
1814
+ "ViewToken",
1815
+ "RenderTargetOptions",
1816
+ "useRecyclingState",
1817
+ "useLayoutState",
1818
+ "useMappingHelper",
1819
+ "useFlashListContext",
1820
+ "useBenchmark"
1821
+ ],
1822
+ factory: () => {
1823
+ const renderElement = (Component) => {
1824
+ if (Component == null) return null;
1825
+ if (react.default.isValidElement(Component)) return Component;
1826
+ return react.default.createElement(Component);
1827
+ };
1828
+ function createFlashList(name) {
1829
+ const List = react.default.forwardRef((props, ref) => {
1830
+ const { data, renderItem, keyExtractor, extraData, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ...rest } = props;
1831
+ react.default.useImperativeHandle(ref, () => ({
1832
+ scrollToEnd: () => {},
1833
+ scrollToIndex: () => {},
1834
+ scrollToItem: () => {},
1835
+ scrollToOffset: () => {},
1836
+ scrollToTop: () => {},
1837
+ flashScrollIndicators: () => {},
1838
+ recordInteraction: () => {},
1839
+ recomputeViewableItems: () => {},
1840
+ prepareForLayoutAnimationRender: () => {},
1841
+ getScrollableNode: () => null,
1842
+ getNativeScrollRef: () => null
1843
+ }));
1844
+ const items = Array.isArray(data) ? data : [];
1845
+ const rows = items.length === 0 ? renderElement(ListEmptyComponent) : items.map((item, index) => {
1846
+ const element = renderItem ? renderItem({
1847
+ item,
1848
+ index,
1849
+ extraData,
1850
+ target: "Cell"
1851
+ }) : null;
1852
+ if (element == null) return null;
1853
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
1854
+ return react.default.createElement(react.default.Fragment, { key }, element);
1855
+ });
1856
+ return react.default.createElement(name, rest, renderElement(ListHeaderComponent), rows, renderElement(ListFooterComponent));
1857
+ });
1858
+ List.displayName = name;
1859
+ return List;
1860
+ }
1861
+ const FlashList = createFlashList("FlashList");
1862
+ const LayoutCommitObserver = react.default.forwardRef((props, ref) => react.default.createElement("LayoutCommitObserver", {
1863
+ ...props,
1864
+ ref
1865
+ }, props.children));
1866
+ LayoutCommitObserver.displayName = "LayoutCommitObserver";
1867
+ return {
1868
+ __esModule: true,
1869
+ default: FlashList,
1870
+ FlashList,
1871
+ AnimatedFlashList: createFlashList("AnimatedFlashList"),
1872
+ LayoutCommitObserver,
1873
+ RenderTargetOptions: {
1874
+ Cell: "Cell",
1875
+ StickyHeader: "StickyHeader",
1876
+ Measurement: "Measurement"
1877
+ },
1878
+ ViewToken: function ViewToken() {},
1879
+ useRecyclingState: (initialState) => react.default.useState(initialState),
1880
+ useLayoutState: (initialState) => react.default.useState(initialState),
1881
+ useMappingHelper: () => ({ getMappingKey: (_item, index) => String(index) }),
1882
+ useFlashListContext: () => void 0,
1883
+ useBenchmark: () => {}
1884
+ };
1885
+ }
1886
+ } }
1887
+ };
1888
+ }
1889
+ //#endregion
1890
+ //#region src/mocks/components/TextInput.ts
1891
+ function createTextInputMock() {
1892
+ const TextInput = react.default.forwardRef((props, ref) => {
1893
+ const instanceMethods = {
1894
+ focus: vitest.vi.fn(),
1895
+ blur: vitest.vi.fn(),
1896
+ clear: vitest.vi.fn(),
1897
+ isFocused: vitest.vi.fn(() => false),
1898
+ setNativeProps: vitest.vi.fn()
1899
+ };
1900
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1901
+ return react.default.createElement("TextInput", {
1902
+ ...props,
1903
+ ref
1904
+ });
1905
+ });
1906
+ TextInput.displayName = "TextInput";
1907
+ return TextInput;
1908
+ }
1909
+ //#endregion
1910
+ //#region src/mocks/components/ScrollView.ts
1911
+ function createScrollViewMock() {
1912
+ const ScrollView = react.default.forwardRef((props, ref) => {
1913
+ const { children, refreshControl, ...rest } = props;
1914
+ const instanceMethods = {
1915
+ scrollTo: vitest.vi.fn(),
1916
+ scrollToEnd: vitest.vi.fn(),
1917
+ flashScrollIndicators: vitest.vi.fn(),
1918
+ getScrollResponder: vitest.vi.fn(() => ({})),
1919
+ getInnerViewNode: vitest.vi.fn(),
1920
+ setNativeProps: vitest.vi.fn()
1921
+ };
1922
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1923
+ return react.default.createElement("RCTScrollView", {
1924
+ ...rest,
1925
+ ref
1926
+ }, refreshControl, react.default.createElement("View", null, children));
1927
+ });
1928
+ ScrollView.displayName = "ScrollView";
1929
+ return ScrollView;
1930
+ }
1931
+ //#endregion
1932
+ //#region src/mocks/components/FlatList.ts
1933
+ function createFlatListMock() {
1934
+ const FlatList = react.default.forwardRef((props, ref) => {
1935
+ const { data, renderItem, keyExtractor, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ItemSeparatorComponent, refreshControl, ...rest } = props;
1936
+ const instanceMethods = {
1937
+ scrollToEnd: vitest.vi.fn(),
1938
+ scrollToIndex: vitest.vi.fn(),
1939
+ scrollToItem: vitest.vi.fn(),
1940
+ scrollToOffset: vitest.vi.fn(),
1941
+ recordInteraction: vitest.vi.fn(),
1942
+ flashScrollIndicators: vitest.vi.fn(),
1943
+ getScrollResponder: vitest.vi.fn(() => ({})),
1944
+ getNativeScrollRef: vitest.vi.fn(),
1945
+ getScrollableNode: vitest.vi.fn(),
1946
+ setNativeProps: vitest.vi.fn()
1947
+ };
1948
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1949
+ const children = [];
1950
+ if (ListHeaderComponent) children.push(react.default.createElement("FlatList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
1951
+ if (data && data.length > 0) data.forEach((item, index) => {
1952
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
1953
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
1954
+ item,
1955
+ index,
1956
+ separators: {
1957
+ highlight: vitest.vi.fn(),
1958
+ unhighlight: vitest.vi.fn(),
1959
+ updateProps: vitest.vi.fn()
1960
+ }
1961
+ })));
1962
+ if (ItemSeparatorComponent && index < data.length - 1) children.push(react.default.createElement(react.default.Fragment, { key: `separator-${index}` }, typeof ItemSeparatorComponent === "function" ? react.default.createElement(ItemSeparatorComponent) : ItemSeparatorComponent));
1963
+ });
1964
+ else if (ListEmptyComponent) children.push(react.default.createElement("FlatList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
1965
+ if (ListFooterComponent) children.push(react.default.createElement("FlatList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
1966
+ if (refreshControl) children.unshift(refreshControl);
1967
+ return react.default.createElement("FlatList", {
1968
+ ...rest,
1969
+ ref
1970
+ }, ...children);
1971
+ });
1972
+ FlatList.displayName = "FlatList";
1973
+ return FlatList;
1974
+ }
1975
+ //#endregion
1976
+ //#region src/mocks/components/SectionList.ts
1977
+ function createSectionListMock() {
1978
+ const SectionList = react.default.forwardRef((props, ref) => {
1979
+ const { sections, renderItem, renderSectionHeader, renderSectionFooter, keyExtractor, refreshControl, ListEmptyComponent, ListHeaderComponent, ListFooterComponent, ItemSeparatorComponent, SectionSeparatorComponent, ...rest } = props;
1980
+ const instanceMethods = {
1981
+ scrollToEnd: vitest.vi.fn(),
1982
+ scrollToIndex: vitest.vi.fn(),
1983
+ scrollToLocation: vitest.vi.fn(),
1984
+ recordInteraction: vitest.vi.fn(),
1985
+ flashScrollIndicators: vitest.vi.fn(),
1986
+ getScrollResponder: vitest.vi.fn(() => ({})),
1987
+ getNativeScrollRef: vitest.vi.fn(),
1988
+ getScrollableNode: vitest.vi.fn(),
1989
+ setNativeProps: vitest.vi.fn()
1990
+ };
1991
+ react.default.useImperativeHandle(ref, () => instanceMethods);
1992
+ const children = [];
1993
+ if (ListHeaderComponent) children.push(react.default.createElement("SectionList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
1994
+ if (sections) sections.forEach((section, sectionIndex) => {
1995
+ if (renderSectionHeader) children.push(react.default.createElement(react.default.Fragment, { key: `header-${sectionIndex}` }, renderSectionHeader({ section })));
1996
+ if (SectionSeparatorComponent && sectionIndex > 0) children.push(react.default.createElement(react.default.Fragment, { key: `section-sep-${sectionIndex}` }, typeof SectionSeparatorComponent === "function" ? react.default.createElement(SectionSeparatorComponent) : SectionSeparatorComponent));
1997
+ if (section.data) section.data.forEach((item, index) => {
1998
+ const key = keyExtractor ? keyExtractor(item, index) : `${sectionIndex}-${index}`;
1999
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
2000
+ item,
2001
+ index,
2002
+ section,
2003
+ separators: {
2004
+ highlight: vitest.vi.fn(),
2005
+ unhighlight: vitest.vi.fn(),
2006
+ updateProps: vitest.vi.fn()
2007
+ }
2008
+ })));
2009
+ if (ItemSeparatorComponent && index < section.data.length - 1) children.push(react.default.createElement(react.default.Fragment, { key: `sep-${sectionIndex}-${index}` }, typeof ItemSeparatorComponent === "function" ? react.default.createElement(ItemSeparatorComponent) : ItemSeparatorComponent));
2010
+ });
2011
+ if (renderSectionFooter) children.push(react.default.createElement(react.default.Fragment, { key: `footer-${sectionIndex}` }, renderSectionFooter({ section })));
2012
+ });
2013
+ if (ListFooterComponent) children.push(react.default.createElement("SectionList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
2014
+ if (refreshControl) children.unshift(refreshControl);
2015
+ if ((!sections || sections.length === 0) && ListEmptyComponent) children.push(react.default.createElement("SectionList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
2016
+ return react.default.createElement("SectionList", {
2017
+ ...rest,
2018
+ ref
2019
+ }, ...children);
2020
+ });
2021
+ SectionList.displayName = "SectionList";
2022
+ return SectionList;
2023
+ }
2024
+ //#endregion
2025
+ //#region src/mocks/components/VirtualizedList.ts
2026
+ function createVirtualizedListMock() {
2027
+ const VirtualizedList = react.default.forwardRef((props, ref) => {
2028
+ const { data, renderItem, keyExtractor, getItemCount, getItem, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, ...rest } = props;
2029
+ const instanceMethods = {
2030
+ scrollToEnd: vitest.vi.fn(),
2031
+ scrollToIndex: vitest.vi.fn(),
2032
+ scrollToItem: vitest.vi.fn(),
2033
+ scrollToOffset: vitest.vi.fn(),
2034
+ recordInteraction: vitest.vi.fn(),
2035
+ flashScrollIndicators: vitest.vi.fn(),
2036
+ getScrollResponder: vitest.vi.fn(() => ({})),
2037
+ getNativeScrollRef: vitest.vi.fn(),
2038
+ getScrollableNode: vitest.vi.fn(),
2039
+ setNativeProps: vitest.vi.fn()
2040
+ };
2041
+ react.default.useImperativeHandle(ref, () => instanceMethods);
2042
+ const children = [];
2043
+ if (ListHeaderComponent) children.push(react.default.createElement("VirtualizedList-Header", { key: "__header" }, typeof ListHeaderComponent === "function" ? react.default.createElement(ListHeaderComponent) : ListHeaderComponent));
2044
+ const itemCount = getItemCount ? getItemCount(data) : data ? data.length : 0;
2045
+ if (itemCount > 0) for (let index = 0; index < itemCount; index++) {
2046
+ const item = getItem ? getItem(data, index) : data[index];
2047
+ const key = keyExtractor ? keyExtractor(item, index) : String(index);
2048
+ children.push(react.default.createElement(react.default.Fragment, { key }, renderItem({
2049
+ item,
2050
+ index,
2051
+ separators: {}
2052
+ })));
2053
+ }
2054
+ else if (ListEmptyComponent) children.push(react.default.createElement("VirtualizedList-Empty", { key: "__empty" }, typeof ListEmptyComponent === "function" ? react.default.createElement(ListEmptyComponent) : ListEmptyComponent));
2055
+ if (ListFooterComponent) children.push(react.default.createElement("VirtualizedList-Footer", { key: "__footer" }, typeof ListFooterComponent === "function" ? react.default.createElement(ListFooterComponent) : ListFooterComponent));
2056
+ return react.default.createElement("VirtualizedList", {
2057
+ ...rest,
2058
+ ref
2059
+ }, ...children);
2060
+ });
2061
+ VirtualizedList.displayName = "VirtualizedList";
2062
+ return VirtualizedList;
2063
+ }
2064
+ //#endregion
2065
+ //#region src/mocks/components/TouchableOpacity.ts
2066
+ function createTouchableOpacityMock() {
2067
+ const TouchableOpacity = react.default.forwardRef((props, ref) => react.default.createElement("TouchableOpacity", buildPressableHostProps(props, ref)));
2068
+ TouchableOpacity.displayName = "TouchableOpacity";
2069
+ return TouchableOpacity;
2070
+ }
2071
+ //#endregion
2072
+ //#region src/mocks/components/TouchableHighlight.ts
2073
+ function createTouchableHighlightMock() {
2074
+ const TouchableHighlight = react.default.forwardRef((props, ref) => react.default.createElement("TouchableHighlight", buildPressableHostProps(props, ref)));
2075
+ TouchableHighlight.displayName = "TouchableHighlight";
2076
+ return TouchableHighlight;
2077
+ }
2078
+ //#endregion
2079
+ //#region src/mocks/components/TouchableWithoutFeedback.ts
2080
+ function createTouchableWithoutFeedbackMock() {
2081
+ const TouchableWithoutFeedback = react.default.forwardRef((props, ref) => react.default.createElement("TouchableWithoutFeedback", buildPressableHostProps(props, ref)));
2082
+ TouchableWithoutFeedback.displayName = "TouchableWithoutFeedback";
2083
+ return TouchableWithoutFeedback;
2084
+ }
2085
+ //#endregion
2086
+ //#region src/presets/bottom-sheet.ts
2087
+ function bottomSheet() {
2088
+ return {
2089
+ name: "bottomSheet",
2090
+ modules: { "@gorhom/bottom-sheet": {
2091
+ exports: [
2092
+ "BottomSheetModal",
2093
+ "BottomSheetModalProvider",
2094
+ "BottomSheetView",
2095
+ "BottomSheetDraggableView",
2096
+ "BottomSheetScrollView",
2097
+ "BottomSheetFlatList",
2098
+ "BottomSheetSectionList",
2099
+ "BottomSheetVirtualizedList",
2100
+ "BottomSheetFlashList",
2101
+ "BottomSheetTextInput",
2102
+ "BottomSheetBackdrop",
2103
+ "BottomSheetFooter",
2104
+ "BottomSheetFooterContainer",
2105
+ "BottomSheetHandle",
2106
+ "TouchableOpacity",
2107
+ "TouchableHighlight",
2108
+ "TouchableWithoutFeedback",
2109
+ "useBottomSheet",
2110
+ "useBottomSheetModal",
2111
+ "useBottomSheetInternal",
2112
+ "useBottomSheetModalInternal",
2113
+ "useBottomSheetSpringConfigs",
2114
+ "useBottomSheetTimingConfigs",
2115
+ "useBottomSheetDynamicSnapPoints",
2116
+ "createBottomSheetScrollableComponent",
2117
+ "enableLogging",
2118
+ "SNAP_POINT_TYPE",
2119
+ "SHEET_STATE",
2120
+ "SCROLLABLE_TYPE",
2121
+ "SCROLLABLE_STATUS",
2122
+ "ANIMATION_STATUS",
2123
+ "ANIMATION_SOURCE",
2124
+ "ANIMATION_METHOD",
2125
+ "KEYBOARD_STATUS",
2126
+ "GESTURE_SOURCE"
2127
+ ],
2128
+ factory: () => {
2129
+ function container(name, methods = {}) {
2130
+ const Component = react.default.forwardRef((props, ref) => {
2131
+ react.default.useImperativeHandle(ref, () => methods);
2132
+ return react.default.createElement(name, props, props.children);
2133
+ });
2134
+ Component.displayName = name;
2135
+ return Component;
2136
+ }
2137
+ const sheetMethods = {
2138
+ expand: () => {},
2139
+ collapse: () => {},
2140
+ close: () => {},
2141
+ forceClose: () => {},
2142
+ snapToIndex: () => {},
2143
+ snapToPosition: () => {}
2144
+ };
2145
+ const modalMethods = {
2146
+ ...sheetMethods,
2147
+ present: () => {},
2148
+ dismiss: () => {}
2149
+ };
2150
+ return {
2151
+ __esModule: true,
2152
+ default: container("BottomSheet", sheetMethods),
2153
+ BottomSheetModal: container("BottomSheetModal", modalMethods),
2154
+ BottomSheetModalProvider: container("BottomSheetModalProvider"),
2155
+ BottomSheetView: container("BottomSheetView"),
2156
+ BottomSheetDraggableView: container("BottomSheetDraggableView"),
2157
+ BottomSheetBackdrop: container("BottomSheetBackdrop"),
2158
+ BottomSheetFooter: container("BottomSheetFooter"),
2159
+ BottomSheetFooterContainer: container("BottomSheetFooterContainer"),
2160
+ BottomSheetHandle: container("BottomSheetHandle"),
2161
+ BottomSheetScrollView: createScrollViewMock(),
2162
+ BottomSheetFlatList: createFlatListMock(),
2163
+ BottomSheetSectionList: createSectionListMock(),
2164
+ BottomSheetVirtualizedList: createVirtualizedListMock(),
2165
+ BottomSheetFlashList: createFlatListMock(),
2166
+ BottomSheetTextInput: createTextInputMock(),
2167
+ TouchableOpacity: createTouchableOpacityMock(),
2168
+ TouchableHighlight: createTouchableHighlightMock(),
2169
+ TouchableWithoutFeedback: createTouchableWithoutFeedbackMock(),
2170
+ useBottomSheet: () => ({
2171
+ ...sheetMethods,
2172
+ animatedIndex: { value: 0 },
2173
+ animatedPosition: { value: 0 }
2174
+ }),
2175
+ useBottomSheetModal: () => ({
2176
+ dismiss: vitest.vi.fn(),
2177
+ dismissAll: vitest.vi.fn()
2178
+ }),
2179
+ useBottomSheetInternal: () => ({}),
2180
+ useBottomSheetModalInternal: () => ({}),
2181
+ useBottomSheetSpringConfigs: (config) => config,
2182
+ useBottomSheetTimingConfigs: (config) => config,
2183
+ useBottomSheetDynamicSnapPoints: () => ({
2184
+ animatedHandleHeight: { value: 0 },
2185
+ animatedSnapPoints: { value: [] },
2186
+ animatedContentHeight: { value: 0 },
2187
+ handleContentLayout: vitest.vi.fn()
2188
+ }),
2189
+ createBottomSheetScrollableComponent: vitest.vi.fn(() => createScrollViewMock()),
2190
+ enableLogging: vitest.vi.fn(),
2191
+ SNAP_POINT_TYPE: {
2192
+ PROVIDED: 0,
2193
+ DYNAMIC: 1
2194
+ },
2195
+ SHEET_STATE: {
2196
+ CLOSED: 0,
2197
+ OPENED: 1,
2198
+ EXTENDED: 2,
2199
+ OVER_EXTENDED: 3,
2200
+ FILL_PARENT: 4
2201
+ },
2202
+ SCROLLABLE_TYPE: {
2203
+ UNDETERMINED: 0,
2204
+ VIEW: 1,
2205
+ FLATLIST: 2,
2206
+ SCROLLVIEW: 3,
2207
+ SECTIONLIST: 4,
2208
+ VIRTUALIZEDLIST: 5
2209
+ },
2210
+ SCROLLABLE_STATUS: {
2211
+ LOCKED: 0,
2212
+ UNLOCKED: 1,
2213
+ UNDETERMINED: 2
2214
+ },
2215
+ ANIMATION_STATUS: {
2216
+ UNDETERMINED: 0,
2217
+ RUNNING: 1,
2218
+ STOPPED: 2,
2219
+ INTERRUPTED: 3
2220
+ },
2221
+ ANIMATION_SOURCE: {
2222
+ NONE: 0,
2223
+ MOUNT: 1,
2224
+ GESTURE: 2,
2225
+ USER: 3,
2226
+ CONTAINER_RESIZE: 4,
2227
+ SNAP_POINT_CHANGE: 5,
2228
+ KEYBOARD: 6
2229
+ },
2230
+ ANIMATION_METHOD: {
2231
+ TIMING: 0,
2232
+ SPRING: 1
2233
+ },
2234
+ KEYBOARD_STATUS: {
2235
+ UNDETERMINED: 0,
2236
+ SHOWN: 1,
2237
+ HIDDEN: 2
2238
+ },
2239
+ GESTURE_SOURCE: {
2240
+ UNDETERMINED: 0,
2241
+ SCROLLABLE: 1,
2242
+ HANDLE: 2,
2243
+ CONTENT: 3
2244
+ }
2245
+ };
2246
+ }
2247
+ } }
2248
+ };
2249
+ }
2250
+ //#endregion
2251
+ //#region src/mocks/components/View.ts
2252
+ function createViewMock() {
2253
+ const View = react.default.forwardRef((props, ref) => {
2254
+ return react.default.createElement("View", {
2255
+ ...props,
2256
+ ref
2257
+ });
2258
+ });
2259
+ View.displayName = "View";
2260
+ return View;
2261
+ }
2262
+ //#endregion
2263
+ //#region src/presets/keyboard-controller.ts
2264
+ function keyboardController() {
2265
+ return {
2266
+ name: "keyboardController",
2267
+ modules: { "react-native-keyboard-controller": {
2268
+ exports: [
2269
+ "KeyboardProvider",
2270
+ "KeyboardControllerView",
2271
+ "KeyboardGestureArea",
2272
+ "OverKeyboardView",
2273
+ "KeyboardBackgroundView",
2274
+ "KeyboardExtender",
2275
+ "KeyboardStickyView",
2276
+ "KeyboardAvoidingView",
2277
+ "KeyboardAwareScrollView",
2278
+ "KeyboardChatScrollView",
2279
+ "KeyboardToolbar",
2280
+ "KeyboardController",
2281
+ "KeyboardEvents",
2282
+ "AndroidSoftInputModes",
2283
+ "DefaultKeyboardToolbarTheme",
2284
+ "useKeyboardAnimation",
2285
+ "useReanimatedKeyboardAnimation",
2286
+ "useResizeMode",
2287
+ "useGenericKeyboardHandler",
2288
+ "useKeyboardHandler",
2289
+ "useKeyboardContext",
2290
+ "useKeyboardState",
2291
+ "useReanimatedFocusedInput",
2292
+ "useFocusedInputHandler",
2293
+ "useKeyboardController",
2294
+ "useWindowDimensions"
2295
+ ],
2296
+ factory: () => {
2297
+ function hostComponent(name) {
2298
+ const Component = react.default.forwardRef((props, ref) => react.default.createElement(name, {
2299
+ ...props,
2300
+ ref
2301
+ }, props.children));
2302
+ Component.displayName = name;
2303
+ return Component;
2304
+ }
2305
+ const sharedValue = (value) => ({
2306
+ value,
2307
+ get: () => value,
2308
+ set: () => {}
2309
+ });
2310
+ const animationValues = {
2311
+ animated: {
2312
+ progress: sharedValue(0),
2313
+ height: sharedValue(0)
2314
+ },
2315
+ reanimated: {
2316
+ progress: sharedValue(0),
2317
+ height: sharedValue(0)
2318
+ }
2319
+ };
2320
+ const lastKeyboardEvent = {
2321
+ height: 0,
2322
+ duration: 0,
2323
+ timestamp: 0,
2324
+ target: 0,
2325
+ type: "default",
2326
+ appearance: "default"
2327
+ };
2328
+ const keyboardState = {
2329
+ ...lastKeyboardEvent,
2330
+ isVisible: false
2331
+ };
2332
+ const focusedInput = { input: sharedValue({
2333
+ target: 1,
2334
+ parentScrollViewTarget: -1,
2335
+ layout: {
2336
+ x: 0,
2337
+ y: 0,
2338
+ width: 200,
2339
+ height: 40,
2340
+ absoluteX: 0,
2341
+ absoluteY: 100
2342
+ }
2343
+ }) };
2344
+ const KeyboardToolbar = Object.assign(createViewMock(), {
2345
+ Background: hostComponent("KeyboardToolbar.Background"),
2346
+ Content: hostComponent("KeyboardToolbar.Content"),
2347
+ Prev: hostComponent("KeyboardToolbar.Prev"),
2348
+ Next: hostComponent("KeyboardToolbar.Next"),
2349
+ Done: hostComponent("KeyboardToolbar.Done"),
2350
+ Group: hostComponent("KeyboardToolbar.Group")
2351
+ });
2352
+ return {
2353
+ KeyboardProvider: hostComponent("KeyboardProvider"),
2354
+ KeyboardControllerView: hostComponent("KeyboardControllerView"),
2355
+ KeyboardGestureArea: hostComponent("KeyboardGestureArea"),
2356
+ OverKeyboardView: hostComponent("OverKeyboardView"),
2357
+ KeyboardBackgroundView: hostComponent("KeyboardBackgroundView"),
2358
+ KeyboardExtender: hostComponent("KeyboardExtender"),
2359
+ KeyboardStickyView: createViewMock(),
2360
+ KeyboardAvoidingView: createViewMock(),
2361
+ KeyboardAwareScrollView: createScrollViewMock(),
2362
+ KeyboardChatScrollView: createScrollViewMock(),
2363
+ KeyboardToolbar,
2364
+ KeyboardController: {
2365
+ setInputMode: vitest.vi.fn(),
2366
+ setDefaultMode: vitest.vi.fn(),
2367
+ preload: vitest.vi.fn(),
2368
+ dismiss: vitest.vi.fn(() => Promise.resolve()),
2369
+ setFocusTo: vitest.vi.fn(),
2370
+ isVisible: vitest.vi.fn(() => false),
2371
+ state: vitest.vi.fn(() => lastKeyboardEvent),
2372
+ viewPositionInWindow: vitest.vi.fn(() => Promise.resolve({
2373
+ x: 0,
2374
+ y: 0,
2375
+ width: 0,
2376
+ height: 0
2377
+ }))
2378
+ },
2379
+ KeyboardEvents: { addListener: vitest.vi.fn(() => ({ remove: vitest.vi.fn() })) },
2380
+ AndroidSoftInputModes: {
2381
+ SOFT_INPUT_ADJUST_NOTHING: 48,
2382
+ SOFT_INPUT_ADJUST_PAN: 32,
2383
+ SOFT_INPUT_ADJUST_RESIZE: 16,
2384
+ SOFT_INPUT_ADJUST_UNSPECIFIED: 0,
2385
+ SOFT_INPUT_IS_FORWARD_NAVIGATION: 256,
2386
+ SOFT_INPUT_MASK_ADJUST: 240,
2387
+ SOFT_INPUT_MASK_STATE: 15,
2388
+ SOFT_INPUT_MODE_CHANGED: 512,
2389
+ SOFT_INPUT_STATE_ALWAYS_HIDDEN: 3,
2390
+ SOFT_INPUT_STATE_ALWAYS_VISIBLE: 5,
2391
+ SOFT_INPUT_STATE_HIDDEN: 2,
2392
+ SOFT_INPUT_STATE_UNCHANGED: 1,
2393
+ SOFT_INPUT_STATE_UNSPECIFIED: 0,
2394
+ SOFT_INPUT_STATE_VISIBLE: 4
2395
+ },
2396
+ DefaultKeyboardToolbarTheme: {
2397
+ light: {
2398
+ primary: "#2c2c2c",
2399
+ disabled: "#B0BEC5",
2400
+ background: "#f3f3f4",
2401
+ ripple: "#bcbcbcbc"
2402
+ },
2403
+ dark: {
2404
+ primary: "#fafafa",
2405
+ disabled: "#707070",
2406
+ background: "#2C2C2E",
2407
+ ripple: "#F8F8F888"
2408
+ }
2409
+ },
2410
+ useKeyboardAnimation: () => animationValues.animated,
2411
+ useReanimatedKeyboardAnimation: () => animationValues.reanimated,
2412
+ useResizeMode: () => {},
2413
+ useGenericKeyboardHandler: () => {},
2414
+ useKeyboardHandler: () => {},
2415
+ useKeyboardContext: () => animationValues,
2416
+ useKeyboardState: (selector) => selector ? selector(keyboardState) : keyboardState,
2417
+ useReanimatedFocusedInput: () => focusedInput,
2418
+ useFocusedInputHandler: () => {},
2419
+ useKeyboardController: () => ({
2420
+ enabled: true,
2421
+ setEnabled: vitest.vi.fn()
2422
+ }),
2423
+ useWindowDimensions: () => ({
2424
+ width: 390,
2425
+ height: 844,
2426
+ scale: 3,
2427
+ fontScale: 1
2428
+ })
2429
+ };
2430
+ }
2431
+ } }
2432
+ };
2433
+ }
2434
+ //#endregion
1803
2435
  //#region src/presets/index.ts
1804
2436
  var presets_exports = /* @__PURE__ */ require_chunk.__exportAll({
1805
2437
  asyncStorage: () => asyncStorage,
2438
+ bottomSheet: () => bottomSheet,
1806
2439
  deviceInfo: () => deviceInfo,
1807
2440
  expo: () => expo,
2441
+ flashList: () => flashList,
1808
2442
  gestureHandler: () => gestureHandler,
2443
+ keyboardController: () => keyboardController,
1809
2444
  mmkv: () => mmkv,
1810
2445
  navigation: () => navigation,
1811
2446
  reanimated: () => reanimated,
@@ -1822,18 +2457,78 @@ Object.defineProperty(exports, "asyncStorage", {
1822
2457
  return asyncStorage;
1823
2458
  }
1824
2459
  });
2460
+ Object.defineProperty(exports, "bottomSheet", {
2461
+ enumerable: true,
2462
+ get: function() {
2463
+ return bottomSheet;
2464
+ }
2465
+ });
1825
2466
  Object.defineProperty(exports, "buildPressableHostProps", {
1826
2467
  enumerable: true,
1827
2468
  get: function() {
1828
2469
  return buildPressableHostProps;
1829
2470
  }
1830
2471
  });
2472
+ Object.defineProperty(exports, "createFlatListMock", {
2473
+ enumerable: true,
2474
+ get: function() {
2475
+ return createFlatListMock;
2476
+ }
2477
+ });
1831
2478
  Object.defineProperty(exports, "createPressableMock", {
1832
2479
  enumerable: true,
1833
2480
  get: function() {
1834
2481
  return createPressableMock;
1835
2482
  }
1836
2483
  });
2484
+ Object.defineProperty(exports, "createScrollViewMock", {
2485
+ enumerable: true,
2486
+ get: function() {
2487
+ return createScrollViewMock;
2488
+ }
2489
+ });
2490
+ Object.defineProperty(exports, "createSectionListMock", {
2491
+ enumerable: true,
2492
+ get: function() {
2493
+ return createSectionListMock;
2494
+ }
2495
+ });
2496
+ Object.defineProperty(exports, "createTextInputMock", {
2497
+ enumerable: true,
2498
+ get: function() {
2499
+ return createTextInputMock;
2500
+ }
2501
+ });
2502
+ Object.defineProperty(exports, "createTouchableHighlightMock", {
2503
+ enumerable: true,
2504
+ get: function() {
2505
+ return createTouchableHighlightMock;
2506
+ }
2507
+ });
2508
+ Object.defineProperty(exports, "createTouchableOpacityMock", {
2509
+ enumerable: true,
2510
+ get: function() {
2511
+ return createTouchableOpacityMock;
2512
+ }
2513
+ });
2514
+ Object.defineProperty(exports, "createTouchableWithoutFeedbackMock", {
2515
+ enumerable: true,
2516
+ get: function() {
2517
+ return createTouchableWithoutFeedbackMock;
2518
+ }
2519
+ });
2520
+ Object.defineProperty(exports, "createViewMock", {
2521
+ enumerable: true,
2522
+ get: function() {
2523
+ return createViewMock;
2524
+ }
2525
+ });
2526
+ Object.defineProperty(exports, "createVirtualizedListMock", {
2527
+ enumerable: true,
2528
+ get: function() {
2529
+ return createVirtualizedListMock;
2530
+ }
2531
+ });
1837
2532
  Object.defineProperty(exports, "deviceInfo", {
1838
2533
  enumerable: true,
1839
2534
  get: function() {
@@ -1846,12 +2541,24 @@ Object.defineProperty(exports, "expo", {
1846
2541
  return expo;
1847
2542
  }
1848
2543
  });
2544
+ Object.defineProperty(exports, "flashList", {
2545
+ enumerable: true,
2546
+ get: function() {
2547
+ return flashList;
2548
+ }
2549
+ });
1849
2550
  Object.defineProperty(exports, "gestureHandler", {
1850
2551
  enumerable: true,
1851
2552
  get: function() {
1852
2553
  return gestureHandler;
1853
2554
  }
1854
2555
  });
2556
+ Object.defineProperty(exports, "keyboardController", {
2557
+ enumerable: true,
2558
+ get: function() {
2559
+ return keyboardController;
2560
+ }
2561
+ });
1855
2562
  Object.defineProperty(exports, "mmkv", {
1856
2563
  enumerable: true,
1857
2564
  get: function() {