@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.
- package/android/CMakeLists.txt +31 -1
- package/android/build.gradle +4 -1
- package/build/accessibility-info/index.android.js +21 -17
- package/build/accessibility-info/index.ios.js +2 -0
- package/build/accessibility-info/shared.d.ts +1 -1
- package/build/alert/shared.d.ts +1 -1
- package/build/alert/shared.js +3 -7
- package/build/app-state/index.d.ts +1 -1
- package/build/app-state/index.js +35 -27
- package/build/back-handler/index.d.ts +7 -2
- package/build/back-handler/index.js +19 -10
- package/build/events/index.js +10 -1
- package/build/fabric-props.js +1 -1
- package/build/fabric.d.ts +7 -0
- package/build/fabric.js +14 -0
- package/build/host-behavior.d.ts +1 -0
- package/build/image-loader.d.ts +4 -2
- package/build/image-loader.js +14 -25
- package/build/image-source-write.d.ts +1 -1
- package/build/image-source-write.js +14 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +6 -6
- package/build/invariant.d.ts +1 -0
- package/build/invariant.js +10 -0
- package/build/keyboard/index.js +11 -32
- package/build/linking/index.android.js +5 -3
- package/build/linking/shared.d.ts +1 -1
- package/build/linking/shared.js +16 -19
- package/build/native-events.d.ts +5 -0
- package/build/native-events.js +21 -0
- package/build/node.js +18 -2
- package/build/permissions-android/index.android.d.ts +59 -0
- package/build/permissions-android/index.android.js +47 -0
- package/build/permissions-android/index.d.ts +1 -115
- package/build/permissions-android/index.ios.d.ts +59 -0
- package/build/permissions-android/index.ios.js +31 -0
- package/build/permissions-android/index.js +3 -184
- package/build/permissions-android/shared.d.ts +63 -0
- package/build/permissions-android/shared.js +66 -0
- package/build/platform/index.android.js +3 -5
- package/build/platform/index.ios.js +3 -3
- package/build/platform/shared.d.ts +4 -0
- package/build/platform/shared.js +9 -0
- package/build/platform-color/index.android.d.ts +4 -0
- package/build/platform-color/index.android.js +7 -0
- package/build/platform-color/index.d.ts +2 -20
- package/build/platform-color/index.js +1 -45
- package/build/platform-color/shared.d.ts +21 -0
- package/build/platform-color/shared.js +41 -0
- package/build/settings/index.android.d.ts +6 -0
- package/build/settings/index.android.js +21 -0
- package/build/settings/index.d.ts +1 -8
- package/build/settings/index.ios.d.ts +8 -0
- package/build/settings/index.ios.js +122 -0
- package/build/settings/index.js +3 -122
- package/build/share/index.android.js +9 -32
- package/build/share/index.ios.js +14 -15
- package/build/share/shared.d.ts +4 -2
- package/build/share/shared.js +7 -10
- package/build/status-bar/index.android.js +1 -1
- package/build/status-bar/index.ios.js +4 -3
- package/build/toast-android/index.android.d.ts +10 -0
- package/build/toast-android/index.android.js +108 -0
- package/build/toast-android/index.d.ts +1 -10
- package/build/toast-android/index.ios.d.ts +10 -0
- package/build/toast-android/index.ios.js +19 -0
- package/build/toast-android/index.js +3 -108
- package/cpp/SymbioteFabricProps.cpp +204 -120
- package/cpp/SymbioteFabricProps.h +5 -0
- package/cpp/SymbioteTree.cpp +20 -6
- package/package.json +2 -2
|
@@ -1,108 +1,3 @@
|
|
|
1
|
-
// ToastAndroid
|
|
2
|
-
//
|
|
3
|
-
|
|
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';
|