@yahoo/uds-create-config 5.47.1 → 5.48.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/dist/native/index.d.ts +25 -0
- package/dist/native/index.js +23 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _$react from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { ColorValue } from "react-native";
|
|
4
|
+
|
|
5
|
+
//#region src/native/index.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Publish a container's final, resolved foreground. An absent color or `inherit` passes through
|
|
8
|
+
* the enclosing foreground. Resolve style arrays and interaction callbacks before calling this;
|
|
9
|
+
* the provider does not select tokens, modes or states, or add a native host element.
|
|
10
|
+
*/
|
|
11
|
+
declare function NativeForegroundProvider({
|
|
12
|
+
color,
|
|
13
|
+
children
|
|
14
|
+
}: {
|
|
15
|
+
color?: ColorValue | null;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}): _$react.FunctionComponentElement<_$react.ProviderProps<ColorValue | undefined>>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve only an explicit `inherit`. Defaults, explicit colors and native opaque colors retain
|
|
20
|
+
* their identity. Without a provider, inheritance becomes undefined (never an invalid native
|
|
21
|
+
* `inherit` value). Call this in a component, not inside a Pressable render callback.
|
|
22
|
+
*/
|
|
23
|
+
declare function useNativeForeground(color: ColorValue | undefined): ColorValue | undefined;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { NativeForegroundProvider, useNativeForeground };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createContext, createElement, useContext } from "react";
|
|
2
|
+
//#region src/native/index.ts
|
|
3
|
+
const ForegroundContext = createContext(void 0);
|
|
4
|
+
/**
|
|
5
|
+
* Publish a container's final, resolved foreground. An absent color or `inherit` passes through
|
|
6
|
+
* the enclosing foreground. Resolve style arrays and interaction callbacks before calling this;
|
|
7
|
+
* the provider does not select tokens, modes or states, or add a native host element.
|
|
8
|
+
*/
|
|
9
|
+
function NativeForegroundProvider({ color, children }) {
|
|
10
|
+
const parent = useContext(ForegroundContext);
|
|
11
|
+
return createElement(ForegroundContext.Provider, { value: color == null || color === "inherit" ? parent : color }, children);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve only an explicit `inherit`. Defaults, explicit colors and native opaque colors retain
|
|
15
|
+
* their identity. Without a provider, inheritance becomes undefined (never an invalid native
|
|
16
|
+
* `inherit` value). Call this in a component, not inside a Pressable render callback.
|
|
17
|
+
*/
|
|
18
|
+
function useNativeForeground(color) {
|
|
19
|
+
const parent = useContext(ForegroundContext);
|
|
20
|
+
return color === "inherit" ? parent : color;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { NativeForegroundProvider, useNativeForeground };
|