@office-iss/react-native-win32 0.71.4 → 0.72.0-preview.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/.flowconfig +15 -3
- package/CHANGELOG.json +310 -40
- package/CHANGELOG.md +145 -23
- package/IntegrationTests/IntegrationTestHarnessTest.js +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
- package/Libraries/Alert/Alert.d.ts +4 -4
- package/Libraries/Alert/Alert.win32.js +1 -0
- package/Libraries/Animated/Animated.d.ts +17 -6
- package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +606 -0
- package/Libraries/Animated/bezier.js +1 -1
- package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
- package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
- package/Libraries/Animated/createAnimatedComponent.js +26 -239
- package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
- package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
- package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +7 -10
- package/Libraries/BatchedBridge/MessageQueue.js +2 -1
- package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
- package/Libraries/BatchedBridge/NativeModules.js +1 -0
- package/Libraries/Blob/Blob.js +4 -0
- package/Libraries/Blob/FileReader.js +30 -2
- package/Libraries/Blob/URL.js +3 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -3
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
- package/Libraries/Components/Button.js +3 -2
- package/Libraries/Components/Button.win32.js +451 -0
- package/Libraries/Components/Clipboard/Clipboard.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
- package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
- package/Libraries/Components/Pressable/Pressable.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -2
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
- package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +149 -91
- package/Libraries/Components/ScrollView/ScrollView.win32.js +1939 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -0
- package/Libraries/Components/Switch/Switch.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
- package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +51 -0
- package/Libraries/Components/TextInput/TextInput.Types.win32.js +3 -0
- package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
- package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
- package/Libraries/Components/TextInput/TextInput.js +130 -103
- package/Libraries/Components/TextInput/TextInput.win32.js +202 -890
- package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
- package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
- package/Libraries/Components/Touchable/Touchable.js +6 -3
- package/Libraries/Components/Touchable/Touchable.win32.js +6 -3
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +189 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
- package/Libraries/Components/View/View.js +71 -45
- package/Libraries/Components/View/View.win32.js +38 -16
- package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
- package/Libraries/Components/View/ViewAccessibility.js +10 -1
- package/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
- package/Libraries/Components/View/ViewNativeComponent.js +32 -8
- package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
- package/Libraries/Components/View/ViewPropTypes.js +1 -1
- package/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
- package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
- package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
- package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
- package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/InitializeCore.js +2 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +1 -9
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -9
- package/Libraries/Core/Timers/JSTimers.js +1 -1
- package/Libraries/Core/Timers/immediateShim.js +1 -0
- package/Libraries/Core/Timers/queueMicrotask.js +1 -1
- package/Libraries/Core/setUpAlert.js +1 -1
- package/Libraries/Core/setUpDOM.js +18 -0
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpGlobals.js +5 -2
- package/Libraries/Core/setUpNavigator.js +6 -5
- package/Libraries/Core/setUpPerformance.js +23 -13
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Core/setUpSegmentFetcher.js +0 -41
- package/Libraries/Core/setUpTimers.js +2 -2
- package/Libraries/DOM/Geometry/DOMRect.js +82 -0
- package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
- package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
- package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
- package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
- package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
- package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +35 -0
- package/Libraries/{Utilities/NativeDevSplitBundleLoader.js → DevToolsSettings/NativeDevToolsSettingsManager.js} +7 -2
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
- package/Libraries/Events/EventPolyfill.js +1 -1
- package/Libraries/Image/AssetRegistry.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +3 -3
- package/Libraries/Image/Image.android.js +4 -1
- package/Libraries/Image/Image.d.ts +63 -2
- package/Libraries/Image/Image.ios.js +3 -0
- package/Libraries/Image/Image.win32.js +3 -0
- package/Libraries/Image/ImageBackground.js +1 -0
- package/Libraries/Image/ImageProps.js +1 -1
- package/Libraries/Image/ImageViewNativeComponent.js +4 -4
- package/Libraries/Image/RelativeImageStub.js +1 -1
- package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Inspector/DevtoolsOverlay.js +29 -19
- package/Libraries/Inspector/ElementBox.js +4 -1
- package/Libraries/Inspector/Inspector.js +5 -6
- package/Libraries/Inspector/Inspector.win32.js +7 -6
- package/Libraries/Inspector/InspectorOverlay.js +3 -3
- package/Libraries/Inspector/InspectorOverlay.win32.js +2 -1
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
- package/Libraries/Interaction/PanResponder.js +5 -6
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
- package/Libraries/Linking/Linking.js +1 -4
- package/Libraries/Lists/FillRateHelper.js +4 -238
- package/Libraries/Lists/FlatList.d.ts +15 -22
- package/Libraries/Lists/FlatList.js +9 -6
- package/Libraries/Lists/SectionList.d.ts +10 -6
- package/Libraries/Lists/SectionList.js +5 -3
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/Lists/ViewabilityHelper.js +8 -344
- package/Libraries/Lists/VirtualizeUtils.js +4 -244
- package/Libraries/Lists/VirtualizedList.js +10 -1867
- package/Libraries/Lists/VirtualizedListContext.js +6 -104
- package/Libraries/Lists/VirtualizedSectionList.js +9 -602
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +193 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +7 -3
- package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
- package/Libraries/Modal/Modal.js +2 -2
- package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +43 -19
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
- package/Libraries/NativeComponent/ViewConfig.js +1 -0
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
- package/Libraries/Network/RCTNetworking.android.js +2 -2
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/Pressability/Pressability.js +11 -5
- package/Libraries/Pressability/Pressability.win32.js +9 -3
- package/Libraries/ReactNative/AppContainer.js +7 -1
- package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
- package/Libraries/ReactNative/AppRegistry.js +10 -13
- package/Libraries/ReactNative/FabricUIManager.js +24 -8
- package/Libraries/ReactNative/NativeUIManager.js +5 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
- package/Libraries/ReactNative/UIManager.js +142 -1
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
- package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
- package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +38 -20
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
- package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
- package/Libraries/StyleSheet/flattenStyle.js +2 -0
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processColor.js +1 -1
- package/Libraries/Text/Text.d.ts +12 -2
- package/Libraries/Text/Text.js +50 -41
- package/Libraries/Text/TextProps.js +3 -4
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/Types/CodegenTypes.js +1 -0
- package/Libraries/UTFSequence.js +3 -1
- package/Libraries/Utilities/Appearance.d.ts +10 -0
- package/Libraries/Utilities/Appearance.js +13 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
- package/Libraries/Utilities/HMRClient.js +16 -10
- package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
- package/Libraries/Utilities/IPerformanceLogger.js +49 -0
- package/Libraries/Utilities/LoadingView.android.js +28 -11
- package/Libraries/Utilities/NativeAppearance.js +1 -0
- package/Libraries/Utilities/NativePlatformConstantsWin.js +1 -1
- package/Libraries/Utilities/PixelRatio.js +2 -2
- package/Libraries/Utilities/Platform.win32.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +2 -0
- package/Libraries/Utilities/createPerformanceLogger.js +55 -43
- package/Libraries/Utilities/stringifySafe.js +2 -7
- package/Libraries/Utilities/useColorScheme.js +1 -1
- package/Libraries/Utilities/useWindowDimensions.js +3 -3
- package/Libraries/WebPerformance/EventCounts.js +78 -0
- package/Libraries/WebPerformance/MemoryInfo.js +54 -0
- package/Libraries/WebPerformance/NativePerformance.js +38 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
- package/Libraries/WebPerformance/Performance.js +312 -0
- package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
- package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
- package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
- package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
- package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
- package/Libraries/vendor/core/ErrorUtils.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
- package/Libraries/vendor/emitter/EventEmitter.js +9 -1
- package/flow/global.js +29 -4
- package/flow/jest.js +258 -164
- package/index.js +56 -42
- package/index.win32.js +56 -42
- package/interface.js +1 -1
- package/jest/local-setup.js +33 -0
- package/jest/mockComponent.js +4 -2
- package/jest/mockNativeComponent.js +1 -1
- package/jest/mockScrollView.js +2 -1
- package/jest/react-native-env.js +1 -3
- package/jest/setup.js +11 -8
- package/overrides.json +115 -85
- package/package.json +38 -28
- package/rn-get-polyfills.js +1 -1
- package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +68 -0
- package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
- package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
- package/types/index.d.ts +2 -6
- package/types/modules/Codegen.d.ts +4 -4
- package/types/modules/globals.d.ts +27 -25
- package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
- package/types/public/ReactNativeRenderer.d.ts +2 -7
- package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
- package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
- package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
- package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
- package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
- package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -47
- package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
- package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -45
- package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
- package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
- package/Libraries/Components/Slider/Slider.d.ts +0 -132
- package/Libraries/Components/Slider/Slider.js +0 -282
- package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +0 -23
- package/Libraries/Interaction/Batchinator.js +0 -76
- package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
- package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
- package/Libraries/Interaction/PanResponder.flow.js +0 -257
- package/Libraries/Lists/CellRenderMask.js +0 -155
- package/Libraries/Lists/ChildListCollection.js +0 -72
- package/Libraries/Lists/StateSafePureComponent.js +0 -85
- package/Libraries/Lists/VirtualizedList.d.ts +0 -347
- package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
- package/Libraries/Lists/VirtualizedListProps.js +0 -279
- package/Libraries/Performance/PureComponentDebug.js +0 -74
- package/Libraries/Reliability/UserFlow.js +0 -158
- package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
- package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
- package/Libraries/Utilities/MatrixMath.js +0 -748
- package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
- package/Libraries/Utilities/clamp.js +0 -23
- package/Libraries/Utilities/deprecatedPropType.js +0 -36
- package/Libraries/Utilities/groupByEveryN.js +0 -51
- package/Libraries/Utilities/mergeIntoFast.js +0 -26
- package/Libraries/Utilities/setAndForwardRef.js +0 -71
- package/Libraries/Utilities/truncate.js +0 -51
- package/flow/JSITimerInternalType.js +0 -30
- package/flow/use-sync-external-store.js +0 -19
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {ImageSource} from '../../Image/ImageSource';
|
|
12
|
-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
13
|
-
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
14
|
-
import type {
|
|
15
|
-
BubblingEventHandler,
|
|
16
|
-
DirectEventHandler,
|
|
17
|
-
Double,
|
|
18
|
-
WithDefault,
|
|
19
|
-
} from '../../Types/CodegenTypes';
|
|
20
|
-
import type {ViewProps} from '../View/ViewPropTypes';
|
|
21
|
-
|
|
22
|
-
import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
|
|
23
|
-
|
|
24
|
-
type Event = $ReadOnly<{|
|
|
25
|
-
value: Double,
|
|
26
|
-
fromUser?: boolean,
|
|
27
|
-
|}>;
|
|
28
|
-
|
|
29
|
-
type NativeProps = $ReadOnly<{|
|
|
30
|
-
...ViewProps,
|
|
31
|
-
|
|
32
|
-
// Props
|
|
33
|
-
disabled?: WithDefault<boolean, false>,
|
|
34
|
-
enabled?: WithDefault<boolean, true>,
|
|
35
|
-
maximumTrackImage?: ?ImageSource,
|
|
36
|
-
maximumTrackTintColor?: ?ColorValue,
|
|
37
|
-
maximumValue?: WithDefault<Double, 1>,
|
|
38
|
-
minimumTrackImage?: ?ImageSource,
|
|
39
|
-
minimumTrackTintColor?: ?ColorValue,
|
|
40
|
-
minimumValue?: WithDefault<Double, 0>,
|
|
41
|
-
step?: WithDefault<Double, 0>,
|
|
42
|
-
testID?: WithDefault<string, ''>,
|
|
43
|
-
thumbImage?: ?ImageSource,
|
|
44
|
-
thumbTintColor?: ?ColorValue,
|
|
45
|
-
trackImage?: ?ImageSource,
|
|
46
|
-
value?: WithDefault<Double, 0>,
|
|
47
|
-
|
|
48
|
-
// Events
|
|
49
|
-
onValueChange?: ?BubblingEventHandler<Event>,
|
|
50
|
-
onSlidingComplete?: ?DirectEventHandler<Event>,
|
|
51
|
-
|}>;
|
|
52
|
-
|
|
53
|
-
export default (codegenNativeComponent<NativeProps>('Slider', {
|
|
54
|
-
interfaceOnly: true,
|
|
55
|
-
paperComponentName: 'RCTSlider',
|
|
56
|
-
}): HostComponent<NativeProps>);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @flow
|
|
3
|
-
* @format
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
7
|
-
|
|
8
|
-
import requireNativeComponent from '../../ReactNative/requireNativeComponent';
|
|
9
|
-
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
|
10
|
-
import type {TextInputNativeCommands} from './TextInputNativeCommands';
|
|
11
|
-
type NativeType = HostComponent<mixed>;
|
|
12
|
-
|
|
13
|
-
type NativeCommands = TextInputNativeCommands<NativeType>;
|
|
14
|
-
|
|
15
|
-
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
16
|
-
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const WindowsTextInputComponent: NativeType =
|
|
20
|
-
requireNativeComponent<mixed>('RCTTextInput');
|
|
21
|
-
|
|
22
|
-
export default WindowsTextInputComponent;
|
|
23
|
-
// [Windows]
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
const InteractionManager = require('./InteractionManager');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A simple class for batching up invocations of a low-pri callback. A timeout is set to run the
|
|
17
|
-
* callback once after a delay, no matter how many times it's scheduled. Once the delay is reached,
|
|
18
|
-
* InteractionManager.runAfterInteractions is used to invoke the callback after any hi-pri
|
|
19
|
-
* interactions are done running.
|
|
20
|
-
*
|
|
21
|
-
* Make sure to cleanup with dispose(). Example:
|
|
22
|
-
*
|
|
23
|
-
* class Widget extends React.Component {
|
|
24
|
-
* _batchedSave: new Batchinator(() => this._saveState, 1000);
|
|
25
|
-
* _saveSate() {
|
|
26
|
-
* // save this.state to disk
|
|
27
|
-
* }
|
|
28
|
-
* componentDidUpdate() {
|
|
29
|
-
* this._batchedSave.schedule();
|
|
30
|
-
* }
|
|
31
|
-
* componentWillUnmount() {
|
|
32
|
-
* this._batchedSave.dispose();
|
|
33
|
-
* }
|
|
34
|
-
* ...
|
|
35
|
-
* }
|
|
36
|
-
*/
|
|
37
|
-
class Batchinator {
|
|
38
|
-
_callback: () => void;
|
|
39
|
-
_delay: number;
|
|
40
|
-
_taskHandle: ?{cancel: () => void, ...};
|
|
41
|
-
constructor(callback: () => void, delayMS: number) {
|
|
42
|
-
this._delay = delayMS;
|
|
43
|
-
this._callback = callback;
|
|
44
|
-
}
|
|
45
|
-
/*
|
|
46
|
-
* Cleanup any pending tasks.
|
|
47
|
-
*
|
|
48
|
-
* By default, if there is a pending task the callback is run immediately. Set the option abort to
|
|
49
|
-
* true to not call the callback if it was pending.
|
|
50
|
-
*/
|
|
51
|
-
dispose(options: {abort: boolean, ...} = {abort: false}) {
|
|
52
|
-
if (this._taskHandle) {
|
|
53
|
-
this._taskHandle.cancel();
|
|
54
|
-
if (!options.abort) {
|
|
55
|
-
this._callback();
|
|
56
|
-
}
|
|
57
|
-
this._taskHandle = null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
schedule() {
|
|
61
|
-
if (this._taskHandle) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const timeoutHandle = setTimeout(() => {
|
|
65
|
-
this._taskHandle = InteractionManager.runAfterInteractions(() => {
|
|
66
|
-
// Note that we clear the handle before invoking the callback so that if the callback calls
|
|
67
|
-
// schedule again, it will actually schedule another task.
|
|
68
|
-
this._taskHandle = null;
|
|
69
|
-
this._callback();
|
|
70
|
-
});
|
|
71
|
-
}, this._delay);
|
|
72
|
-
this._taskHandle = {cancel: () => clearTimeout(timeoutHandle)};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
module.exports = Batchinator;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @format
|
|
8
|
-
* @flow
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
import type {SpyData} from '../BatchedBridge/MessageQueue';
|
|
14
|
-
|
|
15
|
-
const MessageQueue = require('../BatchedBridge/MessageQueue');
|
|
16
|
-
const infoLog = require('../Utilities/infoLog');
|
|
17
|
-
const JSEventLoopWatchdog = require('./JSEventLoopWatchdog');
|
|
18
|
-
|
|
19
|
-
const BridgeSpyStallHandler = {
|
|
20
|
-
register: function () {
|
|
21
|
-
let spyBuffer: Array<SpyData> = [];
|
|
22
|
-
MessageQueue.spy(data => {
|
|
23
|
-
spyBuffer.push(data);
|
|
24
|
-
});
|
|
25
|
-
const TO_JS = 0;
|
|
26
|
-
JSEventLoopWatchdog.addHandler({
|
|
27
|
-
onStall: () => {
|
|
28
|
-
infoLog(
|
|
29
|
-
spyBuffer.length + ' bridge messages during stall: ',
|
|
30
|
-
spyBuffer.map(info => {
|
|
31
|
-
let args: string | Array<?string> = '<args>';
|
|
32
|
-
try {
|
|
33
|
-
args = JSON.stringify(info.args);
|
|
34
|
-
} catch (e1) {
|
|
35
|
-
if (Array.isArray(info.args)) {
|
|
36
|
-
args = info.args.map(arg => {
|
|
37
|
-
try {
|
|
38
|
-
return JSON.stringify(arg);
|
|
39
|
-
} catch (e2) {
|
|
40
|
-
return '?';
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
args = 'keys:' + JSON.stringify(Object.keys(info.args));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return (
|
|
48
|
-
`${info.type === TO_JS ? 'N->JS' : 'JS->N'} : ` +
|
|
49
|
-
`${info.module ? info.module + '.' : ''}${
|
|
50
|
-
info.method
|
|
51
|
-
}(${JSON.stringify(args)})`
|
|
52
|
-
);
|
|
53
|
-
}),
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
onIterate: () => {
|
|
57
|
-
spyBuffer = [];
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
module.exports = BridgeSpyStallHandler;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
const BridgeSpyStallHandler = require('./BridgeSpyStallHandler');
|
|
14
|
-
const JSEventLoopWatchdog = require('./JSEventLoopWatchdog');
|
|
15
|
-
|
|
16
|
-
const InteractionStallDebugger = {
|
|
17
|
-
install(options: {thresholdMS: number, ...}): void {
|
|
18
|
-
JSEventLoopWatchdog.install(options);
|
|
19
|
-
BridgeSpyStallHandler.register();
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
module.exports = InteractionStallDebugger;
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @flow
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `PanResponder` reconciles several touches into a single gesture. It makes
|
|
17
|
-
* single-touch gestures resilient to extra touches, and can be used to
|
|
18
|
-
* recognize simple multi-touch gestures.
|
|
19
|
-
*
|
|
20
|
-
* By default, `PanResponder` holds an `InteractionManager` handle to block
|
|
21
|
-
* long-running JS events from interrupting active gestures.
|
|
22
|
-
*
|
|
23
|
-
* It provides a predictable wrapper of the responder handlers provided by the
|
|
24
|
-
* [gesture responder system](docs/gesture-responder-system.html).
|
|
25
|
-
* For each handler, it provides a new `gestureState` object alongside the
|
|
26
|
-
* native event object:
|
|
27
|
-
*
|
|
28
|
-
* ```
|
|
29
|
-
* onPanResponderMove: (event, gestureState) => {}
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* A native event is a synthetic touch event with the following form:
|
|
33
|
-
*
|
|
34
|
-
* - `nativeEvent`
|
|
35
|
-
* + `changedTouches` - Array of all touch events that have changed since the last event
|
|
36
|
-
* + `identifier` - The ID of the touch
|
|
37
|
-
* + `locationX` - The X position of the touch, relative to the element
|
|
38
|
-
* + `locationY` - The Y position of the touch, relative to the element
|
|
39
|
-
* + `pageX` - The X position of the touch, relative to the root element
|
|
40
|
-
* + `pageY` - The Y position of the touch, relative to the root element
|
|
41
|
-
* + `target` - The node id of the element receiving the touch event
|
|
42
|
-
* + `timestamp` - A time identifier for the touch, useful for velocity calculation
|
|
43
|
-
* + `touches` - Array of all current touches on the screen
|
|
44
|
-
*
|
|
45
|
-
* A `gestureState` object has the following:
|
|
46
|
-
*
|
|
47
|
-
* - `stateID` - ID of the gestureState- persisted as long as there at least
|
|
48
|
-
* one touch on screen
|
|
49
|
-
* - `moveX` - the latest screen coordinates of the recently-moved touch
|
|
50
|
-
* - `moveY` - the latest screen coordinates of the recently-moved touch
|
|
51
|
-
* - `x0` - the screen coordinates of the responder grant
|
|
52
|
-
* - `y0` - the screen coordinates of the responder grant
|
|
53
|
-
* - `dx` - accumulated distance of the gesture since the touch started
|
|
54
|
-
* - `dy` - accumulated distance of the gesture since the touch started
|
|
55
|
-
* - `vx` - current velocity of the gesture
|
|
56
|
-
* - `vy` - current velocity of the gesture
|
|
57
|
-
* - `numberActiveTouches` - Number of touches currently on screen
|
|
58
|
-
*
|
|
59
|
-
* ### Basic Usage
|
|
60
|
-
*
|
|
61
|
-
* ```
|
|
62
|
-
* componentWillMount: function() {
|
|
63
|
-
* this._panResponder = PanResponder.create({
|
|
64
|
-
* // Ask to be the responder:
|
|
65
|
-
* onStartShouldSetPanResponder: (evt, gestureState) => true,
|
|
66
|
-
* onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
|
|
67
|
-
* onMoveShouldSetPanResponder: (evt, gestureState) => true,
|
|
68
|
-
* onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,
|
|
69
|
-
*
|
|
70
|
-
* onPanResponderGrant: (evt, gestureState) => {
|
|
71
|
-
* // The gesture has started. Show visual feedback so the user knows
|
|
72
|
-
* // what is happening!
|
|
73
|
-
*
|
|
74
|
-
* // gestureState.d{x,y} will be set to zero now
|
|
75
|
-
* },
|
|
76
|
-
* onPanResponderMove: (evt, gestureState) => {
|
|
77
|
-
* // The most recent move distance is gestureState.move{X,Y}
|
|
78
|
-
*
|
|
79
|
-
* // The accumulated gesture distance since becoming responder is
|
|
80
|
-
* // gestureState.d{x,y}
|
|
81
|
-
* },
|
|
82
|
-
* onPanResponderTerminationRequest: (evt, gestureState) => true,
|
|
83
|
-
* onPanResponderRelease: (evt, gestureState) => {
|
|
84
|
-
* // The user has released all touches while this view is the
|
|
85
|
-
* // responder. This typically means a gesture has succeeded
|
|
86
|
-
* },
|
|
87
|
-
* onPanResponderTerminate: (evt, gestureState) => {
|
|
88
|
-
* // Another component has become the responder, so this gesture
|
|
89
|
-
* // should be cancelled
|
|
90
|
-
* },
|
|
91
|
-
* onShouldBlockNativeResponder: (evt, gestureState) => {
|
|
92
|
-
* // Returns whether this component should block native components from becoming the JS
|
|
93
|
-
* // responder. Returns true by default. Is currently only supported on android.
|
|
94
|
-
* return true;
|
|
95
|
-
* },
|
|
96
|
-
* });
|
|
97
|
-
* },
|
|
98
|
-
*
|
|
99
|
-
* render: function() {
|
|
100
|
-
* return (
|
|
101
|
-
* <View {...this._panResponder.panHandlers} />
|
|
102
|
-
* );
|
|
103
|
-
* },
|
|
104
|
-
*
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* ### Working Example
|
|
108
|
-
*
|
|
109
|
-
* To see it in action, try the
|
|
110
|
-
* [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/HEAD/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js)
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
export type GestureState = {|
|
|
114
|
-
/**
|
|
115
|
-
* ID of the gestureState - persisted as long as there at least one touch on screen
|
|
116
|
-
*/
|
|
117
|
-
stateID: number,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* The latest screen coordinates of the recently-moved touch
|
|
121
|
-
*/
|
|
122
|
-
moveX: number,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* The latest screen coordinates of the recently-moved touch
|
|
126
|
-
*/
|
|
127
|
-
moveY: number,
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The screen coordinates of the responder grant
|
|
131
|
-
*/
|
|
132
|
-
x0: number,
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The screen coordinates of the responder grant
|
|
136
|
-
*/
|
|
137
|
-
y0: number,
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Accumulated distance of the gesture since the touch started
|
|
141
|
-
*/
|
|
142
|
-
dx: number,
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Accumulated distance of the gesture since the touch started
|
|
146
|
-
*/
|
|
147
|
-
dy: number,
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Current velocity of the gesture
|
|
151
|
-
*/
|
|
152
|
-
vx: number,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Current velocity of the gesture
|
|
156
|
-
*/
|
|
157
|
-
vy: number,
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Number of touches currently on screen
|
|
161
|
-
*/
|
|
162
|
-
numberActiveTouches: number,
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* All `gestureState` accounts for timeStamps up until this value
|
|
166
|
-
*
|
|
167
|
-
* @private
|
|
168
|
-
*/
|
|
169
|
-
_accountsForMovesUpTo: number,
|
|
170
|
-
|};
|
|
171
|
-
|
|
172
|
-
type ActiveCallback = (
|
|
173
|
-
event: PressEvent,
|
|
174
|
-
gestureState: GestureState,
|
|
175
|
-
) => boolean;
|
|
176
|
-
|
|
177
|
-
type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
|
|
178
|
-
|
|
179
|
-
type PanHandlers = {|
|
|
180
|
-
onMoveShouldSetResponder: (event: PressEvent) => boolean,
|
|
181
|
-
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
182
|
-
onResponderEnd: (event: PressEvent) => void,
|
|
183
|
-
onResponderGrant: (event: PressEvent) => boolean,
|
|
184
|
-
onResponderMove: (event: PressEvent) => void,
|
|
185
|
-
onResponderReject: (event: PressEvent) => void,
|
|
186
|
-
onResponderRelease: (event: PressEvent) => void,
|
|
187
|
-
onResponderStart: (event: PressEvent) => void,
|
|
188
|
-
onResponderTerminate: (event: PressEvent) => void,
|
|
189
|
-
onResponderTerminationRequest: (event: PressEvent) => boolean,
|
|
190
|
-
onStartShouldSetResponder: (event: PressEvent) => boolean,
|
|
191
|
-
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
192
|
-
|};
|
|
193
|
-
|
|
194
|
-
type PanResponderConfig = $ReadOnly<{|
|
|
195
|
-
onMoveShouldSetPanResponder?: ?ActiveCallback,
|
|
196
|
-
onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
|
|
197
|
-
onStartShouldSetPanResponder?: ?ActiveCallback,
|
|
198
|
-
onStartShouldSetPanResponderCapture?: ?ActiveCallback,
|
|
199
|
-
/**
|
|
200
|
-
* The body of `onResponderGrant` returns a bool, but the vast majority of
|
|
201
|
-
* callsites return void and this TODO notice is found in it:
|
|
202
|
-
* TODO: t7467124 investigate if this can be removed
|
|
203
|
-
*/
|
|
204
|
-
onPanResponderGrant?: ?(PassiveCallback | ActiveCallback),
|
|
205
|
-
onPanResponderReject?: ?PassiveCallback,
|
|
206
|
-
onPanResponderStart?: ?PassiveCallback,
|
|
207
|
-
onPanResponderEnd?: ?PassiveCallback,
|
|
208
|
-
onPanResponderRelease?: ?PassiveCallback,
|
|
209
|
-
onPanResponderMove?: ?PassiveCallback,
|
|
210
|
-
onPanResponderTerminate?: ?PassiveCallback,
|
|
211
|
-
onPanResponderTerminationRequest?: ?ActiveCallback,
|
|
212
|
-
onShouldBlockNativeResponder?: ?ActiveCallback,
|
|
213
|
-
|}>;
|
|
214
|
-
|
|
215
|
-
export type PanResponderType = {
|
|
216
|
-
_initializeGestureState: (gestureState: GestureState) => void,
|
|
217
|
-
_updateGestureStateOnMove: (
|
|
218
|
-
gestureState: GestureState,
|
|
219
|
-
touchHistory: $PropertyType<PressEvent, 'touchHistory'>,
|
|
220
|
-
) => void,
|
|
221
|
-
/**
|
|
222
|
-
* @param {object} config Enhanced versions of all of the responder callbacks
|
|
223
|
-
* that provide not only the typical `ResponderSyntheticEvent`, but also the
|
|
224
|
-
* `PanResponder` gesture state. Simply replace the word `Responder` with
|
|
225
|
-
* `PanResponder` in each of the typical `onResponder*` callbacks. For
|
|
226
|
-
* example, the `config` object would look like:
|
|
227
|
-
*
|
|
228
|
-
* - `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
|
|
229
|
-
* - `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
|
|
230
|
-
* - `onStartShouldSetPanResponder: (e, gestureState) => {...}`
|
|
231
|
-
* - `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
|
|
232
|
-
* - `onPanResponderReject: (e, gestureState) => {...}`
|
|
233
|
-
* - `onPanResponderGrant: (e, gestureState) => {...}`
|
|
234
|
-
* - `onPanResponderStart: (e, gestureState) => {...}`
|
|
235
|
-
* - `onPanResponderEnd: (e, gestureState) => {...}`
|
|
236
|
-
* - `onPanResponderRelease: (e, gestureState) => {...}`
|
|
237
|
-
* - `onPanResponderMove: (e, gestureState) => {...}`
|
|
238
|
-
* - `onPanResponderTerminate: (e, gestureState) => {...}`
|
|
239
|
-
* - `onPanResponderTerminationRequest: (e, gestureState) => {...}`
|
|
240
|
-
* - `onShouldBlockNativeResponder: (e, gestureState) => {...}`
|
|
241
|
-
*
|
|
242
|
-
* In general, for events that have capture equivalents, we update the
|
|
243
|
-
* gestureState once in the capture phase and can use it in the bubble phase
|
|
244
|
-
* as well.
|
|
245
|
-
*
|
|
246
|
-
* Be careful with onStartShould* callbacks. They only reflect updated
|
|
247
|
-
* `gestureState` for start/end events that bubble/capture to the Node.
|
|
248
|
-
* Once the node is the responder, you can rely on every start/end event
|
|
249
|
-
* being processed by the gesture and `gestureState` being updated
|
|
250
|
-
* accordingly. (numberActiveTouches) may not be totally accurate unless you
|
|
251
|
-
* are the responder.
|
|
252
|
-
*/
|
|
253
|
-
create: (config: PanResponderConfig) => {
|
|
254
|
-
getInteractionHandle: () => ?number,
|
|
255
|
-
panHandlers: PanHandlers,
|
|
256
|
-
},
|
|
257
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @flow strict
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import invariant from 'invariant';
|
|
12
|
-
|
|
13
|
-
export type CellRegion = {
|
|
14
|
-
first: number,
|
|
15
|
-
last: number,
|
|
16
|
-
isSpacer: boolean,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class CellRenderMask {
|
|
20
|
-
_numCells: number;
|
|
21
|
-
_regions: Array<CellRegion>;
|
|
22
|
-
|
|
23
|
-
constructor(numCells: number) {
|
|
24
|
-
invariant(
|
|
25
|
-
numCells >= 0,
|
|
26
|
-
'CellRenderMask must contain a non-negative number os cells',
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
this._numCells = numCells;
|
|
30
|
-
|
|
31
|
-
if (numCells === 0) {
|
|
32
|
-
this._regions = [];
|
|
33
|
-
} else {
|
|
34
|
-
this._regions = [
|
|
35
|
-
{
|
|
36
|
-
first: 0,
|
|
37
|
-
last: numCells - 1,
|
|
38
|
-
isSpacer: true,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
enumerateRegions(): $ReadOnlyArray<CellRegion> {
|
|
45
|
-
return this._regions;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
addCells(cells: {first: number, last: number}): void {
|
|
49
|
-
invariant(
|
|
50
|
-
cells.first >= 0 &&
|
|
51
|
-
cells.first < this._numCells &&
|
|
52
|
-
cells.last >= -1 &&
|
|
53
|
-
cells.last < this._numCells &&
|
|
54
|
-
cells.last >= cells.first - 1,
|
|
55
|
-
'CellRenderMask.addCells called with invalid cell range',
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
// VirtualizedList uses inclusive ranges, where zero-count states are
|
|
59
|
-
// possible. E.g. [0, -1] for no cells, starting at 0.
|
|
60
|
-
if (cells.last < cells.first) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const [firstIntersect, firstIntersectIdx] = this._findRegion(cells.first);
|
|
65
|
-
const [lastIntersect, lastIntersectIdx] = this._findRegion(cells.last);
|
|
66
|
-
|
|
67
|
-
// Fast-path if the cells to add are already all present in the mask. We
|
|
68
|
-
// will otherwise need to do some mutation.
|
|
69
|
-
if (firstIntersectIdx === lastIntersectIdx && !firstIntersect.isSpacer) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// We need to replace the existing covered regions with 1-3 new regions
|
|
74
|
-
// depending whether we need to split spacers out of overlapping regions.
|
|
75
|
-
const newLeadRegion: Array<CellRegion> = [];
|
|
76
|
-
const newTailRegion: Array<CellRegion> = [];
|
|
77
|
-
const newMainRegion: CellRegion = {
|
|
78
|
-
...cells,
|
|
79
|
-
isSpacer: false,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
if (firstIntersect.first < newMainRegion.first) {
|
|
83
|
-
if (firstIntersect.isSpacer) {
|
|
84
|
-
newLeadRegion.push({
|
|
85
|
-
first: firstIntersect.first,
|
|
86
|
-
last: newMainRegion.first - 1,
|
|
87
|
-
isSpacer: true,
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
newMainRegion.first = firstIntersect.first;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (lastIntersect.last > newMainRegion.last) {
|
|
95
|
-
if (lastIntersect.isSpacer) {
|
|
96
|
-
newTailRegion.push({
|
|
97
|
-
first: newMainRegion.last + 1,
|
|
98
|
-
last: lastIntersect.last,
|
|
99
|
-
isSpacer: true,
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
newMainRegion.last = lastIntersect.last;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const replacementRegions: Array<CellRegion> = [
|
|
107
|
-
...newLeadRegion,
|
|
108
|
-
newMainRegion,
|
|
109
|
-
...newTailRegion,
|
|
110
|
-
];
|
|
111
|
-
const numRegionsToDelete = lastIntersectIdx - firstIntersectIdx + 1;
|
|
112
|
-
this._regions.splice(
|
|
113
|
-
firstIntersectIdx,
|
|
114
|
-
numRegionsToDelete,
|
|
115
|
-
...replacementRegions,
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
numCells(): number {
|
|
120
|
-
return this._numCells;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
equals(other: CellRenderMask): boolean {
|
|
124
|
-
return (
|
|
125
|
-
this._numCells === other._numCells &&
|
|
126
|
-
this._regions.length === other._regions.length &&
|
|
127
|
-
this._regions.every(
|
|
128
|
-
(region, i) =>
|
|
129
|
-
region.first === other._regions[i].first &&
|
|
130
|
-
region.last === other._regions[i].last &&
|
|
131
|
-
region.isSpacer === other._regions[i].isSpacer,
|
|
132
|
-
)
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
_findRegion(cellIdx: number): [CellRegion, number] {
|
|
137
|
-
let firstIdx = 0;
|
|
138
|
-
let lastIdx = this._regions.length - 1;
|
|
139
|
-
|
|
140
|
-
while (firstIdx <= lastIdx) {
|
|
141
|
-
const middleIdx = Math.floor((firstIdx + lastIdx) / 2);
|
|
142
|
-
const middleRegion = this._regions[middleIdx];
|
|
143
|
-
|
|
144
|
-
if (cellIdx >= middleRegion.first && cellIdx <= middleRegion.last) {
|
|
145
|
-
return [middleRegion, middleIdx];
|
|
146
|
-
} else if (cellIdx < middleRegion.first) {
|
|
147
|
-
lastIdx = middleIdx - 1;
|
|
148
|
-
} else if (cellIdx > middleRegion.last) {
|
|
149
|
-
firstIdx = middleIdx + 1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
invariant(false, `A region was not found containing cellIdx ${cellIdx}`);
|
|
154
|
-
}
|
|
155
|
-
}
|