@tamagui/fake-react-native 2.7.7 → 3.0.0-beta.643.1
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/index.js +33 -0
- package/index.mjs +10 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -18,20 +18,44 @@ const emtpyComponent = () => null
|
|
|
18
18
|
// Mock usePressability for testing - returns empty event handlers
|
|
19
19
|
const usePressabilityMock = () => ({})
|
|
20
20
|
|
|
21
|
+
// real context: consumers (tamagui's useChildren) call React.useContext on it,
|
|
22
|
+
// the proxyWorm fallback object would break that
|
|
23
|
+
const TextAncestorContext = React.createContext(false)
|
|
24
|
+
const Animated = {
|
|
25
|
+
createAnimatedComponent: (Component) => Component,
|
|
26
|
+
}
|
|
27
|
+
const PanResponder = {
|
|
28
|
+
create: (handlers) => ({ panHandlers: handlers }),
|
|
29
|
+
}
|
|
30
|
+
const TurboModuleRegistry = {
|
|
31
|
+
get: () => null,
|
|
32
|
+
}
|
|
33
|
+
const codegenNativeCommands = () => ({})
|
|
34
|
+
const codegenNativeComponent = (name) => createMockComponent(name)
|
|
35
|
+
|
|
21
36
|
function proxyWorm() {
|
|
22
37
|
return new Proxy(
|
|
23
38
|
{
|
|
24
39
|
StyleSheet: {
|
|
25
40
|
create() {},
|
|
26
41
|
},
|
|
42
|
+
unstable_TextAncestorContext: TextAncestorContext,
|
|
27
43
|
Platform: {
|
|
28
44
|
OS: 'web',
|
|
45
|
+
select: (options) => options.web ?? options.default,
|
|
29
46
|
},
|
|
30
47
|
Image: emtpyComponent,
|
|
31
48
|
View: createMockComponent('View'),
|
|
32
49
|
Text: createMockComponent('Text'),
|
|
33
50
|
TextInput: createMockComponent('TextInput'),
|
|
34
51
|
ScrollView: createMockComponent('ScrollView'),
|
|
52
|
+
FlatList: createMockComponent('FlatList'),
|
|
53
|
+
Pressable: createMockComponent('Pressable'),
|
|
54
|
+
Animated,
|
|
55
|
+
NativeModules: {},
|
|
56
|
+
PanResponder,
|
|
57
|
+
TurboModuleRegistry,
|
|
58
|
+
processColor: (color) => color,
|
|
35
59
|
Dimensions: {
|
|
36
60
|
get: () => ({ width: 1024, height: 768 }),
|
|
37
61
|
addEventListener: () => ({ remove: () => {} }),
|
|
@@ -73,5 +97,14 @@ module.exports.View = proxy.View
|
|
|
73
97
|
module.exports.Text = proxy.Text
|
|
74
98
|
module.exports.TextInput = proxy.TextInput
|
|
75
99
|
module.exports.ScrollView = proxy.ScrollView
|
|
100
|
+
module.exports.FlatList = proxy.FlatList
|
|
101
|
+
module.exports.Pressable = proxy.Pressable
|
|
102
|
+
module.exports.Animated = proxy.Animated
|
|
103
|
+
module.exports.NativeModules = proxy.NativeModules
|
|
104
|
+
module.exports.PanResponder = proxy.PanResponder
|
|
105
|
+
module.exports.TurboModuleRegistry = proxy.TurboModuleRegistry
|
|
106
|
+
module.exports.processColor = proxy.processColor
|
|
76
107
|
module.exports.Dimensions = proxy.Dimensions
|
|
77
108
|
module.exports.Appearance = proxy.Appearance
|
|
109
|
+
module.exports.codegenNativeCommands = codegenNativeCommands
|
|
110
|
+
module.exports.codegenNativeComponent = codegenNativeComponent
|
package/index.mjs
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
1
3
|
const emtpyComponent = () => null
|
|
2
4
|
|
|
5
|
+
// real context: consumers (tamagui's useChildren) call React.useContext on it,
|
|
6
|
+
// the proxyWorm fallback object would break that
|
|
7
|
+
const TextAncestorContext = React.createContext(false)
|
|
8
|
+
|
|
3
9
|
function proxyWorm() {
|
|
4
10
|
return new Proxy(
|
|
5
11
|
{
|
|
6
12
|
StyleSheet: {
|
|
7
13
|
create() {},
|
|
8
14
|
},
|
|
15
|
+
unstable_TextAncestorContext: TextAncestorContext,
|
|
9
16
|
Platform: {
|
|
10
17
|
OS: 'web',
|
|
11
18
|
},
|
|
@@ -52,6 +59,9 @@ export const Easing = proxy.Easing
|
|
|
52
59
|
export const Appearance = proxy.Appearance
|
|
53
60
|
export const findNodeHandle = proxy.findNodeHandle
|
|
54
61
|
export const unstable_batchedUpdates = proxy.unstable_batchedUpdates
|
|
62
|
+
export const unstable_TextAncestorContext = proxy.unstable_TextAncestorContext
|
|
63
|
+
export const codegenNativeCommands = () => ({})
|
|
64
|
+
export const codegenNativeComponent = () => emtpyComponent
|
|
55
65
|
|
|
56
66
|
// Default export
|
|
57
67
|
export default proxy
|