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