basalt-core 0.0.0-rc5 → 0.2.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/cli/basalt.d.ts.map +1 -1
- package/dist/cli/basalt.js +18 -1
- package/dist/cli/basalt.js.map +1 -1
- package/dist/cli/bundle-cli.js +0 -0
- package/dist/cli/desktop.d.ts.map +1 -1
- package/dist/cli/desktop.js +53 -4
- package/dist/cli/desktop.js.map +1 -1
- package/dist/cli/packageApp.d.ts.map +1 -1
- package/dist/cli/packageApp.js +7 -1
- package/dist/cli/packageApp.js.map +1 -1
- package/dist/metro-config.d.ts.map +1 -1
- package/dist/metro-config.js +53 -5
- package/dist/metro-config.js.map +1 -1
- package/dist/src/KeyHandler.d.ts +1 -1
- package/dist/src/KeyHandler.d.ts.map +1 -1
- package/dist/src/KeyHandler.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/overrides/Alert.d.ts +1 -1
- package/dist/src/overrides/Alert.js +1 -1
- package/dist/src/overrides/BaseViewConfig.d.ts +10 -3
- package/dist/src/overrides/BaseViewConfig.d.ts.map +1 -1
- package/dist/src/overrides/BaseViewConfig.js +21 -3
- package/dist/src/overrides/BaseViewConfig.js.map +1 -1
- package/dist/src/overrides/Button.d.ts +81 -0
- package/dist/src/overrides/Button.d.ts.map +1 -0
- package/dist/src/overrides/Button.js +109 -0
- package/dist/src/overrides/Button.js.map +1 -0
- package/dist/src/overrides/ScrollView.d.ts +25 -2
- package/dist/src/overrides/ScrollView.d.ts.map +1 -1
- package/dist/src/overrides/ScrollView.js +64 -7
- package/dist/src/overrides/ScrollView.js.map +1 -1
- package/dist/src/overrides/Settings.d.ts +81 -0
- package/dist/src/overrides/Settings.d.ts.map +1 -0
- package/dist/src/overrides/Settings.js +120 -0
- package/dist/src/overrides/Settings.js.map +1 -0
- package/dist/src/overrides/processDecelerationRate.d.ts +20 -0
- package/dist/src/overrides/processDecelerationRate.d.ts.map +1 -0
- package/dist/src/overrides/processDecelerationRate.js +31 -0
- package/dist/src/overrides/processDecelerationRate.js.map +1 -0
- package/dist/src/useContextMenu.d.ts +57 -6
- package/dist/src/useContextMenu.d.ts.map +1 -1
- package/dist/src/useContextMenu.js +34 -1
- package/dist/src/useContextMenu.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/native/CMakeLists.txt +85 -1
- package/native/cmake/Skia.cmake +29 -6
- package/native/core/ActionSheet.cpp +75 -0
- package/native/core/ActionSheet.h +90 -0
- package/native/core/AppStateHost.cpp +76 -0
- package/native/core/AppStateHost.h +68 -0
- package/native/core/BackgroundLayers.h +282 -0
- package/native/core/BlendModes.h +67 -0
- package/native/core/CoreModules.cpp +380 -11
- package/native/core/CoreModules.h +140 -4
- package/native/core/CrashHandler.cpp +246 -0
- package/native/core/CrashHandler.h +65 -0
- package/native/core/CursorNames.h +110 -0
- package/native/core/DevMenu.cpp +6 -5
- package/native/core/DeviceMetrics.cpp +87 -0
- package/native/core/DeviceMetrics.h +80 -0
- package/native/core/Filters.h +336 -0
- package/native/core/FontFitting.h +183 -0
- package/native/core/FontScaling.h +153 -0
- package/native/core/FontVariants.h +148 -0
- package/native/core/Gradients.h +523 -0
- package/native/core/ImageAnimation.h +109 -0
- package/native/core/ImageBytes.cpp +28 -1
- package/native/core/ImageBytes.h +17 -1
- package/native/core/ImageProgress.h +85 -0
- package/native/core/LabelRegistry.h +189 -0
- package/native/core/LegacyShadow.h +90 -0
- package/native/core/LiveRegions.h +114 -0
- package/native/core/MenuModule.cpp +35 -4
- package/native/core/MountingWalk.h +125 -2
- package/native/core/PlatformServices.h +187 -3
- package/native/core/SafeAreaComponent.cpp +115 -0
- package/native/core/SafeAreaComponent.h +105 -0
- package/native/core/ScreensComponent.cpp +201 -0
- package/native/core/ScreensComponent.h +216 -0
- package/native/core/ScrollBounds.cpp +8 -0
- package/native/core/ScrollBounds.h +14 -0
- package/native/core/ScrollIndicator.h +67 -0
- package/native/core/ScrollMomentum.cpp +24 -0
- package/native/core/ScrollMomentum.h +14 -0
- package/native/core/ScrollSnap.cpp +121 -12
- package/native/core/ScrollSnap.h +45 -0
- package/native/core/ScrollVisiblePosition.cpp +68 -0
- package/native/core/ScrollVisiblePosition.h +101 -0
- package/native/core/SettingsStore.cpp +199 -0
- package/native/core/SettingsStore.h +127 -0
- package/native/core/ShadowShape.h +38 -0
- package/native/core/SkiaViewComponent.cpp +11 -0
- package/native/core/SkiaViewComponent.h +50 -0
- package/native/core/SystemLocale.cpp +103 -0
- package/native/core/SystemLocale.h +86 -0
- package/native/core/TestDialog.cpp +45 -6
- package/native/core/TestDialog.h +15 -0
- package/native/core/TextAlignments.h +240 -0
- package/native/core/TextChecking.h +133 -0
- package/native/core/TextColors.h +83 -0
- package/native/core/TextDecorations.h +101 -0
- package/native/core/TextDirection.cpp +242 -0
- package/native/core/TextDirection.h +88 -0
- package/native/core/TextHighlight.h +30 -0
- package/native/core/TextSelection.cpp +97 -0
- package/native/core/TextSelection.h +161 -0
- package/native/core/TextShadows.h +96 -0
- package/native/core/TextVerticalAlign.h +33 -0
- package/native/core/UIManagerAccess.cpp +36 -0
- package/native/core/UIManagerAccess.h +28 -0
- package/native/core/WindowBoundsCache.cpp +58 -1
- package/native/core/WindowControl.h +24 -0
- package/native/core/WritingDirections.h +52 -0
- package/native/core/portability_probe.cpp +7 -0
- package/native/tests/RenamedFontFile.h +161 -0
- package/native/tests/TestHarness.cpp +18 -0
- package/native/tests/test_action_sheet.cpp +157 -0
- package/native/tests/test_app_state.cpp +60 -0
- package/native/tests/test_background_layers.cpp +281 -0
- package/native/tests/test_blend_modes.cpp +79 -0
- package/native/tests/test_blobs.cpp +1 -1
- package/native/tests/test_device_metrics.cpp +126 -0
- package/native/tests/test_filters.cpp +271 -0
- package/native/tests/test_font_fitting.cpp +172 -0
- package/native/tests/test_font_scaling.cpp +127 -0
- package/native/tests/test_font_variants.cpp +84 -0
- package/native/tests/test_gradients.cpp +390 -0
- package/native/tests/test_image_animation.cpp +105 -0
- package/native/tests/test_image_progress.cpp +94 -0
- package/native/tests/test_label_registry.cpp +262 -0
- package/native/tests/test_legacy_shadow.cpp +165 -0
- package/native/tests/test_live_regions.cpp +108 -0
- package/native/tests/test_menu_entries.cpp +192 -0
- package/native/tests/test_momentum.cpp +45 -0
- package/native/tests/test_scroll_bounds.cpp +42 -0
- package/native/tests/test_scroll_indicator.cpp +61 -0
- package/native/tests/test_scroll_snap.cpp +129 -0
- package/native/tests/test_scroll_visible_position.cpp +121 -0
- package/native/tests/test_settings_store.cpp +257 -0
- package/native/tests/test_shadow_shape.cpp +47 -0
- package/native/tests/test_system_locale.cpp +36 -0
- package/native/tests/test_text_alignment.cpp +299 -0
- package/native/tests/test_text_checking.cpp +31 -0
- package/native/tests/test_text_colors.cpp +92 -0
- package/native/tests/test_text_decorations.cpp +100 -0
- package/native/tests/test_text_selection.cpp +168 -0
- package/native/tests/test_text_shadows.cpp +132 -0
- package/package.json +4 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Native's own base view config, plus
|
|
2
|
+
* React Native's own base view config, plus the props it does not declare for
|
|
3
|
+
* this platform.
|
|
3
4
|
*
|
|
4
5
|
* `onPointerDown`, `onPointerUp` and `onPointerCancel` are registered in
|
|
5
6
|
* `bubblingEventTypes` -- `topPointerDown` and friends, with their bubbled and
|
|
@@ -18,8 +19,14 @@
|
|
|
18
19
|
* press. The effect here is that a right-click cannot be answered at all, which
|
|
19
20
|
* is what this platform needed them for; see core/PointerButtons.h.
|
|
20
21
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* `accessibilityViewIsModal` is the second kind of gap and the simpler one:
|
|
23
|
+
* ReactCommon parses it for every platform and only the *iOS* view config
|
|
24
|
+
* declares it, so on a config built from Android's it never arrives. One line
|
|
25
|
+
* fixes that, and it is the line that lets a <Modal> tell a screen reader to
|
|
26
|
+
* stay inside it.
|
|
27
|
+
*
|
|
28
|
+
* Reported rather than forked: the whole file is React Native's, this adds six
|
|
29
|
+
* keys, and each goes away when upstream adds it. See docs/BACKLOG.md.
|
|
23
30
|
*
|
|
24
31
|
* @format
|
|
25
32
|
*/
|
|
@@ -67,6 +74,17 @@ exports.default = {
|
|
|
67
74
|
onPointerUpCapture: true,
|
|
68
75
|
onPointerCancel: true,
|
|
69
76
|
onPointerCancelCapture: true,
|
|
77
|
+
// `accessibilityViewIsModal`, which ReactCommon parses for every platform
|
|
78
|
+
// -- `AccessibilityProps.cpp` reads the raw prop with no condition on it --
|
|
79
|
+
// and which only `BaseViewConfig.ios.js` declares. Without the declaration
|
|
80
|
+
// React never sends it, so the three hosts read a prop that is always
|
|
81
|
+
// false and a <Modal> cannot tell a screen reader to stay inside it.
|
|
82
|
+
//
|
|
83
|
+
// A desktop needs it for the same reason iOS does, and more: every one of
|
|
84
|
+
// these platforms has a real modal window. GTK publishes it as
|
|
85
|
+
// `aria-modal`, AppKit as `accessibilityModal` and Win32 as UIA's
|
|
86
|
+
// `IsDialog`.
|
|
87
|
+
accessibilityViewIsModal: true,
|
|
70
88
|
},
|
|
71
89
|
};
|
|
72
90
|
//# sourceMappingURL=BaseViewConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseViewConfig.js","sourceRoot":"","sources":["../../../src/overrides/BaseViewConfig.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BaseViewConfig.js","sourceRoot":"","sources":["../../../src/overrides/BaseViewConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,YAAY,CAAC;;AAEb,4EAA4E;AAC5E,+EAA+E;AAC/E,sEAAsE;AACtE,qBAAqB;AACrB,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,qBAAqB;AACrB,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,kFAAkF;AAClF,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,SAAS;AACT,8DAA8D;AAC9D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,UAAU;AACV,MAAM,QAAQ,GAAQ,OAAO,CAAC,uEAAuE,CAAC,CAAC;AACvG,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC;AAEpD,kBAAe;IACb,GAAG,cAAc;IACjB,eAAe,EAAE;QACf,GAAG,cAAc,CAAC,eAAe;QACjC,4EAA4E;QAC5E,yEAAyE;QACzE,uEAAuE;QACvE,iDAAiD;QACjD,aAAa,EAAE,IAAI;QACnB,oBAAoB,EAAE,IAAI;QAC1B,WAAW,EAAE,IAAI;QACjB,kBAAkB,EAAE,IAAI;QACxB,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,IAAI;QAC5B,0EAA0E;QAC1E,4EAA4E;QAC5E,2EAA2E;QAC3E,sEAAsE;QACtE,qEAAqE;QACrE,EAAE;QACF,0EAA0E;QAC1E,+DAA+D;QAC/D,kEAAkE;QAClE,cAAc;QACd,wBAAwB,EAAE,IAAI;KAC/B;CACF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<Button>`, for a desktop React Native platform.
|
|
3
|
+
*
|
|
4
|
+
* Not a shim, and the failure is not a missing branch this time but a missing
|
|
5
|
+
* *key*. React Native's own `Button.js` builds its look out of four
|
|
6
|
+
* `Platform.select({ios, android})` tables, and a platform that is neither gets
|
|
7
|
+
* `undefined` from all four:
|
|
8
|
+
*
|
|
9
|
+
* button: undefined no background, no radius
|
|
10
|
+
* text: {textAlign: 'center', margin: 8} no colour, no size
|
|
11
|
+
* buttonDisabled: undefined a disabled button looks enabled
|
|
12
|
+
* textDisabled: undefined
|
|
13
|
+
*
|
|
14
|
+
* So `<Button title="Press me" />` renders as black centred text on nothing. It
|
|
15
|
+
* was measured that way on this platform on 2026-10-10, in a picture rather
|
|
16
|
+
* than an argument: see `BASALT_SNAPSHOT` in docs/TESTING.md.
|
|
17
|
+
*
|
|
18
|
+
* **Android's look, deliberately.** The two tables are a filled blue rectangle
|
|
19
|
+
* with white text, and a borderless blue-text button. Android's is the one that
|
|
20
|
+
* stays coherent here, because upstream's `color` prop already behaves the
|
|
21
|
+
* Android way on anything that is not iOS: it sets the *background*. Taking
|
|
22
|
+
* iOS's text styling with that would be black text on a coloured fill, which is
|
|
23
|
+
* exactly the picture the broken version produced.
|
|
24
|
+
*
|
|
25
|
+
* Everything else follows React Native's own file line for line, including
|
|
26
|
+
* which touchable: `Button.js` picks `TouchableNativeFeedback` on Android and
|
|
27
|
+
* `TouchableOpacity` on everything else, and the second is ordinary JavaScript
|
|
28
|
+
* that works here.
|
|
29
|
+
*
|
|
30
|
+
* Two deliberate differences, both from the same rule -- this platform is not
|
|
31
|
+
* Android, so the Android-only behaviour does not come with the Android look:
|
|
32
|
+
*
|
|
33
|
+
* - the title is not uppercased. Upstream uppercases it under
|
|
34
|
+
* `Platform.OS === 'android'`, which is a Material convention rather than
|
|
35
|
+
* part of the styling.
|
|
36
|
+
* - `touchSoundDisabled`, `hasTVPreferredFocus` and the four `nextFocus`
|
|
37
|
+
* props are dropped. They are Android and TV props; no desktop has a
|
|
38
|
+
* touch sound or a focus engine to hand them to, and passing them on would
|
|
39
|
+
* be a promise nothing keeps.
|
|
40
|
+
*
|
|
41
|
+
* @format
|
|
42
|
+
*/
|
|
43
|
+
type AccessibilityState = {
|
|
44
|
+
busy?: boolean;
|
|
45
|
+
checked?: boolean | 'mixed';
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
expanded?: boolean;
|
|
48
|
+
selected?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export type ButtonProps = {
|
|
51
|
+
/** The label. Not uppercased here; see the header. */
|
|
52
|
+
title: string;
|
|
53
|
+
onPress?: (event?: unknown) => unknown;
|
|
54
|
+
/** The button's background, as on Android. Upstream tints the text instead on iOS. */
|
|
55
|
+
color?: string | null;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
accessible?: boolean;
|
|
58
|
+
accessibilityLabel?: string;
|
|
59
|
+
accessibilityHint?: string;
|
|
60
|
+
accessibilityLanguage?: string;
|
|
61
|
+
accessibilityActions?: ReadonlyArray<{
|
|
62
|
+
name: string;
|
|
63
|
+
label?: string;
|
|
64
|
+
}>;
|
|
65
|
+
onAccessibilityAction?: (event: unknown) => void;
|
|
66
|
+
accessibilityState?: AccessibilityState;
|
|
67
|
+
importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants';
|
|
68
|
+
testID?: string;
|
|
69
|
+
'aria-busy'?: boolean;
|
|
70
|
+
'aria-checked'?: boolean | 'mixed';
|
|
71
|
+
'aria-disabled'?: boolean;
|
|
72
|
+
'aria-expanded'?: boolean;
|
|
73
|
+
'aria-label'?: string;
|
|
74
|
+
'aria-selected'?: boolean;
|
|
75
|
+
};
|
|
76
|
+
declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
declare namespace Button {
|
|
78
|
+
var displayName: string;
|
|
79
|
+
}
|
|
80
|
+
export default Button;
|
|
81
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/overrides/Button.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAQH,KAAK,kBAAkB,GAAG;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACvC,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,aAAa,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IACrE,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,yBAAyB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,qBAAqB,CAAC;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuEjC;kBAvEQ,MAAM;;;AAmGf,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* `<Button>`, for a desktop React Native platform.
|
|
9
|
+
*
|
|
10
|
+
* Not a shim, and the failure is not a missing branch this time but a missing
|
|
11
|
+
* *key*. React Native's own `Button.js` builds its look out of four
|
|
12
|
+
* `Platform.select({ios, android})` tables, and a platform that is neither gets
|
|
13
|
+
* `undefined` from all four:
|
|
14
|
+
*
|
|
15
|
+
* button: undefined no background, no radius
|
|
16
|
+
* text: {textAlign: 'center', margin: 8} no colour, no size
|
|
17
|
+
* buttonDisabled: undefined a disabled button looks enabled
|
|
18
|
+
* textDisabled: undefined
|
|
19
|
+
*
|
|
20
|
+
* So `<Button title="Press me" />` renders as black centred text on nothing. It
|
|
21
|
+
* was measured that way on this platform on 2026-10-10, in a picture rather
|
|
22
|
+
* than an argument: see `BASALT_SNAPSHOT` in docs/TESTING.md.
|
|
23
|
+
*
|
|
24
|
+
* **Android's look, deliberately.** The two tables are a filled blue rectangle
|
|
25
|
+
* with white text, and a borderless blue-text button. Android's is the one that
|
|
26
|
+
* stays coherent here, because upstream's `color` prop already behaves the
|
|
27
|
+
* Android way on anything that is not iOS: it sets the *background*. Taking
|
|
28
|
+
* iOS's text styling with that would be black text on a coloured fill, which is
|
|
29
|
+
* exactly the picture the broken version produced.
|
|
30
|
+
*
|
|
31
|
+
* Everything else follows React Native's own file line for line, including
|
|
32
|
+
* which touchable: `Button.js` picks `TouchableNativeFeedback` on Android and
|
|
33
|
+
* `TouchableOpacity` on everything else, and the second is ordinary JavaScript
|
|
34
|
+
* that works here.
|
|
35
|
+
*
|
|
36
|
+
* Two deliberate differences, both from the same rule -- this platform is not
|
|
37
|
+
* Android, so the Android-only behaviour does not come with the Android look:
|
|
38
|
+
*
|
|
39
|
+
* - the title is not uppercased. Upstream uppercases it under
|
|
40
|
+
* `Platform.OS === 'android'`, which is a Material convention rather than
|
|
41
|
+
* part of the styling.
|
|
42
|
+
* - `touchSoundDisabled`, `hasTVPreferredFocus` and the four `nextFocus`
|
|
43
|
+
* props are dropped. They are Android and TV props; no desktop has a
|
|
44
|
+
* touch sound or a focus engine to hand them to, and passing them on would
|
|
45
|
+
* be a promise nothing keeps.
|
|
46
|
+
*
|
|
47
|
+
* @format
|
|
48
|
+
*/
|
|
49
|
+
const StyleSheet_1 = __importDefault(require("basalt-core/upstream/Libraries/StyleSheet/StyleSheet"));
|
|
50
|
+
const Text_1 = __importDefault(require("basalt-core/upstream/Libraries/Text/Text"));
|
|
51
|
+
const TouchableOpacity_1 = __importDefault(require("basalt-core/upstream/Libraries/Components/Touchable/TouchableOpacity"));
|
|
52
|
+
const View_1 = __importDefault(require("basalt-core/upstream/Libraries/Components/View/View"));
|
|
53
|
+
function Button(props) {
|
|
54
|
+
const { accessibilityActions, accessibilityHint, accessibilityLanguage, accessibilityLabel, accessibilityState, accessible, color, importantForAccessibility, onAccessibilityAction, onPress, testID, title, } = props;
|
|
55
|
+
// The aria-* names win over the accessibility* ones, which is the precedence
|
|
56
|
+
// React Native's own file applies.
|
|
57
|
+
const state = {
|
|
58
|
+
busy: props['aria-busy'] ?? accessibilityState?.busy,
|
|
59
|
+
checked: props['aria-checked'] ?? accessibilityState?.checked,
|
|
60
|
+
disabled: props['aria-disabled'] ?? accessibilityState?.disabled,
|
|
61
|
+
expanded: props['aria-expanded'] ?? accessibilityState?.expanded,
|
|
62
|
+
selected: props['aria-selected'] ?? accessibilityState?.selected,
|
|
63
|
+
};
|
|
64
|
+
const disabled = props.disabled != null ? props.disabled : state.disabled;
|
|
65
|
+
const buttonStyles = [styles.button];
|
|
66
|
+
const textStyles = [styles.text];
|
|
67
|
+
if (color) {
|
|
68
|
+
buttonStyles.push({ backgroundColor: color });
|
|
69
|
+
}
|
|
70
|
+
if (disabled === true) {
|
|
71
|
+
buttonStyles.push(styles.buttonDisabled);
|
|
72
|
+
textStyles.push(styles.textDisabled);
|
|
73
|
+
}
|
|
74
|
+
if (typeof title !== 'string') {
|
|
75
|
+
throw new Error('The title prop of a Button must be a string');
|
|
76
|
+
}
|
|
77
|
+
// A button whose own text is focusable would be two stops in the reading
|
|
78
|
+
// order for one control, which is the same correction upstream makes.
|
|
79
|
+
const importance = importantForAccessibility === 'no'
|
|
80
|
+
? 'no-hide-descendants'
|
|
81
|
+
: importantForAccessibility;
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(TouchableOpacity_1.default, { accessible: accessible, accessibilityActions: accessibilityActions, onAccessibilityAction: onAccessibilityAction, accessibilityLabel: props['aria-label'] || accessibilityLabel, accessibilityHint: accessibilityHint, accessibilityLanguage: accessibilityLanguage, accessibilityRole: "button", accessibilityState: disabled !== state.disabled ? { ...state, disabled } : state, importantForAccessibility: importance, testID: testID, disabled: disabled, onPress: onPress, children: (0, jsx_runtime_1.jsx)(View_1.default, { style: buttonStyles, children: (0, jsx_runtime_1.jsx)(Text_1.default, { style: textStyles, disabled: disabled, children: title }) }) }));
|
|
83
|
+
}
|
|
84
|
+
// Android's four tables, which are the ones that exist. The colours are
|
|
85
|
+
// React Native's own, copied rather than chosen: Material blue for the fill,
|
|
86
|
+
// and the greys it disables to.
|
|
87
|
+
const styles = StyleSheet_1.default.create({
|
|
88
|
+
button: {
|
|
89
|
+
elevation: 4,
|
|
90
|
+
backgroundColor: '#2196F3',
|
|
91
|
+
borderRadius: 2,
|
|
92
|
+
},
|
|
93
|
+
text: {
|
|
94
|
+
textAlign: 'center',
|
|
95
|
+
margin: 8,
|
|
96
|
+
color: 'white',
|
|
97
|
+
fontWeight: '500',
|
|
98
|
+
},
|
|
99
|
+
buttonDisabled: {
|
|
100
|
+
elevation: 0,
|
|
101
|
+
backgroundColor: '#dfdfdf',
|
|
102
|
+
},
|
|
103
|
+
textDisabled: {
|
|
104
|
+
color: '#a1a1a1',
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
Button.displayName = 'Button';
|
|
108
|
+
exports.default = Button;
|
|
109
|
+
//# sourceMapp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E,CAAC;QACZ,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,CAAC;KAChB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;KAClB;IACD,cAAc,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,eAAe,EAAE,SAAS;KAC3B;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,SAAS;KACjB;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,kBAAe,MAAM,CAAC"}
|
|
@@ -20,8 +20,31 @@
|
|
|
20
20
|
* first child and everything else is React Native's.
|
|
21
21
|
*
|
|
22
22
|
* Importing the module this file replaces resolves to the original rather than
|
|
23
|
-
* looping: `
|
|
24
|
-
*
|
|
23
|
+
* looping: a `basalt-core/upstream/...` specifier means React Native's own file
|
|
24
|
+
* and is never answered with an override. See docs/DECISIONS.md for what that
|
|
25
|
+
* rule used to be and what it cost.
|
|
26
|
+
*
|
|
27
|
+
* ## `pagingEnabled`, which never reached a desktop at all
|
|
28
|
+
*
|
|
29
|
+
* The second thing this wrapper puts back, and a different failure from the
|
|
30
|
+
* first: `ScrollView.render` computes the native `pagingEnabled` prop with
|
|
31
|
+
* `Platform.select({ios, android})` and no `default`, so on `linux`, `macos`
|
|
32
|
+
* or `windows` it is `undefined`, `BaseScrollViewProps` keeps its own `false`,
|
|
33
|
+
* and a paged list simply scrolls freely. All three hosts implement paging --
|
|
34
|
+
* `core/ScrollSnap.h` has it, and reads `props->pagingEnabled` to turn it on --
|
|
35
|
+
* so the only thing missing was the prop.
|
|
36
|
+
*
|
|
37
|
+
* It is translated rather than forced, because `ScrollView.js` is two thousand
|
|
38
|
+
* lines and the value is computed inside its render: a paged list is given
|
|
39
|
+
* `snapToInterval` of its own viewport and `disableIntervalMomentum`, which is
|
|
40
|
+
* what `core/ScrollSnap.h` says paging *is* -- snap points a screenful apart,
|
|
41
|
+
* and one page per flick however hard it was thrown. Only when the app set
|
|
42
|
+
* neither `snapToInterval` nor `snapToOffsets`, which is the same precedence
|
|
43
|
+
* upstream's iOS branch applies.
|
|
44
|
+
*
|
|
45
|
+
* The viewport comes from `onLayout`, so a paged list snaps from its second
|
|
46
|
+
* frame rather than its first, and follows a window that is resized. The app's
|
|
47
|
+
* own `onLayout` still fires.
|
|
25
48
|
*
|
|
26
49
|
* @format
|
|
27
50
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../src/overrides/ScrollView.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../src/overrides/ScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAKH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,KAAK,qBAAqB,GAAG;IAC3B,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAG3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AA8DF,iBAAS,gBAAgB,CAAC,EACxB,cAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG,KAAK,CAAC,YAAY,CAW5C;kBAfQ,gBAAgB;;;AAiCzB,eAAe,gBAAgB,CAAC"}
|
|
@@ -20,8 +20,31 @@
|
|
|
20
20
|
* first child and everything else is React Native's.
|
|
21
21
|
*
|
|
22
22
|
* Importing the module this file replaces resolves to the original rather than
|
|
23
|
-
* looping: `
|
|
24
|
-
*
|
|
23
|
+
* looping: a `basalt-core/upstream/...` specifier means React Native's own file
|
|
24
|
+
* and is never answered with an override. See docs/DECISIONS.md for what that
|
|
25
|
+
* rule used to be and what it cost.
|
|
26
|
+
*
|
|
27
|
+
* ## `pagingEnabled`, which never reached a desktop at all
|
|
28
|
+
*
|
|
29
|
+
* The second thing this wrapper puts back, and a different failure from the
|
|
30
|
+
* first: `ScrollView.render` computes the native `pagingEnabled` prop with
|
|
31
|
+
* `Platform.select({ios, android})` and no `default`, so on `linux`, `macos`
|
|
32
|
+
* or `windows` it is `undefined`, `BaseScrollViewProps` keeps its own `false`,
|
|
33
|
+
* and a paged list simply scrolls freely. All three hosts implement paging --
|
|
34
|
+
* `core/ScrollSnap.h` has it, and reads `props->pagingEnabled` to turn it on --
|
|
35
|
+
* so the only thing missing was the prop.
|
|
36
|
+
*
|
|
37
|
+
* It is translated rather than forced, because `ScrollView.js` is two thousand
|
|
38
|
+
* lines and the value is computed inside its render: a paged list is given
|
|
39
|
+
* `snapToInterval` of its own viewport and `disableIntervalMomentum`, which is
|
|
40
|
+
* what `core/ScrollSnap.h` says paging *is* -- snap points a screenful apart,
|
|
41
|
+
* and one page per flick however hard it was thrown. Only when the app set
|
|
42
|
+
* neither `snapToInterval` nor `snapToOffsets`, which is the same precedence
|
|
43
|
+
* upstream's iOS branch applies.
|
|
44
|
+
*
|
|
45
|
+
* The viewport comes from `onLayout`, so a paged list snaps from its second
|
|
46
|
+
* frame rather than its first, and follows a window that is resized. The app's
|
|
47
|
+
* own `onLayout` still fires.
|
|
25
48
|
*
|
|
26
49
|
* @format
|
|
27
50
|
*/
|
|
@@ -32,14 +55,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
56
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
34
57
|
const ScrollView_1 = __importDefault(require("basalt-core/upstream/Libraries/Components/ScrollView/ScrollView"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
58
|
+
const react_1 = require("react");
|
|
59
|
+
/** The children in the order this platform mounts them: see the header. */
|
|
60
|
+
function withRefreshControl(refreshControl, children) {
|
|
39
61
|
// First, so it takes the row at the top of the content: on a phone the
|
|
40
62
|
// spinner lives in the rubber band above the list, and a desktop scroll view
|
|
41
63
|
// has none. See the header of RefreshControl.js beside this file.
|
|
42
|
-
return
|
|
64
|
+
return refreshControl == null ? children : [refreshControl, children];
|
|
65
|
+
}
|
|
66
|
+
/** Whether this list asked for paging and nothing more specific. */
|
|
67
|
+
function wantsPaging(props) {
|
|
68
|
+
return (props.pagingEnabled === true &&
|
|
69
|
+
props.snapToInterval == null &&
|
|
70
|
+
props.snapToOffsets == null);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A paged list, which has to measure itself: the page is the viewport, and
|
|
74
|
+
* nothing knows how big that is until it has been laid out.
|
|
75
|
+
*
|
|
76
|
+
* A second component rather than a branch, for the reason View.tsx beside this
|
|
77
|
+
* file has two: hooks cannot be conditional, and a scroll view that re-renders
|
|
78
|
+
* on every layout is not a cost to impose on the lists that are not paged.
|
|
79
|
+
*/
|
|
80
|
+
function PagedScrollView({ refreshControl, children, ...props }) {
|
|
81
|
+
const [viewport, setViewport] = (0, react_1.useState)(0);
|
|
82
|
+
const appOnLayout = props.onLayout;
|
|
83
|
+
const horizontal = props.horizontal === true;
|
|
84
|
+
const onLayout = (0, react_1.useCallback)((event) => {
|
|
85
|
+
const { width, height } = event.nativeEvent.layout;
|
|
86
|
+
setViewport(horizontal ? width : height);
|
|
87
|
+
appOnLayout?.(event);
|
|
88
|
+
}, [appOnLayout, horizontal]);
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(ScrollView_1.default, { ...props, onLayout: onLayout,
|
|
90
|
+
// Zero until the first layout, which `ScrollSnapConfig` reads as "unused"
|
|
91
|
+
// -- so a paged list snaps from its second frame. A page cannot be known
|
|
92
|
+
// before the viewport is.
|
|
93
|
+
snapToInterval: viewport, disableIntervalMomentum: true, children: withRefreshControl(refreshControl, children) }));
|
|
94
|
+
}
|
|
95
|
+
function BasaltScrollView({ refreshControl, children, ...props }) {
|
|
96
|
+
if (wantsPaging(props)) {
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(PagedScrollView, { refreshControl: refreshControl, ...props, children: children }));
|
|
98
|
+
}
|
|
99
|
+
return ((0, jsx_runtime_1.jsx)(ScrollView_1.default, { ...props, children: withRefreshControl(refreshControl, children) }));
|
|
43
100
|
}
|
|
44
101
|
BasaltScrollView.displayName = 'ScrollView';
|
|
45
102
|
// `ScrollView.Context` is read by VirtualizedList and by `ScrollView`'s own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.js","sourceRoot":"","sources":["../../../src/overrides/ScrollView.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ScrollView.js","sourceRoot":"","sources":["../../../src/overrides/ScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,YAAY,CAAC;;;;;;AAEb,iHAAyF;AAEzF,iCAA4C;AAY5C,2EAA2E;AAC3E,SAAS,kBAAkB,CACzB,cAAqD,EACrD,QAAyB;IAEzB,uEAAuE;IACvE,6EAA6E;IAC7E,kEAAkE;IAClE,OAAO,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AACxE,CAAC;AAED,oEAAoE;AACpE,SAAS,WAAW,CAAC,KAA8B;IACjD,OAAO,CACL,KAAK,CAAC,aAAa,KAAK,IAAI;QAC5B,KAAK,CAAC,cAAc,IAAI,IAAI;QAC5B,KAAK,CAAC,aAAa,IAAI,IAAI,CAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,EACvB,cAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACc;IACtB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC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AAG,oBAAgD,CAAC;AACzE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;IAC/C,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;AAE1C,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Settings`, for a platform React Native's own copy has no branch for.
|
|
3
|
+
*
|
|
4
|
+
* The third of these, and found by the native-module audit rather than by an
|
|
5
|
+
* app: `docs/platform-modules.json` recorded `SettingsManager` as a module that
|
|
6
|
+
* *throws* here, which was wrong in the app's favour and wrong in a way that
|
|
7
|
+
* mattered. `Settings.js` reads
|
|
8
|
+
*
|
|
9
|
+
* if (Platform.OS === 'ios') {
|
|
10
|
+
* Settings = require('./Settings').default;
|
|
11
|
+
* } else {
|
|
12
|
+
* Settings = require('./SettingsFallback').default;
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* and `SettingsFallback` is four methods that `console.warn` and answer null.
|
|
16
|
+
* So nothing threw, nothing was stored, and nothing said why beyond a warning
|
|
17
|
+
* that reads like a platform limitation rather than a missing module. The
|
|
18
|
+
* native module was never reached, exactly as with `Share` and `Alert`.
|
|
19
|
+
*
|
|
20
|
+
* ## What this file is
|
|
21
|
+
*
|
|
22
|
+
* React Native's own `Settings.ios.js`, kept as close to the original as the
|
|
23
|
+
* conversion to TypeScript allows, because its behaviour is the contract: an
|
|
24
|
+
* app written against iOS reads `Settings.get` synchronously, and that only
|
|
25
|
+
* works because the whole store arrives once in `getConstants()` and is cached
|
|
26
|
+
* in `_settings` here. A rewrite that asked the native side per key would be a
|
|
27
|
+
* different API with the same name.
|
|
28
|
+
*
|
|
29
|
+
* Importing the iOS file instead was the other option and is worse: the file
|
|
30
|
+
* would still resolve through `./NativeSettingsManager`, and a platform would
|
|
31
|
+
* depend on a `.ios` suffix meaning "iOS or anything like it", which is the
|
|
32
|
+
* assumption this whole override table exists to undo.
|
|
33
|
+
*
|
|
34
|
+
* ## watchKeys
|
|
35
|
+
*
|
|
36
|
+
* Registered and never fired, and that is iOS's shape rather than a stub.
|
|
37
|
+
* `Settings.set` merges into `_settings` before calling the module, so
|
|
38
|
+
* `_sendObservations` sees no change for the app's own write -- which is why
|
|
39
|
+
* `RCTSettingsManager` sets `_ignoringUpdates` around `setValues` instead of
|
|
40
|
+
* emitting. What fires a watcher on iOS is a change from *outside* the process,
|
|
41
|
+
* which on a desktop means watching the settings file; see
|
|
42
|
+
* docs/backlog/modules.md for the three calls that would do it. The listener is
|
|
43
|
+
* here so that the day a host emits `settingsUpdated`, this half already works.
|
|
44
|
+
*
|
|
45
|
+
* @format
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* A persistent key-value store. On iOS this wraps `NSUserDefaults`; here it is
|
|
49
|
+
* a JSON file under the per-user configuration directory, which is what
|
|
50
|
+
* core/SettingsStore.h argues for.
|
|
51
|
+
*
|
|
52
|
+
* @see https://reactnative.dev/docs/settings
|
|
53
|
+
*/
|
|
54
|
+
declare const Settings: {
|
|
55
|
+
_settings: {
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The current value for `key`, or undefined when it has never been set.
|
|
60
|
+
*/
|
|
61
|
+
get(key: string): unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Merges `settings` into the store, one key deep. A key set to null is
|
|
64
|
+
* forgotten rather than stored as null, which is what iOS does.
|
|
65
|
+
*/
|
|
66
|
+
set(settings: {
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}): void;
|
|
69
|
+
/**
|
|
70
|
+
* Calls `callback` whenever one of `keys` changes, and answers a watch id for
|
|
71
|
+
* `clearWatch`. Nothing emits the change event on this platform yet; see the
|
|
72
|
+
* header.
|
|
73
|
+
*/
|
|
74
|
+
watchKeys(keys: string | Array<string>, callback: () => void): number;
|
|
75
|
+
clearWatch(watchId: number): void;
|
|
76
|
+
_sendObservations(body: {
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}): void;
|
|
79
|
+
};
|
|
80
|
+
export default Settings;
|
|
81
|
+
//# sourceMappingURL=Settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/overrides/Settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAqBH;;;;;;GAMG;AACH,QAAA,MAAM,QAAQ;eACgD;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC;IAEpF;;OAEG;aACM,MAAM,GAAG,OAAO;IAIzB;;;OAGG;kBACW;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,IAAI;IAK7C;;;;OAIG;oBACa,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,MAAM,IAAI,GAAG,MAAM;wBAYjD,MAAM,GAAG,IAAI;4BAMT;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,IAAI;CAexD,CAAC;AAIF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Settings`, for a platform React Native's own copy has no branch for.
|
|
3
|
+
*
|
|
4
|
+
* The third of these, and found by the native-module audit rather than by an
|
|
5
|
+
* app: `docs/platform-modules.json` recorded `SettingsManager` as a module that
|
|
6
|
+
* *throws* here, which was wrong in the app's favour and wrong in a way that
|
|
7
|
+
* mattered. `Settings.js` reads
|
|
8
|
+
*
|
|
9
|
+
* if (Platform.OS === 'ios') {
|
|
10
|
+
* Settings = require('./Settings').default;
|
|
11
|
+
* } else {
|
|
12
|
+
* Settings = require('./SettingsFallback').default;
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* and `SettingsFallback` is four methods that `console.warn` and answer null.
|
|
16
|
+
* So nothing threw, nothing was stored, and nothing said why beyond a warning
|
|
17
|
+
* that reads like a platform limitation rather than a missing module. The
|
|
18
|
+
* native module was never reached, exactly as with `Share` and `Alert`.
|
|
19
|
+
*
|
|
20
|
+
* ## What this file is
|
|
21
|
+
*
|
|
22
|
+
* React Native's own `Settings.ios.js`, kept as close to the original as the
|
|
23
|
+
* conversion to TypeScript allows, because its behaviour is the contract: an
|
|
24
|
+
* app written against iOS reads `Settings.get` synchronously, and that only
|
|
25
|
+
* works because the whole store arrives once in `getConstants()` and is cached
|
|
26
|
+
* in `_settings` here. A rewrite that asked the native side per key would be a
|
|
27
|
+
* different API with the same name.
|
|
28
|
+
*
|
|
29
|
+
* Importing the iOS file instead was the other option and is worse: the file
|
|
30
|
+
* would still resolve through `./NativeSettingsManager`, and a platform would
|
|
31
|
+
* depend on a `.ios` suffix meaning "iOS or anything like it", which is the
|
|
32
|
+
* assumption this whole override table exists to undo.
|
|
33
|
+
*
|
|
34
|
+
* ## watchKeys
|
|
35
|
+
*
|
|
36
|
+
* Registered and never fired, and that is iOS's shape rather than a stub.
|
|
37
|
+
* `Settings.set` merges into `_settings` before calling the module, so
|
|
38
|
+
* `_sendObservations` sees no change for the app's own write -- which is why
|
|
39
|
+
* `RCTSettingsManager` sets `_ignoringUpdates` around `setValues` instead of
|
|
40
|
+
* emitting. What fires a watcher on iOS is a change from *outside* the process,
|
|
41
|
+
* which on a desktop means watching the settings file; see
|
|
42
|
+
* docs/backlog/modules.md for the three calls that would do it. The listener is
|
|
43
|
+
* here so that the day a host emits `settingsUpdated`, this half already works.
|
|
44
|
+
*
|
|
45
|
+
* @format
|
|
46
|
+
*/
|
|
47
|
+
'use strict';
|
|
48
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
// `NativeSettingsManager`, which is a `getEnforcing` lookup: if a host has not
|
|
53
|
+
// registered `SettingsManager`, importing this throws and names the module,
|
|
54
|
+
// which is a better failure than the silent null the fallback gave.
|
|
55
|
+
const NativeSettingsManager_1 = __importDefault(require("basalt-core/upstream/Libraries/Settings/NativeSettingsManager"));
|
|
56
|
+
// The device event emitter, which is where a `settingsUpdated` event would
|
|
57
|
+
// arrive. React Native's own file subscribes at import and so does this one.
|
|
58
|
+
const RCTDeviceEventEmitter_1 = __importDefault(require("basalt-core/upstream/Libraries/EventEmitter/RCTDeviceEventEmitter"));
|
|
59
|
+
const invariant = require('invariant');
|
|
60
|
+
const subscriptions = [];
|
|
61
|
+
/**
|
|
62
|
+
* A persistent key-value store. On iOS this wraps `NSUserDefaults`; here it is
|
|
63
|
+
* a JSON file under the per-user configuration directory, which is what
|
|
64
|
+
* core/SettingsStore.h argues for.
|
|
65
|
+
*
|
|
66
|
+
* @see https://reactnative.dev/docs/settings
|
|
67
|
+
*/
|
|
68
|
+
const Settings = {
|
|
69
|
+
_settings: NativeSettingsManager_1.default.getConstants().settings,
|
|
70
|
+
/**
|
|
71
|
+
* The current value for `key`, or undefined when it has never been set.
|
|
72
|
+
*/
|
|
73
|
+
get(key) {
|
|
74
|
+
return this._settings[key];
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Merges `settings` into the store, one key deep. A key set to null is
|
|
78
|
+
* forgotten rather than stored as null, which is what iOS does.
|
|
79
|
+
*/
|
|
80
|
+
set(settings) {
|
|
81
|
+
this._settings = Object.assign(this._settings, settings);
|
|
82
|
+
NativeSettingsManager_1.default.setValues(settings);
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Calls `callback` whenever one of `keys` changes, and answers a watch id for
|
|
86
|
+
* `clearWatch`. Nothing emits the change event on this platform yet; see the
|
|
87
|
+
* header.
|
|
88
|
+
*/
|
|
89
|
+
watchKeys(keys, callback) {
|
|
90
|
+
if (typeof keys === 'string') {
|
|
91
|
+
keys = [keys];
|
|
92
|
+
}
|
|
93
|
+
invariant(Array.isArray(keys), 'keys should be a string or array of strings');
|
|
94
|
+
const sid = subscriptions.length;
|
|
95
|
+
subscriptions.push({ keys, callback });
|
|
96
|
+
return sid;
|
|
97
|
+
},
|
|
98
|
+
clearWatch(watchId) {
|
|
99
|
+
if (watchId < subscriptions.length) {
|
|
100
|
+
subscriptions[watchId] = { keys: [], callback: null };
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
_sendObservations(body) {
|
|
104
|
+
Object.keys(body).forEach(key => {
|
|
105
|
+
const newValue = body[key];
|
|
106
|
+
const didChange = this._settings[key] !== newValue;
|
|
107
|
+
this._settings[key] = newValue;
|
|
108
|
+
if (didChange) {
|
|
109
|
+
subscriptions.forEach(sub => {
|
|
110
|
+
if (sub.keys.indexOf(key) !== -1 && sub.callback) {
|
|
111
|
+
sub.callback();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
RCTDeviceEventEmitter_1.default.addListener('settingsUpdated', Settings._sendObservations.bind(Settings));
|
|
119
|
+
exports.default = Settings;
|
|
120
|
+
//# sourceMappingURL=Settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../../src/overrides/Settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,YAAY,CAAC;;;;;AAEb,+EAA+E;AAC/E,4EAA4E;AAC5E,oEAAoE;AACpE,0HAAkG;AAClG,2EAA2E;AAC3E,6EAA6E;AAC7E,8HAAsG;AAEtG,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,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,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC;YACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;YAE/B,IAAI,SAAS,EAAE,CAAC;gBACd,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;oBAC1B,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;wBACjD,GAAG,CAAC,QAAQ,EAAE,CAAC;oBACjB,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,+BAAqB,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEhG,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `decelerationRate`, for a desktop React Native platform.
|
|
3
|
+
*
|
|
4
|
+
* Not a shim, and the same failure as `<Button>`'s: React Native's own file is
|
|
5
|
+
* two `Platform.select({ios, android})` tables with no `default`, so on
|
|
6
|
+
* `linux`, `macos` or `windows` both of the prop's documented spellings --
|
|
7
|
+
* `'normal'` and `'fast'` -- resolve to `undefined`. `BaseScrollViewProps`
|
|
8
|
+
* then keeps its own default of 0.998, so `decelerationRate="fast"` scrolled
|
|
9
|
+
* at the normal rate and nothing said otherwise. Only a raw number worked.
|
|
10
|
+
*
|
|
11
|
+
* iOS's pair, because they are the pair this platform's own fling already
|
|
12
|
+
* uses: `core/ScrollMomentum.h` names 0.998 and 0.99 as what `'normal'` and
|
|
13
|
+
* `'fast'` mean, and a per-millisecond friction factor is the same model
|
|
14
|
+
* UIScrollView and every browser use. Android's 0.985 and 0.9 are a different
|
|
15
|
+
* curve's constants and would make a fling stop in a third of the distance.
|
|
16
|
+
*
|
|
17
|
+
* @format
|
|
18
|
+
*/
|
|
19
|
+
export default function processDecelerationRate(decelerationRate: number | 'normal' | 'fast'): number;
|
|
20
|
+
//# sourceMappingURL=processDecelerationRate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processDecelerationRate.d.ts","sourceRoot":"","sources":["../../../src/overrides/processDecelerationRate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,gBAAgB,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAC3C,MAAM,CAQR"}
|