@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
|
@@ -158,7 +158,7 @@ export interface PressableProps
|
|
|
158
158
|
/**
|
|
159
159
|
* Duration (in milliseconds) to wait after press down before calling onPressIn.
|
|
160
160
|
*/
|
|
161
|
-
unstable_pressDelay?: number;
|
|
161
|
+
unstable_pressDelay?: number | undefined;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// TODO use React.AbstractComponent when available
|
|
@@ -183,6 +183,7 @@ class RefreshControl extends React.Component<RefreshControlProps> {
|
|
|
183
183
|
_onRefresh = () => {
|
|
184
184
|
this._lastNativeRefreshing = true;
|
|
185
185
|
|
|
186
|
+
// $FlowFixMe[unused-promise]
|
|
186
187
|
this.props.onRefresh && this.props.onRefresh();
|
|
187
188
|
|
|
188
189
|
// The native component will start refreshing so force an update to
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
12
|
-
import type {SafeAreaViewType} from './SafeAreaView.flow';
|
|
13
12
|
|
|
14
13
|
import Platform from '../../Utilities/Platform';
|
|
15
14
|
import View from '../View/View';
|
|
@@ -32,4 +31,4 @@ if (Platform.OS === 'android') {
|
|
|
32
31
|
exported = require('./RCTSafeAreaViewNativeComponent').default;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
export default
|
|
34
|
+
export default exported;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
12
|
-
import type {SafeAreaViewType} from './SafeAreaView.flow';
|
|
13
12
|
|
|
14
13
|
import Platform from '../../Utilities/Platform';
|
|
15
14
|
import View from '../View/View';
|
|
@@ -33,4 +32,4 @@ if (Platform.OS === 'android' || Platform.OS === 'win32') {
|
|
|
33
32
|
exported = require('./RCTSafeAreaViewNativeComponent').default;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
export default
|
|
35
|
+
export default exported;
|
|
@@ -23,7 +23,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
|
|
|
23
23
|
validAttributes: {
|
|
24
24
|
decelerationRate: true,
|
|
25
25
|
disableIntervalMomentum: true,
|
|
26
|
-
endFillColor: {process: require('../../StyleSheet/processColor')},
|
|
26
|
+
endFillColor: {process: require('../../StyleSheet/processColor').default},
|
|
27
27
|
fadingEdgeLength: true,
|
|
28
28
|
nestedScrollEnabled: true,
|
|
29
29
|
overScrollMode: true,
|
|
@@ -43,14 +43,20 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
|
|
|
43
43
|
borderBottomRightRadius: true,
|
|
44
44
|
borderRadius: true,
|
|
45
45
|
borderStyle: true,
|
|
46
|
-
borderRightColor: {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
borderRightColor: {
|
|
47
|
+
process: require('../../StyleSheet/processColor').default,
|
|
48
|
+
},
|
|
49
|
+
borderColor: {process: require('../../StyleSheet/processColor').default},
|
|
50
|
+
borderBottomColor: {
|
|
51
|
+
process: require('../../StyleSheet/processColor').default,
|
|
52
|
+
},
|
|
49
53
|
borderTopLeftRadius: true,
|
|
50
|
-
borderTopColor: {process: require('../../StyleSheet/processColor')},
|
|
54
|
+
borderTopColor: {process: require('../../StyleSheet/processColor').default},
|
|
51
55
|
removeClippedSubviews: true,
|
|
52
56
|
borderTopRightRadius: true,
|
|
53
|
-
borderLeftColor: {
|
|
57
|
+
borderLeftColor: {
|
|
58
|
+
process: require('../../StyleSheet/processColor').default,
|
|
59
|
+
},
|
|
54
60
|
pointerEvents: true,
|
|
55
61
|
},
|
|
56
62
|
};
|
|
@@ -730,7 +730,7 @@ export interface ScrollViewProps
|
|
|
730
730
|
/**
|
|
731
731
|
* When true, Sticky header is hidden when scrolling down, and dock at the top when scrolling up.
|
|
732
732
|
*/
|
|
733
|
-
stickyHeaderHiddenOnScroll?: boolean;
|
|
733
|
+
stickyHeaderHiddenOnScroll?: boolean | undefined;
|
|
734
734
|
|
|
735
735
|
/**
|
|
736
736
|
* Style
|
|
@@ -841,7 +841,7 @@ export class ScrollView extends ScrollViewBase {
|
|
|
841
841
|
* The options object has an animated prop, that enables the scrolling animation or not.
|
|
842
842
|
* The animated prop defaults to true
|
|
843
843
|
*/
|
|
844
|
-
scrollToEnd(options?: {animated?: boolean}): void;
|
|
844
|
+
scrollToEnd(options?: {animated?: boolean | undefined}): void;
|
|
845
845
|
|
|
846
846
|
/**
|
|
847
847
|
* Displays the scroll indicators momentarily.
|
|
@@ -33,7 +33,6 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
|
33
33
|
import Dimensions from '../../Utilities/Dimensions';
|
|
34
34
|
import dismissKeyboard from '../../Utilities/dismissKeyboard';
|
|
35
35
|
import Platform from '../../Utilities/Platform';
|
|
36
|
-
import setAndForwardRef from '../../Utilities/setAndForwardRef';
|
|
37
36
|
import Keyboard from '../Keyboard/Keyboard';
|
|
38
37
|
import TextInputState from '../TextInput/TextInputState';
|
|
39
38
|
import View from '../View/View';
|
|
@@ -46,6 +45,8 @@ import ScrollViewContext, {HORIZONTAL, VERTICAL} from './ScrollViewContext';
|
|
|
46
45
|
import ScrollViewNativeComponent from './ScrollViewNativeComponent';
|
|
47
46
|
import ScrollViewStickyHeader from './ScrollViewStickyHeader';
|
|
48
47
|
import invariant from 'invariant';
|
|
48
|
+
import memoize from 'memoize-one';
|
|
49
|
+
import nullthrows from 'nullthrows';
|
|
49
50
|
import * as React from 'react';
|
|
50
51
|
|
|
51
52
|
if (Platform.OS === 'ios') {
|
|
@@ -165,6 +166,14 @@ export type ScrollViewImperativeMethods = $ReadOnly<{|
|
|
|
165
166
|
export type DecelerationRateType = 'fast' | 'normal' | number;
|
|
166
167
|
export type ScrollResponderType = ScrollViewImperativeMethods;
|
|
167
168
|
|
|
169
|
+
type NativeScrollViewInstance = React.ElementRef<HostComponent<mixed>>;
|
|
170
|
+
type PublicScrollViewInstance = $ReadOnly<{|
|
|
171
|
+
...$Exact<NativeScrollViewInstance>,
|
|
172
|
+
...ScrollViewImperativeMethods,
|
|
173
|
+
|}>;
|
|
174
|
+
|
|
175
|
+
type InnerViewInstance = React.ElementRef<typeof View>;
|
|
176
|
+
|
|
168
177
|
type IOSProps = $ReadOnly<{|
|
|
169
178
|
/**
|
|
170
179
|
* Controls whether iOS should automatically adjust the content inset
|
|
@@ -279,7 +288,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
279
288
|
* visibility. Occlusion, transforms, and other complexity won't be taken into account as to
|
|
280
289
|
* whether content is "visible" or not.
|
|
281
290
|
*
|
|
282
|
-
* @platform ios
|
|
283
291
|
*/
|
|
284
292
|
maintainVisibleContentPosition?: ?$ReadOnly<{|
|
|
285
293
|
minIndexForVisible: number,
|
|
@@ -301,24 +309,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
301
309
|
* @platform ios
|
|
302
310
|
*/
|
|
303
311
|
pinchGestureEnabled?: ?boolean,
|
|
304
|
-
/**
|
|
305
|
-
* This controls how often the scroll event will be fired while scrolling
|
|
306
|
-
* (as a time interval in ms). A lower number yields better accuracy for code
|
|
307
|
-
* that is tracking the scroll position, but can lead to scroll performance
|
|
308
|
-
* problems due to the volume of information being send over the bridge.
|
|
309
|
-
*
|
|
310
|
-
* Values between 0 and 17ms indicate 60fps updates are needed and throttling
|
|
311
|
-
* will be disabled.
|
|
312
|
-
*
|
|
313
|
-
* If you do not need precise scroll position tracking, set this value higher
|
|
314
|
-
* to limit the information being sent across the bridge.
|
|
315
|
-
*
|
|
316
|
-
* The default value is zero, which results in the scroll event being sent only
|
|
317
|
-
* once each time the view is scrolled.
|
|
318
|
-
*
|
|
319
|
-
* @platform ios
|
|
320
|
-
*/
|
|
321
|
-
scrollEventThrottle?: ?number,
|
|
322
312
|
/**
|
|
323
313
|
* The amount by which the scroll view indicators are inset from the edges
|
|
324
314
|
* of the scroll view. This should normally be set to the same value as
|
|
@@ -560,7 +550,6 @@ export type Props = $ReadOnly<{|
|
|
|
560
550
|
* Note: Vertical pagination is not supported on Android.
|
|
561
551
|
*/
|
|
562
552
|
pagingEnabled?: ?boolean,
|
|
563
|
-
|
|
564
553
|
/**
|
|
565
554
|
* When false, the view cannot be scrolled via touch interaction.
|
|
566
555
|
* The default value is true.
|
|
@@ -568,6 +557,22 @@ export type Props = $ReadOnly<{|
|
|
|
568
557
|
* Note that the view can always be scrolled by calling `scrollTo`.
|
|
569
558
|
*/
|
|
570
559
|
scrollEnabled?: ?boolean,
|
|
560
|
+
/**
|
|
561
|
+
* This controls how often the scroll event will be fired while scrolling
|
|
562
|
+
* (as a time interval in ms). A lower number yields better accuracy for code
|
|
563
|
+
* that is tracking the scroll position, but can lead to scroll performance
|
|
564
|
+
* problems due to the volume of information being send over the bridge.
|
|
565
|
+
*
|
|
566
|
+
* Values between 0 and 17ms indicate 60fps updates are needed and throttling
|
|
567
|
+
* will be disabled.
|
|
568
|
+
*
|
|
569
|
+
* If you do not need precise scroll position tracking, set this value higher
|
|
570
|
+
* to limit the information being sent across the bridge.
|
|
571
|
+
*
|
|
572
|
+
* The default value is zero, which results in the scroll event being sent only
|
|
573
|
+
* once each time the view is scrolled.
|
|
574
|
+
*/
|
|
575
|
+
scrollEventThrottle?: ?number,
|
|
571
576
|
/**
|
|
572
577
|
* When true, shows a vertical scroll indicator.
|
|
573
578
|
* The default value is true.
|
|
@@ -658,15 +663,13 @@ export type Props = $ReadOnly<{|
|
|
|
658
663
|
* A ref to the inner View element of the ScrollView. This should be used
|
|
659
664
|
* instead of calling `getInnerViewRef`.
|
|
660
665
|
*/
|
|
661
|
-
innerViewRef?:
|
|
666
|
+
innerViewRef?: ForwardedRef<InnerViewInstance>,
|
|
662
667
|
/**
|
|
663
668
|
* A ref to the Native ScrollView component. This ref can be used to call
|
|
664
669
|
* all of ScrollView's public methods, in addition to native methods like
|
|
665
670
|
* measure, measureLayout, etc.
|
|
666
671
|
*/
|
|
667
|
-
scrollViewRef?:
|
|
668
|
-
typeof ScrollViewNativeComponent & ScrollViewImperativeMethods,
|
|
669
|
-
>,
|
|
672
|
+
scrollViewRef?: ForwardedRef<PublicScrollViewInstance>,
|
|
670
673
|
|}>;
|
|
671
674
|
|
|
672
675
|
type State = {|
|
|
@@ -747,7 +750,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
747
750
|
_becameResponderWhileAnimating: boolean = false;
|
|
748
751
|
_preventNegativeScrollOffset: ?boolean = null;
|
|
749
752
|
|
|
750
|
-
_animated = null;
|
|
753
|
+
_animated: ?boolean = null;
|
|
751
754
|
|
|
752
755
|
_subscriptionKeyboardWillShow: ?EventSubscription = null;
|
|
753
756
|
_subscriptionKeyboardWillHide: ?EventSubscription = null;
|
|
@@ -826,36 +829,6 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
826
829
|
}
|
|
827
830
|
}
|
|
828
831
|
|
|
829
|
-
_setNativeRef: $FlowFixMe = setAndForwardRef({
|
|
830
|
-
getForwardedRef: () => this.props.scrollViewRef,
|
|
831
|
-
setLocalRef: ref => {
|
|
832
|
-
this._scrollViewRef = ref;
|
|
833
|
-
|
|
834
|
-
/*
|
|
835
|
-
This is a hack. Ideally we would forwardRef to the underlying
|
|
836
|
-
host component. However, since ScrollView has it's own methods that can be
|
|
837
|
-
called as well, if we used the standard forwardRef then these
|
|
838
|
-
methods wouldn't be accessible and thus be a breaking change.
|
|
839
|
-
|
|
840
|
-
Therefore we edit ref to include ScrollView's public methods so that
|
|
841
|
-
they are callable from the ref.
|
|
842
|
-
*/
|
|
843
|
-
if (ref) {
|
|
844
|
-
ref.getScrollResponder = this.getScrollResponder;
|
|
845
|
-
ref.getScrollableNode = this.getScrollableNode;
|
|
846
|
-
ref.getInnerViewNode = this.getInnerViewNode;
|
|
847
|
-
ref.getInnerViewRef = this.getInnerViewRef;
|
|
848
|
-
ref.getNativeScrollRef = this.getNativeScrollRef;
|
|
849
|
-
ref.scrollTo = this.scrollTo;
|
|
850
|
-
ref.scrollToEnd = this.scrollToEnd;
|
|
851
|
-
ref.flashScrollIndicators = this.flashScrollIndicators;
|
|
852
|
-
ref.scrollResponderZoomTo = this.scrollResponderZoomTo;
|
|
853
|
-
ref.scrollResponderScrollNativeHandleToKeyboard =
|
|
854
|
-
this.scrollResponderScrollNativeHandleToKeyboard;
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
});
|
|
858
|
-
|
|
859
832
|
/**
|
|
860
833
|
* Returns a reference to the underlying scroll responder, which supports
|
|
861
834
|
* operations like `scrollTo`. All ScrollView-like components should
|
|
@@ -868,19 +841,19 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
868
841
|
};
|
|
869
842
|
|
|
870
843
|
getScrollableNode: () => ?number = () => {
|
|
871
|
-
return findNodeHandle(this.
|
|
844
|
+
return findNodeHandle(this._scrollView.nativeInstance);
|
|
872
845
|
};
|
|
873
846
|
|
|
874
847
|
getInnerViewNode: () => ?number = () => {
|
|
875
|
-
return findNodeHandle(this.
|
|
848
|
+
return findNodeHandle(this._innerView.nativeInstance);
|
|
876
849
|
};
|
|
877
850
|
|
|
878
|
-
getInnerViewRef: () =>
|
|
879
|
-
return this.
|
|
851
|
+
getInnerViewRef: () => InnerViewInstance | null = () => {
|
|
852
|
+
return this._innerView.nativeInstance;
|
|
880
853
|
};
|
|
881
854
|
|
|
882
|
-
getNativeScrollRef: () =>
|
|
883
|
-
return this.
|
|
855
|
+
getNativeScrollRef: () => NativeScrollViewInstance | null = () => {
|
|
856
|
+
return this._scrollView.nativeInstance;
|
|
884
857
|
};
|
|
885
858
|
|
|
886
859
|
/**
|
|
@@ -931,10 +904,15 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
931
904
|
x = options.x;
|
|
932
905
|
animated = options.animated;
|
|
933
906
|
}
|
|
934
|
-
if (this.
|
|
907
|
+
if (this._scrollView.nativeInstance == null) {
|
|
935
908
|
return;
|
|
936
909
|
}
|
|
937
|
-
Commands.scrollTo(
|
|
910
|
+
Commands.scrollTo(
|
|
911
|
+
this._scrollView.nativeInstance,
|
|
912
|
+
x || 0,
|
|
913
|
+
y || 0,
|
|
914
|
+
animated !== false,
|
|
915
|
+
);
|
|
938
916
|
};
|
|
939
917
|
|
|
940
918
|
/**
|
|
@@ -950,10 +928,10 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
950
928
|
) => {
|
|
951
929
|
// Default to true
|
|
952
930
|
const animated = (options && options.animated) !== false;
|
|
953
|
-
if (this.
|
|
931
|
+
if (this._scrollView.nativeInstance == null) {
|
|
954
932
|
return;
|
|
955
933
|
}
|
|
956
|
-
Commands.scrollToEnd(this.
|
|
934
|
+
Commands.scrollToEnd(this._scrollView.nativeInstance, animated);
|
|
957
935
|
};
|
|
958
936
|
|
|
959
937
|
/**
|
|
@@ -962,10 +940,10 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
962
940
|
* @platform ios
|
|
963
941
|
*/
|
|
964
942
|
flashScrollIndicators: () => void = () => {
|
|
965
|
-
if (this.
|
|
943
|
+
if (this._scrollView.nativeInstance == null) {
|
|
966
944
|
return;
|
|
967
945
|
}
|
|
968
|
-
Commands.flashScrollIndicators(this.
|
|
946
|
+
Commands.flashScrollIndicators(this._scrollView.nativeInstance);
|
|
969
947
|
};
|
|
970
948
|
|
|
971
949
|
/**
|
|
@@ -990,21 +968,21 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
990
968
|
this._additionalScrollOffset = additionalOffset || 0;
|
|
991
969
|
this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
|
|
992
970
|
|
|
993
|
-
if (this.
|
|
971
|
+
if (this._innerView.nativeInstance == null) {
|
|
994
972
|
return;
|
|
995
973
|
}
|
|
996
974
|
|
|
997
975
|
if (typeof nodeHandle === 'number') {
|
|
998
976
|
UIManager.measureLayout(
|
|
999
977
|
nodeHandle,
|
|
1000
|
-
findNodeHandle(this),
|
|
978
|
+
nullthrows(findNodeHandle(this)),
|
|
1001
979
|
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
1002
980
|
this._textInputFocusError,
|
|
1003
981
|
this._inputMeasureAndScrollToKeyboard,
|
|
1004
982
|
);
|
|
1005
983
|
} else {
|
|
1006
984
|
nodeHandle.measureLayout(
|
|
1007
|
-
this.
|
|
985
|
+
this._innerView.nativeInstance,
|
|
1008
986
|
this._inputMeasureAndScrollToKeyboard,
|
|
1009
987
|
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
1010
988
|
this._textInputFocusError,
|
|
@@ -1047,10 +1025,14 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1047
1025
|
);
|
|
1048
1026
|
}
|
|
1049
1027
|
|
|
1050
|
-
if (this.
|
|
1028
|
+
if (this._scrollView.nativeInstance == null) {
|
|
1051
1029
|
return;
|
|
1052
1030
|
}
|
|
1053
|
-
Commands.zoomToRect(
|
|
1031
|
+
Commands.zoomToRect(
|
|
1032
|
+
this._scrollView.nativeInstance,
|
|
1033
|
+
rect,
|
|
1034
|
+
animated !== false,
|
|
1035
|
+
);
|
|
1054
1036
|
};
|
|
1055
1037
|
|
|
1056
1038
|
_textInputFocusError() {
|
|
@@ -1123,7 +1105,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1123
1105
|
) {
|
|
1124
1106
|
this._scrollAnimatedValueAttachment =
|
|
1125
1107
|
AnimatedImplementation.attachNativeEvent(
|
|
1126
|
-
this.
|
|
1108
|
+
this._scrollView.nativeInstance,
|
|
1127
1109
|
'onScroll',
|
|
1128
1110
|
[{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}],
|
|
1129
1111
|
);
|
|
@@ -1146,7 +1128,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1146
1128
|
if (!stickyHeaderIndices) {
|
|
1147
1129
|
return;
|
|
1148
1130
|
}
|
|
1149
|
-
const childArray = React.Children.toArray(this.props.children);
|
|
1131
|
+
const childArray = React.Children.toArray<$FlowFixMe>(this.props.children);
|
|
1150
1132
|
if (key !== this._getKeyForIndex(index, childArray)) {
|
|
1151
1133
|
// ignore stale layout update
|
|
1152
1134
|
return;
|
|
@@ -1202,15 +1184,45 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1202
1184
|
this.props.onContentSizeChange(width, height);
|
|
1203
1185
|
};
|
|
1204
1186
|
|
|
1205
|
-
|
|
1187
|
+
_innerView: RefForwarder<InnerViewInstance, InnerViewInstance> =
|
|
1188
|
+
createRefForwarder(
|
|
1189
|
+
(instance: InnerViewInstance): InnerViewInstance => instance,
|
|
1190
|
+
);
|
|
1191
|
+
|
|
1192
|
+
_scrollView: RefForwarder<
|
|
1193
|
+
NativeScrollViewInstance,
|
|
1194
|
+
PublicScrollViewInstance,
|
|
1195
|
+
> = createRefForwarder(
|
|
1196
|
+
(nativeInstance: NativeScrollViewInstance): PublicScrollViewInstance => {
|
|
1197
|
+
// This is a hack. Ideally we would forwardRef to the underlying
|
|
1198
|
+
// host component. However, since ScrollView has it's own methods that can be
|
|
1199
|
+
// called as well, if we used the standard forwardRef then these
|
|
1200
|
+
// methods wouldn't be accessible and thus be a breaking change.
|
|
1201
|
+
//
|
|
1202
|
+
// Therefore we edit ref to include ScrollView's public methods so that
|
|
1203
|
+
// they are callable from the ref.
|
|
1204
|
+
|
|
1205
|
+
// $FlowFixMe[prop-missing] - Known issue with appending custom methods.
|
|
1206
|
+
const publicInstance: PublicScrollViewInstance = Object.assign(
|
|
1207
|
+
nativeInstance,
|
|
1208
|
+
{
|
|
1209
|
+
getScrollResponder: this.getScrollResponder,
|
|
1210
|
+
getScrollableNode: this.getScrollableNode,
|
|
1211
|
+
getInnerViewNode: this.getInnerViewNode,
|
|
1212
|
+
getInnerViewRef: this.getInnerViewRef,
|
|
1213
|
+
getNativeScrollRef: this.getNativeScrollRef,
|
|
1214
|
+
scrollTo: this.scrollTo,
|
|
1215
|
+
scrollToEnd: this.scrollToEnd,
|
|
1216
|
+
flashScrollIndicators: this.flashScrollIndicators,
|
|
1217
|
+
scrollResponderZoomTo: this.scrollResponderZoomTo,
|
|
1218
|
+
scrollResponderScrollNativeHandleToKeyboard:
|
|
1219
|
+
this.scrollResponderScrollNativeHandleToKeyboard,
|
|
1220
|
+
},
|
|
1221
|
+
);
|
|
1206
1222
|
|
|
1207
|
-
|
|
1208
|
-
_setInnerViewRef: $FlowFixMe = setAndForwardRef({
|
|
1209
|
-
getForwardedRef: () => this.props.innerViewRef,
|
|
1210
|
-
setLocalRef: ref => {
|
|
1211
|
-
this._innerViewRef = ref;
|
|
1223
|
+
return publicInstance;
|
|
1212
1224
|
},
|
|
1213
|
-
|
|
1225
|
+
);
|
|
1214
1226
|
|
|
1215
1227
|
/**
|
|
1216
1228
|
* Warning, this may be called several times for a single keyboard opening.
|
|
@@ -1650,6 +1662,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1650
1662
|
this.props.contentContainerStyle,
|
|
1651
1663
|
];
|
|
1652
1664
|
if (__DEV__ && this.props.style !== undefined) {
|
|
1665
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
1653
1666
|
const style = flattenStyle(this.props.style);
|
|
1654
1667
|
const childLayoutProps = ['alignItems', 'justifyContent'].filter(
|
|
1655
1668
|
prop => style && style[prop] !== undefined,
|
|
@@ -1673,7 +1686,9 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1673
1686
|
let children = this.props.children;
|
|
1674
1687
|
|
|
1675
1688
|
if (stickyHeaderIndices != null && stickyHeaderIndices.length > 0) {
|
|
1676
|
-
const childArray = React.Children.toArray(
|
|
1689
|
+
const childArray = React.Children.toArray<$FlowFixMe>(
|
|
1690
|
+
this.props.children,
|
|
1691
|
+
);
|
|
1677
1692
|
|
|
1678
1693
|
children = childArray.map((child, index) => {
|
|
1679
1694
|
const indexOfIndex = child ? stickyHeaderIndices.indexOf(index) : -1;
|
|
@@ -1716,7 +1731,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1716
1731
|
const contentContainer = (
|
|
1717
1732
|
<NativeDirectionalScrollContentView
|
|
1718
1733
|
{...contentSizeChangeProps}
|
|
1719
|
-
ref={this.
|
|
1734
|
+
ref={this._innerView.getForwardingRef(this.props.innerViewRef)}
|
|
1720
1735
|
style={contentContainerStyle}
|
|
1721
1736
|
removeClippedSubviews={
|
|
1722
1737
|
// Subview clipping causes issues with sticky headers on Android and
|
|
@@ -1802,12 +1817,15 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1802
1817
|
}
|
|
1803
1818
|
|
|
1804
1819
|
const refreshControl = this.props.refreshControl;
|
|
1820
|
+
const scrollViewRef = this._scrollView.getForwardingRef(
|
|
1821
|
+
this.props.scrollViewRef,
|
|
1822
|
+
);
|
|
1805
1823
|
|
|
1806
1824
|
if (refreshControl) {
|
|
1807
1825
|
if (Platform.OS === 'ios') {
|
|
1808
1826
|
// On iOS the RefreshControl is a child of the ScrollView.
|
|
1809
1827
|
return (
|
|
1810
|
-
<NativeDirectionalScrollView {...props} ref={
|
|
1828
|
+
<NativeDirectionalScrollView {...props} ref={scrollViewRef}>
|
|
1811
1829
|
{refreshControl}
|
|
1812
1830
|
{contentContainer}
|
|
1813
1831
|
</NativeDirectionalScrollView>
|
|
@@ -1818,6 +1836,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1818
1836
|
// AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView.
|
|
1819
1837
|
// Note: we should split props.style on the inner and outer props
|
|
1820
1838
|
// however, the ScrollView still needs the baseStyle to be scrollable
|
|
1839
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
1821
1840
|
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
|
|
1822
1841
|
return React.cloneElement(
|
|
1823
1842
|
refreshControl,
|
|
@@ -1825,14 +1844,14 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1825
1844
|
<NativeDirectionalScrollView
|
|
1826
1845
|
{...props}
|
|
1827
1846
|
style={StyleSheet.compose(baseStyle, inner)}
|
|
1828
|
-
ref={
|
|
1847
|
+
ref={scrollViewRef}>
|
|
1829
1848
|
{contentContainer}
|
|
1830
1849
|
</NativeDirectionalScrollView>,
|
|
1831
1850
|
);
|
|
1832
1851
|
}
|
|
1833
1852
|
}
|
|
1834
1853
|
return (
|
|
1835
|
-
<NativeDirectionalScrollView {...props} ref={
|
|
1854
|
+
<NativeDirectionalScrollView {...props} ref={scrollViewRef}>
|
|
1836
1855
|
{contentContainer}
|
|
1837
1856
|
</NativeDirectionalScrollView>
|
|
1838
1857
|
);
|
|
@@ -1857,6 +1876,48 @@ const styles = StyleSheet.create({
|
|
|
1857
1876
|
},
|
|
1858
1877
|
});
|
|
1859
1878
|
|
|
1879
|
+
type ForwardedRef<T> = {current: null | T, ...} | ((null | T) => mixed);
|
|
1880
|
+
|
|
1881
|
+
type RefForwarder<TNativeInstance, TPublicInstance> = {
|
|
1882
|
+
getForwardingRef: (
|
|
1883
|
+
?ForwardedRef<TPublicInstance>,
|
|
1884
|
+
) => (TNativeInstance | null) => void,
|
|
1885
|
+
nativeInstance: TNativeInstance | null,
|
|
1886
|
+
publicInstance: TPublicInstance | null,
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Helper function that should be replaced with `useCallback` and `useMergeRefs`
|
|
1891
|
+
* once `ScrollView` is reimplemented as a functional component.
|
|
1892
|
+
*/
|
|
1893
|
+
function createRefForwarder<TNativeInstance, TPublicInstance>(
|
|
1894
|
+
mutator: TNativeInstance => TPublicInstance,
|
|
1895
|
+
): RefForwarder<TNativeInstance, TPublicInstance> {
|
|
1896
|
+
const state: RefForwarder<TNativeInstance, TPublicInstance> = {
|
|
1897
|
+
getForwardingRef: memoize(forwardedRef => {
|
|
1898
|
+
return (nativeInstance: TNativeInstance | null): void => {
|
|
1899
|
+
const publicInstance =
|
|
1900
|
+
nativeInstance == null ? null : mutator(nativeInstance);
|
|
1901
|
+
|
|
1902
|
+
state.nativeInstance = nativeInstance;
|
|
1903
|
+
state.publicInstance = publicInstance;
|
|
1904
|
+
|
|
1905
|
+
if (forwardedRef != null) {
|
|
1906
|
+
if (typeof forwardedRef === 'function') {
|
|
1907
|
+
forwardedRef(publicInstance);
|
|
1908
|
+
} else {
|
|
1909
|
+
forwardedRef.current = publicInstance;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
}),
|
|
1914
|
+
nativeInstance: null,
|
|
1915
|
+
publicInstance: null,
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
return state;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1860
1921
|
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
1861
1922
|
* LTI update could not be added via codemod */
|
|
1862
1923
|
function Wrapper(props, ref: (mixed => mixed) | {current: mixed, ...}) {
|
|
@@ -1872,9 +1933,6 @@ ForwardedScrollView.displayName = 'ScrollView';
|
|
|
1872
1933
|
|
|
1873
1934
|
module.exports = ((ForwardedScrollView: $FlowFixMe): React.AbstractComponent<
|
|
1874
1935
|
React.ElementConfig<typeof ScrollView>,
|
|
1875
|
-
|
|
1876
|
-
...$Exact<React.ElementRef<HostComponent<mixed>>>,
|
|
1877
|
-
...ScrollViewImperativeMethods,
|
|
1878
|
-
|}>,
|
|
1936
|
+
PublicScrollViewInstance,
|
|
1879
1937
|
> &
|
|
1880
1938
|
ScrollViewComponentStatics);
|