@symbiote-native/navigation-bar 0.1.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/LICENSE +21 -0
- package/README.md +157 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +3 -0
- package/build/angular/navigation-bar-visibility.service.d.ts +5 -0
- package/build/angular/navigation-bar-visibility.service.js +73 -0
- package/build/angular/navigation-bar.d.ts +13 -0
- package/build/angular/navigation-bar.js +107 -0
- package/build/core/entries-stack.d.ts +8 -0
- package/build/core/entries-stack.js +54 -0
- package/build/core/index.d.ts +3 -0
- package/build/core/index.js +2 -0
- package/build/core/native-module/index.android.d.ts +2 -0
- package/build/core/native-module/index.android.js +2 -0
- package/build/core/native-module/index.d.ts +2 -0
- package/build/core/native-module/index.js +3 -0
- package/build/core/native-module/shared.d.ts +8 -0
- package/build/core/native-module/shared.js +1 -0
- package/build/core/navigation-bar.d.ts +16 -0
- package/build/core/navigation-bar.js +69 -0
- package/build/core/types.d.ts +14 -0
- package/build/core/types.js +2 -0
- package/build/react/index.d.ts +3 -0
- package/build/react/index.js +3 -0
- package/build/react/navigation-bar.d.ts +3 -0
- package/build/react/navigation-bar.js +23 -0
- package/build/react/use-visibility.d.ts +3 -0
- package/build/react/use-visibility.js +22 -0
- package/build/solid/create-visibility.d.ts +4 -0
- package/build/solid/create-visibility.js +26 -0
- package/build/solid/index.d.ts +3 -0
- package/build/solid/index.js +3 -0
- package/build/solid/navigation-bar.d.ts +2 -0
- package/build/solid/navigation-bar.js +24 -0
- package/build/svelte/NavigationBar.svelte +28 -0
- package/build/svelte/NavigationBar.svelte.d.ts +4 -0
- package/build/svelte/index.d.ts +3 -0
- package/build/svelte/index.js +3 -0
- package/build/svelte/use-visibility.svelte.d.ts +4 -0
- package/build/svelte/use-visibility.svelte.js +26 -0
- package/build/vue/index.d.ts +3 -0
- package/build/vue/index.js +3 -0
- package/build/vue/navigation-bar.d.ts +2 -0
- package/build/vue/navigation-bar.js +23 -0
- package/build/vue/use-visibility.d.ts +4 -0
- package/build/vue/use-visibility.js +24 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +4 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/navigation-bar-visibility.service.d.ts +8 -0
- package/build-ngc/angular/navigation-bar-visibility.service.js +32 -0
- package/build-ngc/angular/navigation-bar-visibility.service.js.map +1 -0
- package/build-ngc/angular/navigation-bar.d.ts +16 -0
- package/build-ngc/angular/navigation-bar.js +59 -0
- package/build-ngc/angular/navigation-bar.js.map +1 -0
- package/build-ngc/core/entries-stack.d.ts +8 -0
- package/build-ngc/core/entries-stack.js +55 -0
- package/build-ngc/core/entries-stack.js.map +1 -0
- package/build-ngc/core/index.d.ts +3 -0
- package/build-ngc/core/index.js +3 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module/index.android.d.ts +2 -0
- package/build-ngc/core/native-module/index.android.js +3 -0
- package/build-ngc/core/native-module/index.android.js.map +1 -0
- package/build-ngc/core/native-module/index.d.ts +2 -0
- package/build-ngc/core/native-module/index.js +4 -0
- package/build-ngc/core/native-module/index.js.map +1 -0
- package/build-ngc/core/native-module/shared.d.ts +8 -0
- package/build-ngc/core/native-module/shared.js +2 -0
- package/build-ngc/core/native-module/shared.js.map +1 -0
- package/build-ngc/core/navigation-bar.d.ts +16 -0
- package/build-ngc/core/navigation-bar.js +70 -0
- package/build-ngc/core/navigation-bar.js.map +1 -0
- package/build-ngc/core/types.d.ts +14 -0
- package/build-ngc/core/types.js +3 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +150 -0
- package/src/angular/index.ts +3 -0
- package/src/angular/navigation-bar-visibility.service.ts +29 -0
- package/src/angular/navigation-bar.ts +67 -0
- package/src/core/entries-stack.ts +76 -0
- package/src/core/index.ts +19 -0
- package/src/core/native-module/index.android.ts +5 -0
- package/src/core/native-module/index.ts +5 -0
- package/src/core/native-module/shared.ts +15 -0
- package/src/core/navigation-bar.ts +90 -0
- package/src/core/types.ts +19 -0
- package/src/react/index.ts +3 -0
- package/src/react/navigation-bar.tsx +38 -0
- package/src/react/use-visibility.ts +29 -0
- package/src/solid/create-visibility.ts +32 -0
- package/src/solid/index.ts +3 -0
- package/src/solid/navigation-bar.ts +35 -0
- package/src/svelte/NavigationBar.svelte +28 -0
- package/src/svelte/index.ts +3 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +7 -0
- package/src/svelte/use-visibility.svelte.ts +37 -0
- package/src/vue/index.ts +3 -0
- package/src/vue/navigation-bar.ts +42 -0
- package/src/vue/use-visibility.ts +28 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import { useColorScheme } from '@symbiote-native/svelte';
|
|
4
|
+
import {
|
|
5
|
+
popStackEntry,
|
|
6
|
+
pushStackEntry,
|
|
7
|
+
replaceStackEntry,
|
|
8
|
+
type INavigationBarProps,
|
|
9
|
+
type INavigationBarStackEntry,
|
|
10
|
+
} from '../core';
|
|
11
|
+
|
|
12
|
+
let { style, hidden }: INavigationBarProps = $props();
|
|
13
|
+
const colorScheme = useColorScheme();
|
|
14
|
+
let stackEntry: INavigationBarStackEntry | null = null;
|
|
15
|
+
|
|
16
|
+
$effect(() => {
|
|
17
|
+
const entry = pushStackEntry(untrack(() => ({ style, hidden })));
|
|
18
|
+
stackEntry = entry;
|
|
19
|
+
return () => popStackEntry(entry);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
$effect(() => {
|
|
23
|
+
void style;
|
|
24
|
+
void hidden;
|
|
25
|
+
void colorScheme.current;
|
|
26
|
+
if (stackEntry) stackEntry = replaceStackEntry(stackEntry, { style, hidden });
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Re-exports the existing harness instead of a third copy (packages/sqlite and
|
|
2
|
+
// packages/navigation already carry one, not part of either package's public exports)
|
|
3
|
+
export {
|
|
4
|
+
createSvelteHarness,
|
|
5
|
+
loadComponent,
|
|
6
|
+
type ISvelteHarness,
|
|
7
|
+
} from '../../../sqlite/src/svelte/svelte-compile.test-helper';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Svelte twin of `../react`/`../vue`'s visibility hook, boxed getter shape matching
|
|
2
|
+
// `use-color-scheme.svelte.ts` (`components_split_logic_view_lifecycle`)
|
|
3
|
+
|
|
4
|
+
import type { EventSubscription } from 'expo-modules-core';
|
|
5
|
+
import { addVisibilityListener, getVisibilityAsync } from '../core';
|
|
6
|
+
import type { INavigationBarVisibility } from '../core';
|
|
7
|
+
|
|
8
|
+
export function useVisibility(): {
|
|
9
|
+
readonly current: INavigationBarVisibility | null;
|
|
10
|
+
} {
|
|
11
|
+
let visibility = $state<INavigationBarVisibility | null>(null);
|
|
12
|
+
|
|
13
|
+
$effect(() => {
|
|
14
|
+
let isMounted = true;
|
|
15
|
+
|
|
16
|
+
getVisibilityAsync().then(value => {
|
|
17
|
+
if (isMounted) visibility = value;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const subscription: EventSubscription = addVisibilityListener(
|
|
21
|
+
({ visibility: next }) => {
|
|
22
|
+
if (isMounted) visibility = next;
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
subscription.remove();
|
|
28
|
+
isMounted = false;
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
get current(): INavigationBarVisibility | null {
|
|
34
|
+
return visibility;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
onMounted,
|
|
4
|
+
onUnmounted,
|
|
5
|
+
watch,
|
|
6
|
+
type VNode,
|
|
7
|
+
} from '@vue/runtime-core';
|
|
8
|
+
import { useColorScheme } from '@symbiote-native/vue';
|
|
9
|
+
import {
|
|
10
|
+
popStackEntry,
|
|
11
|
+
pushStackEntry,
|
|
12
|
+
replaceStackEntry,
|
|
13
|
+
type INavigationBarProps,
|
|
14
|
+
type INavigationBarStackEntry,
|
|
15
|
+
} from '../core';
|
|
16
|
+
|
|
17
|
+
export const NavigationBar = defineComponent<INavigationBarProps>(
|
|
18
|
+
props => {
|
|
19
|
+
const colorScheme = useColorScheme();
|
|
20
|
+
let stackEntry: INavigationBarStackEntry | null = null;
|
|
21
|
+
|
|
22
|
+
onMounted(() => {
|
|
23
|
+
stackEntry = pushStackEntry({ style: props.style, hidden: props.hidden });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
onUnmounted(() => {
|
|
27
|
+
if (stackEntry) popStackEntry(stackEntry);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
watch([colorScheme, () => props.style, () => props.hidden], () => {
|
|
31
|
+
if (stackEntry) {
|
|
32
|
+
stackEntry = replaceStackEntry(stackEntry, {
|
|
33
|
+
style: props.style,
|
|
34
|
+
hidden: props.hidden,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (): VNode | null => null;
|
|
40
|
+
},
|
|
41
|
+
{ name: 'NavigationBar', props: ['style', 'hidden'] },
|
|
42
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, ref, type Ref } from '@vue/runtime-core';
|
|
2
|
+
import type { EventSubscription } from 'expo-modules-core';
|
|
3
|
+
import { addVisibilityListener, getVisibilityAsync } from '../core';
|
|
4
|
+
import type { INavigationBarVisibility } from '../core';
|
|
5
|
+
|
|
6
|
+
/** Statefully tracks the system navigation bar's visibility, `null` during async initialization */
|
|
7
|
+
export function useVisibility(): Ref<INavigationBarVisibility | null> {
|
|
8
|
+
const visibility = ref<INavigationBarVisibility | null>(null);
|
|
9
|
+
let subscription: EventSubscription | undefined;
|
|
10
|
+
let isMounted = false;
|
|
11
|
+
|
|
12
|
+
onMounted(() => {
|
|
13
|
+
isMounted = true;
|
|
14
|
+
getVisibilityAsync().then(value => {
|
|
15
|
+
if (isMounted) visibility.value = value;
|
|
16
|
+
});
|
|
17
|
+
subscription = addVisibilityListener(({ visibility: next }) => {
|
|
18
|
+
if (isMounted) visibility.value = next;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
onUnmounted(() => {
|
|
23
|
+
subscription?.remove();
|
|
24
|
+
isMounted = false;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return visibility;
|
|
28
|
+
}
|