@react-native-oh/react-native-harmony 0.72.10

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 (34) hide show
  1. package/Libraries/Alert/Alert.harmony.js +71 -0
  2. package/Libraries/Alert/AlertManager.ts +35 -0
  3. package/Libraries/Animated/NativeAnimatedHelper.harmony.js +601 -0
  4. package/Libraries/Components/Button/Button.harmony.js +451 -0
  5. package/Libraries/Components/RefreshControl/RefreshControl.harmony.js +208 -0
  6. package/Libraries/Components/SafeAreaView/SafeAreaView.harmony.tsx +75 -0
  7. package/Libraries/Components/ScrollView/ScrollView.harmony.js +1940 -0
  8. package/Libraries/Components/ScrollView/processDecelerationRate.harmony.js +24 -0
  9. package/Libraries/Components/StatusBar/NativeStatusBarManagerHarmony.js +68 -0
  10. package/Libraries/Components/StatusBar/StatusBar.harmony.js +447 -0
  11. package/Libraries/Components/TextInput/TextInput.harmony.js +1697 -0
  12. package/Libraries/Components/TextInput/TextInputState.harmony.js +220 -0
  13. package/Libraries/Components/Touchable/TouchableHighlight.harmony.js +396 -0
  14. package/Libraries/Components/Touchable/TouchableNativeFeedback.harmony.js +364 -0
  15. package/Libraries/Components/Touchable/TouchableWithoutFeedback.harmony.js +227 -0
  16. package/Libraries/Components/View/View.harmony.js +149 -0
  17. package/Libraries/Core/setUpErrorHandling.harmony.js +35 -0
  18. package/Libraries/Image/AssetSourceResolver.harmony.ts +32 -0
  19. package/Libraries/NativeComponent/BaseViewConfig.harmony.js +325 -0
  20. package/Libraries/NativeModules/specs/NativeDevSettings.harmony.js +10 -0
  21. package/Libraries/Network/XMLHttpRequest.harmony.js +677 -0
  22. package/Libraries/Settings/Settings.harmony.js +15 -0
  23. package/Libraries/Utilities/BackHandler.harmony.js +109 -0
  24. package/Libraries/Utilities/NativePlatformConstantsHarmony.ts +8 -0
  25. package/Libraries/Utilities/Platform.d.ts +117 -0
  26. package/Libraries/Utilities/Platform.harmony.ts +33 -0
  27. package/Libraries/Utilities/createPerformanceLogger.harmony.js +328 -0
  28. package/index.js +178 -0
  29. package/metro.config.js +190 -0
  30. package/package.json +45 -0
  31. package/react-native.config.js +10 -0
  32. package/rnoh-4.0.0.200.har +0 -0
  33. package/tsconfig.json +13 -0
  34. package/types/index.d.ts +101 -0
@@ -0,0 +1,75 @@
1
+ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2
+ import { TurboModuleRegistry, View, ViewProps } from 'react-native';
3
+ import { useEffect, useState } from 'react';
4
+ import React from 'react';
5
+
6
+ import RCTDeviceEventEmitter from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js';
7
+
8
+ type SafeAreaInsets = {
9
+ top: number;
10
+ left: number;
11
+ right: number;
12
+ bottom: number;
13
+ };
14
+
15
+ interface SafeAreaTurboModuleProtocol {
16
+ getInitialInsets(): SafeAreaInsets;
17
+ }
18
+
19
+ interface Spec extends TurboModule, SafeAreaTurboModuleProtocol {}
20
+
21
+ const safeAreaTurboModule = TurboModuleRegistry.get<Spec>(
22
+ 'SafeAreaTurboModule'
23
+ )!;
24
+
25
+ export default React.forwardRef<View, ViewProps>(
26
+ ({ children, ...otherProps }, ref) => {
27
+ const [topInset, setTopInset] = useState(
28
+ safeAreaTurboModule.getInitialInsets().top
29
+ );
30
+ const [leftInset, setLeftInset] = useState(
31
+ safeAreaTurboModule.getInitialInsets().left
32
+ );
33
+ const [rightInset, setRightInset] = useState(
34
+ safeAreaTurboModule.getInitialInsets().right
35
+ );
36
+ const [bottomInset, setBottomInset] = useState(
37
+ safeAreaTurboModule.getInitialInsets().bottom
38
+ );
39
+
40
+ useEffect(
41
+ function subscribeToSafeAreaChanges() {
42
+ const subscription = (RCTDeviceEventEmitter as any).addListener(
43
+ 'SAFE_AREA_INSETS_CHANGE',
44
+ (insets: SafeAreaInsets) => {
45
+ setTopInset(insets.top);
46
+ setBottomInset(insets.bottom);
47
+ setLeftInset(insets.left);
48
+ setRightInset(insets.right);
49
+ }
50
+ );
51
+ return () => {
52
+ subscription.remove();
53
+ };
54
+ },
55
+ [setTopInset, setLeftInset, setRightInset, setBottomInset]
56
+ );
57
+
58
+ return (
59
+ <View ref={ref} {...otherProps}>
60
+ <View
61
+ style={{
62
+ width: '100%',
63
+ height: '100%',
64
+ paddingTop: topInset,
65
+ paddingLeft: leftInset,
66
+ paddingRight: rightInset,
67
+ paddingBottom: bottomInset,
68
+ }}
69
+ >
70
+ {children}
71
+ </View>
72
+ </View>
73
+ );
74
+ }
75
+ );