vaderjs-native 1.0.27 → 1.0.28

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.
Files changed (2) hide show
  1. package/index.ts +23 -3
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -994,9 +994,10 @@ export function Match({ when, children }: { when: boolean, children: VNode[] }):
994
994
  return when ? children : null;
995
995
  }
996
996
 
997
- export function Show({ when, children }: { when: boolean, children: VNode[] }): VNode | null {
998
- //@ts-ignore
999
- return when ? children : null;
997
+ export function Show({ when, children }: { when: boolean, children: VNode | VNode[] }): VNode | null {
998
+ if (!when) return null;
999
+
1000
+ return children as VNode
1000
1001
  }
1001
1002
  /**
1002
1003
  * @description Show toast allows you to invoke system level toast api to show data to user
@@ -1673,6 +1674,16 @@ export function useQuery<T>(
1673
1674
  return { data, loading, error, refetch: fetchData };
1674
1675
  }
1675
1676
 
1677
+ export function For<T>({
1678
+ each,
1679
+ children,
1680
+ }: {
1681
+ each: T[];
1682
+ children: (item: T, index: number) => VNode;
1683
+ }): VNode[] {
1684
+ return each.map((item, index) => children(item, index));
1685
+ }
1686
+
1676
1687
  /**
1677
1688
  * A hook for tracking window focus state.
1678
1689
  * @returns {boolean} True if the window is focused.
@@ -1874,8 +1885,15 @@ export function component<P extends object>( renderFn: (props: P) => VNode): (pr
1874
1885
 
1875
1886
  return ComponentWrapper;
1876
1887
  }
1888
+ export function Fragment({ children }: { children: VNode | VNode[] }): VNode | null {
1889
+ // If children is an array, return them as-is
1890
+ // If single child, return it
1891
+ if (Array.isArray(children)) return children;
1892
+ return children;
1893
+ }
1877
1894
  const Vader = {
1878
1895
  render,
1896
+ Fragment,
1879
1897
  createElement,
1880
1898
  useState,
1881
1899
  useEffect,
@@ -1898,6 +1916,7 @@ const Vader = {
1898
1916
  showToast,
1899
1917
  platform,
1900
1918
  component,
1919
+ For,
1901
1920
  App
1902
1921
  };
1903
1922
 
@@ -1906,3 +1925,4 @@ Object.defineProperty(window, "Vader", {
1906
1925
  writable: false,
1907
1926
  configurable: false,
1908
1927
  });
1928
+ export default Vader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaderjs-native",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "binaryVersion":"1.0.25",
5
5
  "description": "Build Native Applications using Vaderjs framework.",
6
6
  "bin": {