@symbiote-native/engine 1.2.0 → 1.3.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.
Files changed (71) hide show
  1. package/android/CMakeLists.txt +31 -1
  2. package/android/build.gradle +4 -1
  3. package/build/accessibility-info/index.android.js +21 -17
  4. package/build/accessibility-info/index.ios.js +2 -0
  5. package/build/accessibility-info/shared.d.ts +1 -1
  6. package/build/alert/shared.d.ts +1 -1
  7. package/build/alert/shared.js +3 -7
  8. package/build/app-state/index.d.ts +1 -1
  9. package/build/app-state/index.js +35 -27
  10. package/build/back-handler/index.d.ts +7 -2
  11. package/build/back-handler/index.js +19 -10
  12. package/build/events/index.js +10 -1
  13. package/build/fabric-props.js +1 -1
  14. package/build/fabric.d.ts +7 -0
  15. package/build/fabric.js +14 -0
  16. package/build/host-behavior.d.ts +1 -0
  17. package/build/image-loader.d.ts +4 -2
  18. package/build/image-loader.js +14 -25
  19. package/build/image-source-write.d.ts +1 -1
  20. package/build/image-source-write.js +14 -2
  21. package/build/index.d.ts +2 -2
  22. package/build/index.js +6 -6
  23. package/build/invariant.d.ts +1 -0
  24. package/build/invariant.js +10 -0
  25. package/build/keyboard/index.js +11 -32
  26. package/build/linking/index.android.js +5 -3
  27. package/build/linking/shared.d.ts +1 -1
  28. package/build/linking/shared.js +16 -19
  29. package/build/native-events.d.ts +5 -0
  30. package/build/native-events.js +21 -0
  31. package/build/node.js +18 -2
  32. package/build/permissions-android/index.android.d.ts +59 -0
  33. package/build/permissions-android/index.android.js +47 -0
  34. package/build/permissions-android/index.d.ts +1 -115
  35. package/build/permissions-android/index.ios.d.ts +59 -0
  36. package/build/permissions-android/index.ios.js +31 -0
  37. package/build/permissions-android/index.js +3 -184
  38. package/build/permissions-android/shared.d.ts +63 -0
  39. package/build/permissions-android/shared.js +66 -0
  40. package/build/platform/index.android.js +3 -5
  41. package/build/platform/index.ios.js +3 -3
  42. package/build/platform/shared.d.ts +4 -0
  43. package/build/platform/shared.js +9 -0
  44. package/build/platform-color/index.android.d.ts +4 -0
  45. package/build/platform-color/index.android.js +7 -0
  46. package/build/platform-color/index.d.ts +2 -20
  47. package/build/platform-color/index.js +1 -45
  48. package/build/platform-color/shared.d.ts +21 -0
  49. package/build/platform-color/shared.js +41 -0
  50. package/build/settings/index.android.d.ts +6 -0
  51. package/build/settings/index.android.js +21 -0
  52. package/build/settings/index.d.ts +1 -8
  53. package/build/settings/index.ios.d.ts +8 -0
  54. package/build/settings/index.ios.js +122 -0
  55. package/build/settings/index.js +3 -122
  56. package/build/share/index.android.js +9 -32
  57. package/build/share/index.ios.js +14 -15
  58. package/build/share/shared.d.ts +4 -2
  59. package/build/share/shared.js +7 -10
  60. package/build/status-bar/index.android.js +1 -1
  61. package/build/status-bar/index.ios.js +4 -3
  62. package/build/toast-android/index.android.d.ts +10 -0
  63. package/build/toast-android/index.android.js +108 -0
  64. package/build/toast-android/index.d.ts +1 -10
  65. package/build/toast-android/index.ios.d.ts +10 -0
  66. package/build/toast-android/index.ios.js +19 -0
  67. package/build/toast-android/index.js +3 -108
  68. package/cpp/SymbioteFabricProps.cpp +204 -120
  69. package/cpp/SymbioteFabricProps.h +5 -0
  70. package/cpp/SymbioteTree.cpp +20 -6
  71. package/package.json +2 -2
@@ -1,108 +1,3 @@
1
- // ToastAndroid module: pops a brief Android system toast from JS. Mirrors RN's
2
- // Libraries/Components/ToastAndroid/ToastAndroid.android.js: `show` takes a message
3
- // and a duration; `showWithGravity` adds a layout gravity; `showWithGravityAndOffset`
4
- // adds an x/y pixel offset. No Fabric view, pure JS->native.
5
- //
6
- // symbiote is iOS-first and this is an Android-only module. RN's iOS fallback
7
- // (ToastAndroid.ios.js) throws "not supported"; we prefer a no-op + dlog so a
8
- // cross-platform smoke never crashes when the native module is absent.
9
- //
10
- // The native contract is confirmed from RN's TurboModule spec at
11
- // specs_DEPRECATED/modules/INativeToastAndroid.js:
12
- // getConstants(): { SHORT, LONG, TOP, BOTTOM, CENTER }
13
- // show(message: string, duration: number)
14
- // showWithGravity(message: string, duration: number, gravity: number)
15
- // showWithGravityAndOffset(message, duration, gravity, xOffset, yOffset)
16
- import { dlog } from '../debug.js';
17
- import { getNativeModule } from '../native-modules/index.js';
18
- // The native module name RN registers this under. NOTE: this is the name the spec
19
- // resolves via `TurboModuleRegistry.getEnforcing<Spec>('ToastAndroid')`, NOT the
20
- // spec filename `INativeToastAndroid`. A module name is only provable on a real
21
- // host (a headless fake answers to any name); this Android name is confirmed from
22
- // RN source but not yet exercised on a device.
23
- const TOAST_MODULE = 'ToastAndroid';
24
- // Conventional RN values for SHORT/LONG/TOP/BOTTOM/CENTER. On a real device the
25
- // numbers come from native getConstants() (resolved below); these are the fallbacks
26
- // that keep the constants object populated headless and on a host without the module.
27
- const FALLBACK_CONSTANTS = {
28
- SHORT: 0,
29
- LONG: 1,
30
- TOP: 48,
31
- BOTTOM: 80,
32
- CENTER: 17,
33
- };
34
- // Lazily resolved so importing this module has no native side effect.
35
- let toastModule;
36
- function getModule() {
37
- if (toastModule === undefined) {
38
- toastModule = getNativeModule(TOAST_MODULE);
39
- dlog(`ToastAndroid: ToastAndroid module ${toastModule ? 'resolved' : 'NOT resolved (null)'}`);
40
- }
41
- return toastModule;
42
- }
43
- // Read a single numeric constant from the native getConstants() payload, narrowing
44
- // with a `typeof` guard (no cast) and falling back to the conventional RN value when
45
- // the module or the key is absent.
46
- function readConstant(raw, key) {
47
- const value = raw[key];
48
- return typeof value === 'number' ? value : FALLBACK_CONSTANTS[key];
49
- }
50
- // Resolve the constants once: real numbers from native on a device, fallbacks
51
- // otherwise. Always returns a fully-populated object so the constants are never
52
- // undefined, even headless.
53
- function resolveConstants() {
54
- const module = getModule();
55
- if (module === null) {
56
- dlog('ToastAndroid: constants from fallbacks (native module unavailable)');
57
- return { ...FALLBACK_CONSTANTS };
58
- }
59
- const raw = module.getConstants();
60
- return {
61
- SHORT: readConstant(raw, 'SHORT'),
62
- LONG: readConstant(raw, 'LONG'),
63
- TOP: readConstant(raw, 'TOP'),
64
- BOTTOM: readConstant(raw, 'BOTTOM'),
65
- CENTER: readConstant(raw, 'CENTER'),
66
- };
67
- }
68
- const constants = resolveConstants();
69
- export const ToastAndroid = {
70
- // Toast duration constants.
71
- SHORT: constants.SHORT,
72
- LONG: constants.LONG,
73
- // Toast gravity constants.
74
- TOP: constants.TOP,
75
- BOTTOM: constants.BOTTOM,
76
- CENTER: constants.CENTER,
77
- // Show a toast with the given message and duration. Degrades to a no-op (logged)
78
- // when the module is absent; a missing optional native module must never throw.
79
- show(message, duration) {
80
- const module = getModule();
81
- if (module === null) {
82
- dlog('ToastAndroid.show -> ToastAndroid native module unavailable, no-op');
83
- return;
84
- }
85
- dlog(`ToastAndroid.show -> "${message}" (${duration})`);
86
- module.show(message, duration);
87
- },
88
- // Show a toast at the given layout gravity (TOP / BOTTOM / CENTER).
89
- showWithGravity(message, duration, gravity) {
90
- const module = getModule();
91
- if (module === null) {
92
- dlog('ToastAndroid.showWithGravity -> ToastAndroid native module unavailable, no-op');
93
- return;
94
- }
95
- dlog(`ToastAndroid.showWithGravity -> "${message}" (${duration}, gravity=${gravity})`);
96
- module.showWithGravity(message, duration, gravity);
97
- },
98
- // Show a toast at the given gravity, offset by xOffset/yOffset pixels.
99
- showWithGravityAndOffset(message, duration, gravity, xOffset, yOffset) {
100
- const module = getModule();
101
- if (module === null) {
102
- dlog('ToastAndroid.showWithGravityAndOffset -> ToastAndroid native module unavailable, no-op');
103
- return;
104
- }
105
- dlog(`ToastAndroid.showWithGravityAndOffset -> "${message}" (${duration}, gravity=${gravity}, ${xOffset}, ${yOffset})`);
106
- module.showWithGravityAndOffset(message, duration, gravity, xOffset, yOffset);
107
- },
108
- };
1
+ // ToastAndroid: base / headless build. Metro picks index.android.ts / index.ios.ts on a device; off
2
+ // those, RN's non-Android fallback is the default, as RN's own ToastAndroid.js is.
3
+ export * from './index.ios.js';