@office-iss/react-native-win32 0.74.4 → 0.75.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 +9 -4
- package/CHANGELOG.json +554 -51
- package/CHANGELOG.md +165 -30
- package/Libraries/Animated/AnimatedImplementation.js +2 -0
- package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
- package/Libraries/Animated/createAnimatedComponent.js +10 -4
- package/Libraries/Animated/useAnimatedProps.js +56 -28
- package/Libraries/BatchedBridge/MessageQueue.js +1 -0
- package/Libraries/Components/Button.js +10 -5
- package/Libraries/Components/Button.win32.js +1 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
- package/Libraries/Components/Pressable/Pressable.js +13 -6
- package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
- package/Libraries/Components/ScrollView/ScrollView.js +109 -29
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
- package/Libraries/Components/StatusBar/StatusBar.js +1 -21
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
- package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
- package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
- package/Libraries/Components/TextInput/TextInput.js +14 -70
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
- package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
- package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.js +0 -11
- package/Libraries/Components/View/View.win32.js +0 -11
- package/Libraries/Components/View/ViewAccessibility.js +4 -4
- package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/Libraries/Components/View/ViewPropTypes.js +7 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
- package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
- package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
- package/Libraries/Core/ErrorHandlers.js +116 -0
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpDeveloperTools.js +3 -1
- package/Libraries/Core/setUpPerformance.js +6 -4
- package/Libraries/Core/setUpReactDevTools.js +70 -10
- package/Libraries/Core/setUpTimers.js +50 -31
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
- package/Libraries/Image/Image.android.js +23 -13
- package/Libraries/Image/Image.d.ts +14 -15
- package/Libraries/Image/Image.ios.js +21 -11
- package/Libraries/Image/Image.win32.js +5 -3
- package/Libraries/Image/ImageProps.js +16 -5
- package/Libraries/Image/ImageTypes.flow.js +7 -2
- package/Libraries/Image/ImageUtils.js +1 -0
- package/Libraries/Image/ImageViewNativeComponent.js +2 -1
- package/Libraries/Inspector/ElementBox.js +6 -3
- package/Libraries/Inspector/ElementProperties.js +1 -1
- package/Libraries/Interaction/TouchHistoryMath.js +4 -4
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +39 -29
- package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
- package/Libraries/LogBox/LogBox.js +29 -12
- package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
- package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
- package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +5 -1
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
- package/Libraries/Pressability/Pressability.js +3 -51
- package/Libraries/Pressability/Pressability.win32.js +3 -51
- package/Libraries/ReactNative/AppContainer-dev.js +3 -2
- package/Libraries/ReactNative/AppContainer-prod.js +2 -1
- package/Libraries/ReactNative/AppContainer.js +2 -0
- package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
- package/Libraries/ReactNative/AppRegistry.js +10 -4
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
- package/Libraries/ReactNative/FabricUIManager.js +0 -51
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
- package/Libraries/ReactNative/RendererImplementation.js +20 -2
- package/Libraries/ReactNative/UIManager.d.ts +0 -21
- package/Libraries/ReactNative/UIManagerProperties.js +0 -3
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
- package/Libraries/ReactNative/renderApplication.js +3 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
- package/Libraries/Renderer/shims/ReactFabric.js +2 -2
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.d.ts +16 -10
- package/Libraries/Share/Share.js +14 -15
- package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -10
- package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
- package/Libraries/StyleSheet/flattenStyle.js +1 -0
- package/Libraries/StyleSheet/processFilter.js +132 -0
- package/Libraries/StyleSheet/processTransform.js +18 -3
- package/Libraries/Text/Text.js +151 -128
- package/Libraries/Text/Text.win32.js +163 -138
- package/Libraries/Text/TextNativeComponent.js +5 -4
- package/Libraries/Text/TextNativeComponent.win32.js +5 -4
- package/Libraries/Text/TextProps.js +6 -6
- package/Libraries/Text/TextProps.win32.js +6 -6
- package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
- package/Libraries/Types/CodegenTypes.js +3 -0
- package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
- package/Libraries/Utilities/Dimensions.js +1 -0
- package/Libraries/Utilities/Dimensions.win32.js +1 -0
- package/Libraries/Utilities/HMRClient.js +36 -8
- package/Libraries/Utilities/HMRClientProdShim.js +1 -0
- package/Libraries/Utilities/Platform.android.js +4 -4
- package/Libraries/Utilities/RCTLog.js +1 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
- package/Libraries/__tests__/ButtonWin32-test.js +7 -6
- package/Libraries/promiseRejectionTrackingOptions.js +1 -0
- package/jest/mockComponent.js +7 -0
- package/jest/renderer.js +25 -14
- package/jest/setup.js +19 -13
- package/jest.config.js +2 -1
- package/overrides.json +30 -29
- package/package.json +27 -25
- package/rn-get-polyfills.js +1 -0
- package/src/private/core/composeStyles.js +27 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
- package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
- package/src/private/specs/modules/NativeBlobModule.js +4 -2
- package/src/private/specs/modules/NativeDevSettings.js +1 -0
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
- package/src/private/specs/modules/NativeUIManager.js +0 -7
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
- package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
- package/src/private/webapis/performance/EventCounts.js +1 -1
- package/src/private/webapis/performance/MemoryInfo.js +9 -9
- package/src/private/webapis/performance/Performance.js +10 -56
- package/src/private/webapis/performance/PerformanceObserver.js +30 -22
- package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
- package/src/private/webapis/performance/UserTiming.js +63 -0
- package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
- package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/types/modules/globals.d.ts +4 -0
- package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
- package/Libraries/Utilities/LoadingView.ios.js +0 -50
- package/Libraries/Utilities/LoadingView.js +0 -16
- package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
- package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
- package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
- package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
- package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
- package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
- package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
- package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
- package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
- package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
- package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
|
@@ -784,33 +784,12 @@ export type Props = $ReadOnly<{|
|
|
|
784
784
|
*/
|
|
785
785
|
onChange?: ?(e: ChangeEvent) => mixed,
|
|
786
786
|
|
|
787
|
-
/**
|
|
788
|
-
* DANGER: this API is not stable and will change in the future.
|
|
789
|
-
*
|
|
790
|
-
* Callback will be called on the main thread and may result in dropped frames.
|
|
791
|
-
* Callback that is called when the text input's text changes.
|
|
792
|
-
*
|
|
793
|
-
* @platform ios
|
|
794
|
-
*/
|
|
795
|
-
unstable_onChangeSync?: ?(e: ChangeEvent) => mixed,
|
|
796
|
-
|
|
797
787
|
/**
|
|
798
788
|
* Callback that is called when the text input's text changes.
|
|
799
789
|
* Changed text is passed as an argument to the callback handler.
|
|
800
790
|
*/
|
|
801
791
|
onChangeText?: ?(text: string) => mixed,
|
|
802
792
|
|
|
803
|
-
/**
|
|
804
|
-
* DANGER: this API is not stable and will change in the future.
|
|
805
|
-
*
|
|
806
|
-
* Callback will be called on the main thread and may result in dropped frames.
|
|
807
|
-
* Callback that is called when the text input's text changes.
|
|
808
|
-
* Changed text is passed as an argument to the callback handler.
|
|
809
|
-
*
|
|
810
|
-
* @platform ios
|
|
811
|
-
*/
|
|
812
|
-
unstable_onChangeTextSync?: ?(text: string) => mixed,
|
|
813
|
-
|
|
814
793
|
/**
|
|
815
794
|
* Callback that is called when the text input's content size changes.
|
|
816
795
|
* This will be called with
|
|
@@ -839,21 +818,6 @@ export type Props = $ReadOnly<{|
|
|
|
839
818
|
*/
|
|
840
819
|
onKeyPress?: ?(e: KeyPressEvent) => mixed,
|
|
841
820
|
|
|
842
|
-
/**
|
|
843
|
-
* DANGER: this API is not stable and will change in the future.
|
|
844
|
-
*
|
|
845
|
-
* Callback will be called on the main thread and may result in dropped frames.
|
|
846
|
-
*
|
|
847
|
-
* Callback that is called when a key is pressed.
|
|
848
|
-
* This will be called with `{ nativeEvent: { key: keyValue } }`
|
|
849
|
-
* where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
|
|
850
|
-
* the typed-in character otherwise including `' '` for space.
|
|
851
|
-
* Fires before `onChange` callbacks.
|
|
852
|
-
*
|
|
853
|
-
* @platform ios
|
|
854
|
-
*/
|
|
855
|
-
unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
|
|
856
|
-
|
|
857
821
|
/**
|
|
858
822
|
* Called when a single tap gesture is detected.
|
|
859
823
|
*/
|
|
@@ -1317,12 +1281,8 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1317
1281
|
}
|
|
1318
1282
|
},
|
|
1319
1283
|
isFocused(): boolean {
|
|
1320
|
-
const currentlyFocusedInput =
|
|
1321
|
-
|
|
1322
|
-
return (
|
|
1323
|
-
currentlyFocusedInput !== null &&
|
|
1324
|
-
currentlyFocusedInput === inputRef.current
|
|
1325
|
-
);
|
|
1284
|
+
const currentlyFocusedInput = TextInputState.currentlyFocusedInput();
|
|
1285
|
+
return currentlyFocusedInput !== null && currentlyFocusedInput === inputRef.current;
|
|
1326
1286
|
},
|
|
1327
1287
|
getNativeRef(): ?React.ElementRef<HostComponent<mixed>> {
|
|
1328
1288
|
return inputRef.current;
|
|
@@ -1365,26 +1325,6 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1365
1325
|
setMostRecentEventCount(event.nativeEvent.eventCount);
|
|
1366
1326
|
};
|
|
1367
1327
|
|
|
1368
|
-
const _onChangeSync = (event: ChangeEvent) => {
|
|
1369
|
-
const currentText = event.nativeEvent.text;
|
|
1370
|
-
props.unstable_onChangeSync && props.unstable_onChangeSync(event);
|
|
1371
|
-
props.unstable_onChangeTextSync &&
|
|
1372
|
-
props.unstable_onChangeTextSync(currentText);
|
|
1373
|
-
|
|
1374
|
-
if (inputRef.current == null) {
|
|
1375
|
-
// calling `props.onChange` or `props.onChangeText`
|
|
1376
|
-
// may clean up the input itself. Exits here.
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
setLastNativeText(currentText);
|
|
1381
|
-
// This must happen last, after we call setLastNativeText.
|
|
1382
|
-
// Different ordering can cause bugs when editing AndroidTextInputs
|
|
1383
|
-
// with multiple Fragments.
|
|
1384
|
-
// We must update this so that controlled input updates work.
|
|
1385
|
-
setMostRecentEventCount(event.nativeEvent.eventCount);
|
|
1386
|
-
};
|
|
1387
|
-
|
|
1388
1328
|
const _onSelectionChange = (event: SelectionChangeEvent) => {
|
|
1389
1329
|
props.onSelectionChange && props.onSelectionChange(event);
|
|
1390
1330
|
|
|
@@ -1576,6 +1516,12 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1576
1516
|
|
|
1577
1517
|
const style = flattenStyle<TextStyleProp>(props.style);
|
|
1578
1518
|
|
|
1519
|
+
if (typeof style?.fontWeight === 'number') {
|
|
1520
|
+
// $FlowFixMe[prop-missing]
|
|
1521
|
+
// $FlowFixMe[cannot-write]
|
|
1522
|
+
style.fontWeight = style?.fontWeight.toString();
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1579
1525
|
if (Platform.OS === 'ios') {
|
|
1580
1526
|
const RCTTextInputView =
|
|
1581
1527
|
props.multiline === true
|
|
@@ -1589,10 +1535,6 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1589
1535
|
style.paddingVertical == null &&
|
|
1590
1536
|
style.paddingTop == null));
|
|
1591
1537
|
|
|
1592
|
-
const useOnChangeSync =
|
|
1593
|
-
(props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
|
|
1594
|
-
!(props.onChange || props.onChangeText);
|
|
1595
|
-
|
|
1596
1538
|
textInput = (
|
|
1597
1539
|
<RCTTextInputView
|
|
1598
1540
|
// $FlowFixMe[incompatible-type] - Figure out imperative + forward refs.
|
|
@@ -1609,9 +1551,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1609
1551
|
mostRecentEventCount={mostRecentEventCount}
|
|
1610
1552
|
nativeID={id ?? props.nativeID}
|
|
1611
1553
|
onBlur={_onBlur}
|
|
1612
|
-
onKeyPressSync={props.unstable_onKeyPressSync}
|
|
1613
1554
|
onChange={_onChange}
|
|
1614
|
-
onChangeSync={useOnChangeSync === true ? _onChangeSync : null}
|
|
1615
1555
|
onContentSizeChange={props.onContentSizeChange}
|
|
1616
1556
|
onFocus={_onFocus}
|
|
1617
1557
|
onScroll={_onScroll}
|
|
@@ -1880,10 +1820,13 @@ const ExportedForwardRef: React.AbstractComponent<
|
|
|
1880
1820
|
: undefined
|
|
1881
1821
|
}
|
|
1882
1822
|
textContentType={
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1823
|
+
textContentType != null
|
|
1824
|
+
? textContentType
|
|
1825
|
+
: Platform.OS === 'ios' &&
|
|
1826
|
+
autoComplete &&
|
|
1827
|
+
autoComplete in autoCompleteWebToTextContentTypeMap
|
|
1828
|
+
? // $FlowFixMe[invalid-computed-prop]
|
|
1829
|
+
// $FlowFixMe[prop-missing]
|
|
1887
1830
|
autoCompleteWebToTextContentTypeMap[autoComplete]
|
|
1888
1831
|
: textContentType
|
|
1889
1832
|
}
|
|
@@ -8,12 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type * as React from 'react';
|
|
11
|
-
import {Constructor} from '../../../types/private/Utilities';
|
|
12
|
-
import {TimerMixin} from '../../../types/private/TimerMixin';
|
|
13
|
-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
|
14
11
|
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
|
|
15
12
|
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
|
|
16
|
-
import {
|
|
13
|
+
import {View} from '../../Components/View/View';
|
|
17
14
|
import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -60,9 +57,6 @@ export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
|
|
|
60
57
|
*
|
|
61
58
|
* @see https://reactnative.dev/docs/touchablehighlight
|
|
62
59
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Constructor<TouchableMixin> &
|
|
67
|
-
typeof TouchableHighlightComponent;
|
|
68
|
-
export class TouchableHighlight extends TouchableHighlightBase {}
|
|
60
|
+
export const TouchableHighlight: React.ForwardRefExoticComponent<
|
|
61
|
+
React.PropsWithoutRef<TouchableHighlightProps> & React.RefAttributes<View>
|
|
62
|
+
>;
|
|
@@ -342,7 +342,9 @@ class TouchableHighlight extends React.Component<Props, State> {
|
|
|
342
342
|
nextFocusRight={this.props.nextFocusRight}
|
|
343
343
|
nextFocusUp={this.props.nextFocusUp}
|
|
344
344
|
focusable={
|
|
345
|
-
this.props.focusable !== false &&
|
|
345
|
+
this.props.focusable !== false &&
|
|
346
|
+
this.props.onPress !== undefined &&
|
|
347
|
+
!this.props.disabled
|
|
346
348
|
}
|
|
347
349
|
nativeID={this.props.id ?? this.props.nativeID}
|
|
348
350
|
testID={this.props.testID}
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type * as React from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import {TimerMixin} from '../../../types/private/TimerMixin';
|
|
13
|
-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
|
|
14
|
-
import {TVParallaxProperties} from '../View/ViewPropTypes';
|
|
15
|
-
import {TouchableMixin} from './Touchable';
|
|
11
|
+
import {View} from '../../Components/View/View';
|
|
16
12
|
import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
17
13
|
|
|
18
14
|
export interface TVProps {
|
|
@@ -70,22 +66,6 @@ export interface TouchableOpacityProps
|
|
|
70
66
|
* Defaults to 0.2
|
|
71
67
|
*/
|
|
72
68
|
activeOpacity?: number | undefined;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
|
|
76
|
-
*
|
|
77
|
-
* enabled: If true, parallax effects are enabled. Defaults to true.
|
|
78
|
-
* shiftDistanceX: Defaults to 2.0.
|
|
79
|
-
* shiftDistanceY: Defaults to 2.0.
|
|
80
|
-
* tiltAngle: Defaults to 0.05.
|
|
81
|
-
* magnification: Defaults to 1.0.
|
|
82
|
-
* pressMagnification: Defaults to 1.0.
|
|
83
|
-
* pressDuration: Defaults to 0.3.
|
|
84
|
-
* pressDelay: Defaults to 0.0.
|
|
85
|
-
*
|
|
86
|
-
* @platform android
|
|
87
|
-
*/
|
|
88
|
-
tvParallaxProperties?: TVParallaxProperties | undefined;
|
|
89
69
|
}
|
|
90
70
|
|
|
91
71
|
/**
|
|
@@ -96,14 +76,6 @@ export interface TouchableOpacityProps
|
|
|
96
76
|
*
|
|
97
77
|
* @see https://reactnative.dev/docs/touchableopacity
|
|
98
78
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Constructor<NativeMethods> &
|
|
103
|
-
typeof TouchableOpacityComponent;
|
|
104
|
-
export class TouchableOpacity extends TouchableOpacityBase {
|
|
105
|
-
/**
|
|
106
|
-
* Animate the touchable to a new opacity.
|
|
107
|
-
*/
|
|
108
|
-
setOpacityTo: (value: number) => void;
|
|
109
|
-
}
|
|
79
|
+
export const TouchableOpacity: React.ForwardRefExoticComponent<
|
|
80
|
+
React.PropsWithoutRef<TouchableOpacityProps> & React.RefAttributes<View>
|
|
81
|
+
>;
|
|
@@ -287,7 +287,9 @@ class TouchableOpacity extends React.Component<Props, State> {
|
|
|
287
287
|
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
|
|
288
288
|
hitSlop={this.props.hitSlop}
|
|
289
289
|
focusable={
|
|
290
|
-
this.props.focusable !== false &&
|
|
290
|
+
this.props.focusable !== false &&
|
|
291
|
+
this.props.onPress !== undefined &&
|
|
292
|
+
!this.props.disabled
|
|
291
293
|
}
|
|
292
294
|
ref={this.props.hostRef}
|
|
293
295
|
{...eventHandlersWithoutBlurAndFocus}>
|
|
@@ -42,6 +42,8 @@ export interface TouchableWithoutFeedbackProps
|
|
|
42
42
|
AccessibilityProps {
|
|
43
43
|
children?: React.ReactNode | undefined;
|
|
44
44
|
|
|
45
|
+
rejectResponderTermination?: boolean | undefined;
|
|
46
|
+
|
|
45
47
|
/**
|
|
46
48
|
* Delay in ms, from onPressIn, before onLongPress is called.
|
|
47
49
|
*/
|
|
@@ -62,6 +64,12 @@ export interface TouchableWithoutFeedbackProps
|
|
|
62
64
|
*/
|
|
63
65
|
disabled?: boolean | undefined;
|
|
64
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Whether this View should be focusable with a non-touch input device,
|
|
69
|
+
* eg. receive focus with a hardware keyboard / TV remote.
|
|
70
|
+
*/
|
|
71
|
+
focusable?: boolean | undefined;
|
|
72
|
+
|
|
65
73
|
/**
|
|
66
74
|
* This defines how far your touch can start away from the button.
|
|
67
75
|
* This is added to pressRetentionOffset when moving off of the button.
|
|
@@ -24,11 +24,10 @@ import type {
|
|
|
24
24
|
} from '../../Types/CoreEventTypes';
|
|
25
25
|
|
|
26
26
|
import View from '../../Components/View/View';
|
|
27
|
-
import Pressability, {
|
|
28
|
-
type PressabilityConfig,
|
|
29
|
-
} from '../../Pressability/Pressability';
|
|
30
27
|
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
|
28
|
+
import usePressability from '../../Pressability/usePressability';
|
|
31
29
|
import * as React from 'react';
|
|
30
|
+
import {useMemo} from 'react';
|
|
32
31
|
|
|
33
32
|
type Props = $ReadOnly<{|
|
|
34
33
|
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
@@ -85,10 +84,6 @@ type Props = $ReadOnly<{|
|
|
|
85
84
|
touchSoundDisabled?: ?boolean,
|
|
86
85
|
|}>;
|
|
87
86
|
|
|
88
|
-
type State = $ReadOnly<{|
|
|
89
|
-
pressability: Pressability,
|
|
90
|
-
|}>;
|
|
91
|
-
|
|
92
87
|
const PASSTHROUGH_PROPS = [
|
|
93
88
|
'accessibilityActions',
|
|
94
89
|
'accessibilityElementsHidden',
|
|
@@ -115,115 +110,126 @@ const PASSTHROUGH_PROPS = [
|
|
|
115
110
|
'testID',
|
|
116
111
|
];
|
|
117
112
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
113
|
+
module.exports = function TouchableWithoutFeedback(props: Props): React.Node {
|
|
114
|
+
const {
|
|
115
|
+
disabled,
|
|
116
|
+
rejectResponderTermination,
|
|
117
|
+
'aria-disabled': ariaDisabled,
|
|
118
|
+
accessibilityState,
|
|
119
|
+
hitSlop,
|
|
120
|
+
delayLongPress,
|
|
121
|
+
delayPressIn,
|
|
122
|
+
delayPressOut,
|
|
123
|
+
pressRetentionOffset,
|
|
124
|
+
touchSoundDisabled,
|
|
125
|
+
onBlur: _onBlur,
|
|
126
|
+
onFocus: _onFocus,
|
|
127
|
+
onLongPress,
|
|
128
|
+
onPress,
|
|
129
|
+
onPressIn,
|
|
130
|
+
onPressOut,
|
|
131
|
+
} = props;
|
|
132
|
+
|
|
133
|
+
const pressabilityConfig = useMemo(
|
|
134
|
+
() => ({
|
|
135
|
+
cancelable: !rejectResponderTermination,
|
|
140
136
|
disabled:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
137
|
+
disabled !== null
|
|
138
|
+
? disabled
|
|
139
|
+
: ariaDisabled ?? accessibilityState?.disabled,
|
|
140
|
+
hitSlop: hitSlop,
|
|
141
|
+
delayLongPress: delayLongPress,
|
|
142
|
+
delayPressIn: delayPressIn,
|
|
143
|
+
delayPressOut: delayPressOut,
|
|
144
|
+
minPressDuration: 0,
|
|
145
|
+
pressRectOffset: pressRetentionOffset,
|
|
146
|
+
android_disableSound: touchSoundDisabled,
|
|
147
|
+
onBlur: _onBlur,
|
|
148
|
+
onFocus: _onFocus,
|
|
149
|
+
onLongPress: onLongPress,
|
|
150
|
+
onPress: onPress,
|
|
151
|
+
onPressIn: onPressIn,
|
|
152
|
+
onPressOut: onPressOut,
|
|
153
|
+
}),
|
|
154
|
+
[
|
|
155
|
+
rejectResponderTermination,
|
|
156
|
+
disabled,
|
|
157
|
+
ariaDisabled,
|
|
158
|
+
accessibilityState?.disabled,
|
|
159
|
+
hitSlop,
|
|
160
|
+
delayLongPress,
|
|
161
|
+
delayPressIn,
|
|
162
|
+
delayPressOut,
|
|
163
|
+
pressRetentionOffset,
|
|
164
|
+
touchSoundDisabled,
|
|
165
|
+
_onBlur,
|
|
166
|
+
_onFocus,
|
|
167
|
+
onLongPress,
|
|
168
|
+
onPress,
|
|
169
|
+
onPressIn,
|
|
170
|
+
onPressOut,
|
|
171
|
+
],
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const eventHandlers = usePressability(pressabilityConfig);
|
|
175
|
+
|
|
176
|
+
const element = React.Children.only<$FlowFixMe>(props.children);
|
|
177
|
+
const children: Array<React.Node> = [element.props.children];
|
|
178
|
+
const ariaLive = props['aria-live'];
|
|
179
|
+
|
|
180
|
+
if (__DEV__) {
|
|
181
|
+
if (element.type === View) {
|
|
182
|
+
children.push(
|
|
183
|
+
<PressabilityDebugView color="red" hitSlop={props.hitSlop} />,
|
|
184
|
+
);
|
|
182
185
|
}
|
|
183
|
-
|
|
184
|
-
// $FlowFixMe[incompatible-call]
|
|
185
|
-
return React.cloneElement(element, elementProps, ...children);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
componentDidUpdate(): void {
|
|
189
|
-
this.state.pressability.configure(createPressabilityConfig(this.props));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
componentDidMount(): mixed {
|
|
193
|
-
this.state.pressability.configure(createPressabilityConfig(this.props));
|
|
194
186
|
}
|
|
195
187
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
188
|
+
let _accessibilityState = {
|
|
189
|
+
busy: props['aria-busy'] ?? props.accessibilityState?.busy,
|
|
190
|
+
checked: props['aria-checked'] ?? props.accessibilityState?.checked,
|
|
191
|
+
disabled: props['aria-disabled'] ?? props.accessibilityState?.disabled,
|
|
192
|
+
expanded: props['aria-expanded'] ?? props.accessibilityState?.expanded,
|
|
193
|
+
selected: props['aria-selected'] ?? props.accessibilityState?.selected,
|
|
194
|
+
};
|
|
200
195
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
...
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
props.disabled
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
196
|
+
// BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
|
|
197
|
+
// adopting `Pressability`, so preserve that behavior.
|
|
198
|
+
const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} =
|
|
199
|
+
eventHandlers || {};
|
|
200
|
+
|
|
201
|
+
const elementProps: {[string]: mixed, ...} = {
|
|
202
|
+
...eventHandlersWithoutBlurAndFocus,
|
|
203
|
+
accessible: props.accessible !== false,
|
|
204
|
+
accessibilityState:
|
|
205
|
+
props.disabled != null
|
|
206
|
+
? {
|
|
207
|
+
..._accessibilityState,
|
|
208
|
+
disabled: props.disabled,
|
|
209
|
+
}
|
|
210
|
+
: _accessibilityState,
|
|
211
|
+
focusable:
|
|
212
|
+
props.focusable !== false &&
|
|
213
|
+
props.onPress !== undefined &&
|
|
214
|
+
!props.disabled,
|
|
215
|
+
|
|
216
|
+
accessibilityElementsHidden:
|
|
217
|
+
props['aria-hidden'] ?? props.accessibilityElementsHidden,
|
|
218
|
+
importantForAccessibility:
|
|
219
|
+
props['aria-hidden'] === true
|
|
220
|
+
? 'no-hide-descendants'
|
|
221
|
+
: props.importantForAccessibility,
|
|
222
|
+
accessibilityLiveRegion:
|
|
223
|
+
ariaLive === 'off' ? 'none' : ariaLive ?? props.accessibilityLiveRegion,
|
|
224
|
+
nativeID: props.id ?? props.nativeID,
|
|
224
225
|
};
|
|
225
|
-
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
for (const prop of PASSTHROUGH_PROPS) {
|
|
228
|
+
if (props[prop] !== undefined) {
|
|
229
|
+
elementProps[prop] = props[prop];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
228
232
|
|
|
229
|
-
|
|
233
|
+
// $FlowFixMe[incompatible-call]
|
|
234
|
+
return React.cloneElement(element, elementProps, ...children);
|
|
235
|
+
};
|
|
@@ -12,6 +12,7 @@ import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
|
|
|
12
12
|
|
|
13
13
|
import processAspectRatio from '../../StyleSheet/processAspectRatio';
|
|
14
14
|
import processColor from '../../StyleSheet/processColor';
|
|
15
|
+
import processFilter from '../../StyleSheet/processFilter';
|
|
15
16
|
import processFontVariant from '../../StyleSheet/processFontVariant';
|
|
16
17
|
import processTransform from '../../StyleSheet/processTransform';
|
|
17
18
|
import processTransformOrigin from '../../StyleSheet/processTransformOrigin';
|
|
@@ -114,6 +115,11 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
|
|
|
114
115
|
transform: {process: processTransform},
|
|
115
116
|
transformOrigin: {process: processTransformOrigin},
|
|
116
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Filter
|
|
120
|
+
*/
|
|
121
|
+
experimental_filter: {process: processFilter},
|
|
122
|
+
|
|
117
123
|
/**
|
|
118
124
|
* View
|
|
119
125
|
*/
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from './ViewPropTypes';
|
|
12
12
|
|
|
13
|
-
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
14
13
|
import TextAncestor from '../../Text/TextAncestor';
|
|
15
14
|
import ViewNativeComponent from './ViewNativeComponent';
|
|
16
15
|
import * as React from 'react';
|
|
@@ -53,7 +52,6 @@ const View: React.AbstractComponent<
|
|
|
53
52
|
id,
|
|
54
53
|
importantForAccessibility,
|
|
55
54
|
nativeID,
|
|
56
|
-
pointerEvents,
|
|
57
55
|
tabIndex,
|
|
58
56
|
...otherProps
|
|
59
57
|
}: ViewProps,
|
|
@@ -96,12 +94,6 @@ const View: React.AbstractComponent<
|
|
|
96
94
|
};
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
100
|
-
let style = flattenStyle(otherProps.style);
|
|
101
|
-
|
|
102
|
-
// $FlowFixMe[sketchy-null-mixed]
|
|
103
|
-
const newPointerEvents = style?.pointerEvents || pointerEvents;
|
|
104
|
-
|
|
105
97
|
const actualView = (
|
|
106
98
|
<ViewNativeComponent
|
|
107
99
|
{...otherProps}
|
|
@@ -120,9 +112,6 @@ const View: React.AbstractComponent<
|
|
|
120
112
|
: importantForAccessibility
|
|
121
113
|
}
|
|
122
114
|
nativeID={id ?? nativeID}
|
|
123
|
-
style={style}
|
|
124
|
-
// $FlowFixMe[incompatible-type]
|
|
125
|
-
pointerEvents={newPointerEvents}
|
|
126
115
|
ref={forwardedRef}
|
|
127
116
|
/>
|
|
128
117
|
);
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from './ViewPropTypes';
|
|
12
12
|
|
|
13
|
-
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
14
13
|
import TextAncestor from '../../Text/TextAncestor';
|
|
15
14
|
import ViewNativeComponent from './ViewNativeComponent';
|
|
16
15
|
import * as React from 'react';
|
|
@@ -71,7 +70,6 @@ const View: React.AbstractComponent<
|
|
|
71
70
|
id,
|
|
72
71
|
importantForAccessibility,
|
|
73
72
|
nativeID,
|
|
74
|
-
pointerEvents,
|
|
75
73
|
tabIndex,
|
|
76
74
|
...otherProps
|
|
77
75
|
}: ViewProps,
|
|
@@ -118,12 +116,6 @@ const View: React.AbstractComponent<
|
|
|
118
116
|
};
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
122
|
-
let style = flattenStyle(otherProps.style);
|
|
123
|
-
|
|
124
|
-
// $FlowFixMe[sketchy-null-mixed]
|
|
125
|
-
const newPointerEvents = style?.pointerEvents || pointerEvents;
|
|
126
|
-
|
|
127
119
|
const _keyDown = (event: KeyEvent) => {
|
|
128
120
|
if (otherProps.keyDownEvents && event.isPropagationStopped() !== true) {
|
|
129
121
|
// $FlowFixMe - keyDownEvents was already checked to not be undefined
|
|
@@ -253,9 +245,6 @@ const View: React.AbstractComponent<
|
|
|
253
245
|
: importantForAccessibility
|
|
254
246
|
}
|
|
255
247
|
nativeID={id ?? nativeID}
|
|
256
|
-
style={style}
|
|
257
|
-
// $FlowFixMe[incompatible-type]
|
|
258
|
-
pointerEvents={newPointerEvents}
|
|
259
248
|
ref={forwardedRef}
|
|
260
249
|
onKeyDown={_keyDown}
|
|
261
250
|
onKeyDownCapture={_keyDownCapture}
|