@react-navigation/native 8.0.0-alpha.39 → 8.0.0-alpha.40

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 (85) hide show
  1. package/ios/ReactNavigationSFSymbolView.swift +6 -2
  2. package/lib/module/Link.js +65 -29
  3. package/lib/module/Link.js.map +1 -1
  4. package/lib/module/Link.native.js +72 -0
  5. package/lib/module/Link.native.js.map +1 -0
  6. package/lib/module/NavigationContainer.js +3 -3
  7. package/lib/module/NavigationContainer.js.map +1 -1
  8. package/lib/module/constants.js +5 -0
  9. package/lib/module/constants.js.map +1 -0
  10. package/lib/module/constants.native.js +6 -0
  11. package/lib/module/constants.native.js.map +1 -0
  12. package/lib/module/index.js +1 -1
  13. package/lib/module/index.js.map +1 -1
  14. package/lib/module/native/CornerInset.js +2 -7
  15. package/lib/module/native/CornerInset.js.map +1 -1
  16. package/lib/module/theming/DarkTheme.js +1 -1
  17. package/lib/module/theming/DarkTheme.js.map +1 -1
  18. package/lib/module/theming/LightTheme.js +1 -1
  19. package/lib/module/theming/LightTheme.js.map +1 -1
  20. package/lib/module/theming/MaterialFallbackTheme.js +1 -1
  21. package/lib/module/theming/MaterialFallbackTheme.js.map +1 -1
  22. package/lib/module/theming/MaterialTheme.android.js +1 -1
  23. package/lib/module/theming/MaterialTheme.android.js.map +1 -1
  24. package/lib/module/theming/fonts.js +15 -54
  25. package/lib/module/theming/fonts.js.map +1 -1
  26. package/lib/module/theming/fonts.native.js +42 -0
  27. package/lib/module/theming/fonts.native.js.map +1 -0
  28. package/lib/module/useLinkProps.js +5 -5
  29. package/lib/module/useLinkProps.js.map +1 -1
  30. package/lib/module/useLinking.js +1 -1
  31. package/lib/module/useLinking.js.map +1 -1
  32. package/lib/module/useLinking.native.js.map +1 -1
  33. package/lib/typescript/src/Link.d.ts +12 -6
  34. package/lib/typescript/src/Link.d.ts.map +1 -1
  35. package/lib/typescript/src/Link.native.d.ts +4 -0
  36. package/lib/typescript/src/Link.native.d.ts.map +1 -0
  37. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  38. package/lib/typescript/src/constants.d.ts +4 -0
  39. package/lib/typescript/src/constants.d.ts.map +1 -0
  40. package/lib/typescript/src/constants.native.d.ts +4 -0
  41. package/lib/typescript/src/constants.native.d.ts.map +1 -0
  42. package/lib/typescript/src/index.d.ts +1 -1
  43. package/lib/typescript/src/index.d.ts.map +1 -1
  44. package/lib/typescript/src/native/CornerInset.d.ts +3 -3
  45. package/lib/typescript/src/native/CornerInset.d.ts.map +1 -1
  46. package/lib/typescript/src/native/MaterialSymbol.d.ts +1 -1
  47. package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -1
  48. package/lib/typescript/src/theming/DarkTheme.d.ts +0 -34
  49. package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
  50. package/lib/typescript/src/theming/LightTheme.d.ts +0 -34
  51. package/lib/typescript/src/theming/LightTheme.d.ts.map +1 -1
  52. package/lib/typescript/src/theming/MaterialFallbackTheme.d.ts +0 -68
  53. package/lib/typescript/src/theming/MaterialFallbackTheme.d.ts.map +1 -1
  54. package/lib/typescript/src/theming/MaterialTheme.android.d.ts +0 -136
  55. package/lib/typescript/src/theming/MaterialTheme.android.d.ts.map +1 -1
  56. package/lib/typescript/src/theming/fonts.d.ts +0 -34
  57. package/lib/typescript/src/theming/fonts.d.ts.map +1 -1
  58. package/lib/typescript/src/theming/fonts.native.d.ts +36 -0
  59. package/lib/typescript/src/theming/fonts.native.d.ts.map +1 -0
  60. package/lib/typescript/src/useLinkBuilder.d.ts +30 -30
  61. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
  62. package/lib/typescript/src/useLinkProps.d.ts +1 -1
  63. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  64. package/lib/typescript/src/useLinking.d.ts +3 -39
  65. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  66. package/lib/typescript/src/useLinking.native.d.ts +4 -76
  67. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  68. package/package.json +9 -5
  69. package/src/Link.native.tsx +69 -0
  70. package/src/Link.tsx +102 -34
  71. package/src/NavigationContainer.tsx +3 -4
  72. package/src/constants.native.tsx +10 -0
  73. package/src/constants.tsx +5 -0
  74. package/src/native/CornerInset.tsx +4 -4
  75. package/src/native/MaterialSymbol.tsx +1 -1
  76. package/src/theming/fonts.native.tsx +41 -0
  77. package/src/theming/fonts.tsx +15 -54
  78. package/src/useLinkProps.tsx +6 -5
  79. package/src/useLinking.native.tsx +6 -5
  80. package/src/useLinking.tsx +9 -12
  81. package/lib/module/__stubs__/window.js +0 -78
  82. package/lib/module/__stubs__/window.js.map +0 -1
  83. package/lib/typescript/src/__stubs__/window.d.ts +0 -18
  84. package/lib/typescript/src/__stubs__/window.d.ts.map +0 -1
  85. package/src/__stubs__/window.tsx +0 -82
@@ -1,82 +0,0 @@
1
- let location = new URL('', 'http://example.com');
2
-
3
- let listeners: (() => void)[] = [];
4
- let entries = [{ state: null, href: location.href }];
5
- let index = 0;
6
-
7
- let currentState: any = null;
8
-
9
- const history = {
10
- get state() {
11
- return currentState;
12
- },
13
-
14
- pushState(state: any, _: string, path: string) {
15
- location = new URL(path, location.origin);
16
-
17
- currentState = state;
18
- entries = entries.slice(0, index + 1);
19
- entries.push({ state, href: location.href });
20
- index = entries.length - 1;
21
- },
22
-
23
- replaceState(state: any, _: string, path: string) {
24
- location = new URL(path, location.origin);
25
-
26
- currentState = state;
27
- entries[index] = { state, href: location.href };
28
- },
29
-
30
- go(n: number) {
31
- setTimeout(() => {
32
- if (
33
- (n > 0 && n < entries.length - index) ||
34
- (n < 0 && Math.abs(n) <= index)
35
- ) {
36
- index += n;
37
- const entry = entries[index];
38
-
39
- if (entry == null) {
40
- throw new Error(`Couldn't find a history entry at index ${index}.`);
41
- }
42
-
43
- location = new URL(entry.href);
44
- currentState = entry.state;
45
- listeners.forEach((cb) => cb());
46
- }
47
- }, 0);
48
- },
49
-
50
- back() {
51
- this.go(-1);
52
- },
53
-
54
- forward() {
55
- this.go(1);
56
- },
57
- };
58
-
59
- const addEventListener = (type: 'popstate', listener: () => void) => {
60
- if (type === 'popstate') {
61
- listeners.push(listener);
62
- }
63
- };
64
-
65
- const removeEventListener = (type: 'popstate', listener: () => void) => {
66
- if (type === 'popstate') {
67
- listeners = listeners.filter((cb) => cb !== listener);
68
- }
69
- };
70
-
71
- export const window = {
72
- document: { title: '' },
73
- get location() {
74
- return location;
75
- },
76
- history,
77
- addEventListener,
78
- removeEventListener,
79
- get window() {
80
- return window;
81
- },
82
- };