@office-iss/react-native-win32 0.75.2 → 0.76.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/.eslintrc.js +11 -0
- package/.flowconfig +5 -4
- package/CHANGELOG.json +164 -47
- package/CHANGELOG.md +53 -28
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
- package/Libraries/Animated/animations/Animation.js +11 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -1
- package/Libraries/Animated/animations/SpringAnimation.js +1 -1
- package/Libraries/Animated/animations/TimingAnimation.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +10 -9
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
- package/Libraries/Animated/nodes/AnimatedObject.js +56 -50
- package/Libraries/Animated/nodes/AnimatedProps.js +77 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
- package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
- package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
- package/Libraries/Animated/useAnimatedProps.js +142 -7
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +131 -169
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +230 -94
- package/Libraries/Components/TextInput/TextInput.win32.js +230 -100
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +0 -1
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/InitializeCore.js +3 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +4 -4
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Core/setUpGlobals.js +1 -0
- package/Libraries/Core/setUpReactRefresh.js +0 -4
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.win32.js +11 -24
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +1 -0
- package/Libraries/Inspector/Inspector.js +3 -2
- package/Libraries/Inspector/Inspector.win32.js +3 -2
- package/Libraries/Inspector/InspectorPanel.js +16 -10
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/LogBox/Data/LogBoxData.js +24 -3
- package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +9 -8
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +9 -29
- package/Libraries/Modal/Modal.js +0 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +8 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +22 -22
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/AppContainer-dev.js +1 -5
- package/Libraries/ReactNative/AppContainer-prod.js +1 -5
- package/Libraries/ReactNative/AppContainer.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +0 -6
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +26 -4
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/ReactNative/renderApplication.js +0 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +11 -4
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -5
- package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +231 -42
- package/Libraries/Text/Text.js +394 -196
- package/Libraries/Text/Text.win32.js +442 -229
- package/Libraries/Text/TextNativeComponent.js +2 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/Appearance.js +108 -84
- package/Libraries/Utilities/DevLoadingView.js +2 -4
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +0 -9
- package/Libraries/Utilities/stringifyViewConfig.js +22 -0
- package/Libraries/Utilities/useColorScheme.js +3 -3
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +6 -5
- package/flow/jest.js +2 -2
- package/index.js +3 -1
- package/index.win32.js +3 -1
- package/jest/mockComponent.js +4 -1
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -13
- package/jest.config.js +1 -2
- package/overrides.json +22 -22
- package/package.json +30 -30
- package/src/private/animated/NativeAnimatedHelper.js +438 -0
- package/src/private/animated/NativeAnimatedHelper.win32.js +440 -0
- package/src/private/animated/NativeAnimatedValidation.js +64 -0
- package/src/private/components/HScrollViewNativeComponents.js +56 -0
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
- package/src/private/components/VScrollViewNativeComponents.js +48 -0
- package/src/private/components/useSyncOnScroll.js +48 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +166 -16
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +29 -5
- package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeAppearance.js +3 -3
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWin.js +7 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +36 -18
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/types/experimental.d.ts +20 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +0 -617
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /package/src/private/{core → styles}/composeStyles.js +0 -0
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
|
|
12
13
|
import type {
|
|
13
14
|
PressEvent,
|
|
14
15
|
ScrollEvent,
|
|
@@ -17,6 +18,7 @@ import type {
|
|
|
17
18
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
18
19
|
import type {TextInputType} from './TextInput.flow';
|
|
19
20
|
|
|
21
|
+
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
20
22
|
import usePressability from '../../Pressability/usePressability';
|
|
21
23
|
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
22
24
|
import StyleSheet, {
|
|
@@ -1000,8 +1002,188 @@ export type Props = $ReadOnly<{|
|
|
|
1000
1002
|
value?: ?Stringish,
|
|
1001
1003
|
|}>;
|
|
1002
1004
|
|
|
1005
|
+
type ViewCommands = $NonMaybeType<
|
|
1006
|
+
| typeof AndroidTextInputCommands
|
|
1007
|
+
| typeof RCTMultilineTextInputNativeCommands
|
|
1008
|
+
| typeof RCTSinglelineTextInputNativeCommands,
|
|
1009
|
+
>;
|
|
1010
|
+
|
|
1011
|
+
type LastNativeSelection = {|
|
|
1012
|
+
selection: Selection,
|
|
1013
|
+
mostRecentEventCount: number,
|
|
1014
|
+
|};
|
|
1015
|
+
|
|
1003
1016
|
const emptyFunctionThatReturnsTrue = () => true;
|
|
1004
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* This hook handles the synchronization between the state of the text input
|
|
1020
|
+
* in native and in JavaScript. This is necessary due to the asynchronous nature
|
|
1021
|
+
* of text input events.
|
|
1022
|
+
*/
|
|
1023
|
+
function useTextInputStateSynchronization_STATE({
|
|
1024
|
+
props,
|
|
1025
|
+
mostRecentEventCount,
|
|
1026
|
+
selection,
|
|
1027
|
+
inputRef,
|
|
1028
|
+
text,
|
|
1029
|
+
viewCommands,
|
|
1030
|
+
}: {
|
|
1031
|
+
props: Props,
|
|
1032
|
+
mostRecentEventCount: number,
|
|
1033
|
+
selection: ?Selection,
|
|
1034
|
+
inputRef: React.RefObject<null | React.ElementRef<HostComponent<mixed>>>,
|
|
1035
|
+
text: string,
|
|
1036
|
+
viewCommands: ViewCommands,
|
|
1037
|
+
}): {
|
|
1038
|
+
setLastNativeText: string => void,
|
|
1039
|
+
setLastNativeSelection: LastNativeSelection => void,
|
|
1040
|
+
} {
|
|
1041
|
+
const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
|
|
1042
|
+
const [lastNativeSelectionState, setLastNativeSelection] =
|
|
1043
|
+
useState<LastNativeSelection>({
|
|
1044
|
+
selection: {start: -1, end: -1},
|
|
1045
|
+
mostRecentEventCount: mostRecentEventCount,
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
const lastNativeSelection = lastNativeSelectionState.selection;
|
|
1049
|
+
|
|
1050
|
+
// This is necessary in case native updates the text and JS decides
|
|
1051
|
+
// that the update should be ignored and we should stick with the value
|
|
1052
|
+
// that we have in JS.
|
|
1053
|
+
useLayoutEffect(() => {
|
|
1054
|
+
const nativeUpdate: {text?: string, selection?: Selection} = {};
|
|
1055
|
+
|
|
1056
|
+
if (lastNativeText !== props.value && typeof props.value === 'string') {
|
|
1057
|
+
nativeUpdate.text = props.value;
|
|
1058
|
+
setLastNativeText(props.value);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
if (
|
|
1062
|
+
selection &&
|
|
1063
|
+
lastNativeSelection &&
|
|
1064
|
+
(lastNativeSelection.start !== selection.start ||
|
|
1065
|
+
lastNativeSelection.end !== selection.end)
|
|
1066
|
+
) {
|
|
1067
|
+
nativeUpdate.selection = selection;
|
|
1068
|
+
setLastNativeSelection({selection, mostRecentEventCount});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (Object.keys(nativeUpdate).length === 0) {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
if (inputRef.current != null) {
|
|
1076
|
+
viewCommands.setTextAndSelection(
|
|
1077
|
+
inputRef.current,
|
|
1078
|
+
mostRecentEventCount,
|
|
1079
|
+
text,
|
|
1080
|
+
selection?.start ?? -1,
|
|
1081
|
+
selection?.end ?? -1,
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
}, [
|
|
1085
|
+
mostRecentEventCount,
|
|
1086
|
+
inputRef,
|
|
1087
|
+
props.value,
|
|
1088
|
+
props.defaultValue,
|
|
1089
|
+
lastNativeText,
|
|
1090
|
+
selection,
|
|
1091
|
+
lastNativeSelection,
|
|
1092
|
+
text,
|
|
1093
|
+
viewCommands,
|
|
1094
|
+
]);
|
|
1095
|
+
|
|
1096
|
+
return {setLastNativeText, setLastNativeSelection};
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* This hook handles the synchronization between the state of the text input
|
|
1101
|
+
* in native and in JavaScript. This is necessary due to the asynchronous nature
|
|
1102
|
+
* of text input events.
|
|
1103
|
+
*/
|
|
1104
|
+
function useTextInputStateSynchronization_REFS({
|
|
1105
|
+
props,
|
|
1106
|
+
mostRecentEventCount,
|
|
1107
|
+
selection,
|
|
1108
|
+
inputRef,
|
|
1109
|
+
text,
|
|
1110
|
+
viewCommands,
|
|
1111
|
+
}: {
|
|
1112
|
+
props: Props,
|
|
1113
|
+
mostRecentEventCount: number,
|
|
1114
|
+
selection: ?Selection,
|
|
1115
|
+
inputRef: React.RefObject<null | React.ElementRef<HostComponent<mixed>>>,
|
|
1116
|
+
text: string,
|
|
1117
|
+
viewCommands: ViewCommands,
|
|
1118
|
+
}): {
|
|
1119
|
+
setLastNativeText: string => void,
|
|
1120
|
+
setLastNativeSelection: LastNativeSelection => void,
|
|
1121
|
+
} {
|
|
1122
|
+
const lastNativeTextRef = useRef<?Stringish>(props.value);
|
|
1123
|
+
const lastNativeSelectionRef = useRef<LastNativeSelection>({
|
|
1124
|
+
selection: {start: -1, end: -1},
|
|
1125
|
+
mostRecentEventCount: mostRecentEventCount,
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
// This is necessary in case native updates the text and JS decides
|
|
1129
|
+
// that the update should be ignored and we should stick with the value
|
|
1130
|
+
// that we have in JS.
|
|
1131
|
+
useLayoutEffect(() => {
|
|
1132
|
+
const nativeUpdate: {text?: string, selection?: Selection} = {};
|
|
1133
|
+
|
|
1134
|
+
const lastNativeSelection = lastNativeSelectionRef.current.selection;
|
|
1135
|
+
|
|
1136
|
+
if (
|
|
1137
|
+
lastNativeTextRef.current !== props.value &&
|
|
1138
|
+
typeof props.value === 'string'
|
|
1139
|
+
) {
|
|
1140
|
+
nativeUpdate.text = props.value;
|
|
1141
|
+
lastNativeTextRef.current = props.value;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
if (
|
|
1145
|
+
selection &&
|
|
1146
|
+
lastNativeSelection &&
|
|
1147
|
+
(lastNativeSelection.start !== selection.start ||
|
|
1148
|
+
lastNativeSelection.end !== selection.end)
|
|
1149
|
+
) {
|
|
1150
|
+
nativeUpdate.selection = selection;
|
|
1151
|
+
lastNativeSelectionRef.current = {selection, mostRecentEventCount};
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
if (Object.keys(nativeUpdate).length === 0) {
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
if (inputRef.current != null) {
|
|
1159
|
+
viewCommands.setTextAndSelection(
|
|
1160
|
+
inputRef.current,
|
|
1161
|
+
mostRecentEventCount,
|
|
1162
|
+
text,
|
|
1163
|
+
selection?.start ?? -1,
|
|
1164
|
+
selection?.end ?? -1,
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
}, [
|
|
1168
|
+
mostRecentEventCount,
|
|
1169
|
+
inputRef,
|
|
1170
|
+
props.value,
|
|
1171
|
+
props.defaultValue,
|
|
1172
|
+
selection,
|
|
1173
|
+
text,
|
|
1174
|
+
viewCommands,
|
|
1175
|
+
]);
|
|
1176
|
+
|
|
1177
|
+
return {
|
|
1178
|
+
setLastNativeText: lastNativeText => {
|
|
1179
|
+
lastNativeTextRef.current = lastNativeText;
|
|
1180
|
+
},
|
|
1181
|
+
setLastNativeSelection: lastNativeSelection => {
|
|
1182
|
+
lastNativeSelectionRef.current = lastNativeSelection;
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1005
1187
|
/**
|
|
1006
1188
|
* A foundational component for inputting text into the app via a
|
|
1007
1189
|
* keyboard. Props provide configurability for several features, such as
|
|
@@ -1134,7 +1316,6 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1134
1316
|
|
|
1135
1317
|
const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
|
|
1136
1318
|
|
|
1137
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1138
1319
|
const selection: ?Selection =
|
|
1139
1320
|
propsSelection == null
|
|
1140
1321
|
? null
|
|
@@ -1143,34 +1324,6 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1143
1324
|
end: propsSelection.end ?? propsSelection.start,
|
|
1144
1325
|
};
|
|
1145
1326
|
|
|
1146
|
-
const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
|
|
1147
|
-
const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
|
|
1148
|
-
const [lastNativeSelectionState, setLastNativeSelection] = useState<{|
|
|
1149
|
-
selection: Selection,
|
|
1150
|
-
mostRecentEventCount: number,
|
|
1151
|
-
|}>({
|
|
1152
|
-
selection: {start: -1, end: -1},
|
|
1153
|
-
mostRecentEventCount: mostRecentEventCount,
|
|
1154
|
-
});
|
|
1155
|
-
|
|
1156
|
-
const lastNativeSelection = lastNativeSelectionState.selection;
|
|
1157
|
-
|
|
1158
|
-
let viewCommands;
|
|
1159
|
-
if (AndroidTextInputCommands) {
|
|
1160
|
-
viewCommands = AndroidTextInputCommands;
|
|
1161
|
-
}
|
|
1162
|
-
// [Windows
|
|
1163
|
-
else if (WindowsTextInputCommands) {
|
|
1164
|
-
viewCommands = WindowsTextInputCommands;
|
|
1165
|
-
}
|
|
1166
|
-
// Windows]
|
|
1167
|
-
else {
|
|
1168
|
-
viewCommands =
|
|
1169
|
-
props.multiline === true
|
|
1170
|
-
? RCTMultilineTextInputNativeCommands
|
|
1171
|
-
: RCTSinglelineTextInputNativeCommands;
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
1327
|
const text =
|
|
1175
1328
|
typeof props.value === 'string'
|
|
1176
1329
|
? props.value
|
|
@@ -1178,51 +1331,26 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1178
1331
|
? props.defaultValue
|
|
1179
1332
|
: '';
|
|
1180
1333
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
if (lastNativeText !== props.value && typeof props.value === 'string') {
|
|
1188
|
-
nativeUpdate.text = props.value;
|
|
1189
|
-
setLastNativeText(props.value);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
if (
|
|
1193
|
-
selection &&
|
|
1194
|
-
lastNativeSelection &&
|
|
1195
|
-
(lastNativeSelection.start !== selection.start ||
|
|
1196
|
-
lastNativeSelection.end !== selection.end)
|
|
1197
|
-
) {
|
|
1198
|
-
nativeUpdate.selection = selection;
|
|
1199
|
-
setLastNativeSelection({selection, mostRecentEventCount});
|
|
1200
|
-
}
|
|
1334
|
+
const viewCommands =
|
|
1335
|
+
WindowsTextInputCommands || AndroidTextInputCommands || // [Windows]
|
|
1336
|
+
(props.multiline === true
|
|
1337
|
+
? RCTMultilineTextInputNativeCommands
|
|
1338
|
+
: RCTSinglelineTextInputNativeCommands)
|
|
1201
1339
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
mostRecentEventCount,
|
|
1217
|
-
inputRef,
|
|
1218
|
-
props.value,
|
|
1219
|
-
props.defaultValue,
|
|
1220
|
-
lastNativeText,
|
|
1221
|
-
selection,
|
|
1222
|
-
lastNativeSelection,
|
|
1223
|
-
text,
|
|
1224
|
-
viewCommands,
|
|
1225
|
-
]);
|
|
1340
|
+
const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
|
|
1341
|
+
const useTextInputStateSynchronization =
|
|
1342
|
+
ReactNativeFeatureFlags.useRefsForTextInputState()
|
|
1343
|
+
? useTextInputStateSynchronization_REFS
|
|
1344
|
+
: useTextInputStateSynchronization_STATE;
|
|
1345
|
+
const {setLastNativeText, setLastNativeSelection} =
|
|
1346
|
+
useTextInputStateSynchronization({
|
|
1347
|
+
props,
|
|
1348
|
+
inputRef,
|
|
1349
|
+
mostRecentEventCount,
|
|
1350
|
+
selection,
|
|
1351
|
+
text,
|
|
1352
|
+
viewCommands,
|
|
1353
|
+
});
|
|
1226
1354
|
|
|
1227
1355
|
useLayoutEffect(() => {
|
|
1228
1356
|
const inputRefValue = inputRef.current;
|
|
@@ -1238,7 +1366,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1238
1366
|
}
|
|
1239
1367
|
};
|
|
1240
1368
|
}
|
|
1241
|
-
}, [
|
|
1369
|
+
}, []);
|
|
1242
1370
|
|
|
1243
1371
|
const setLocalRef = useCallback(
|
|
1244
1372
|
(instance: TextInputInstance | null) => {
|
|
@@ -1514,12 +1642,29 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1514
1642
|
};
|
|
1515
1643
|
}
|
|
1516
1644
|
|
|
1517
|
-
|
|
1645
|
+
// Keep the original (potentially nested) style when possible, as React can diff these more efficiently
|
|
1646
|
+
let _style = props.style;
|
|
1647
|
+
const flattenedStyle = flattenStyle<TextStyleProp>(props.style);
|
|
1648
|
+
if (flattenedStyle != null) {
|
|
1649
|
+
let overrides: ?{...TextStyleInternal} = null;
|
|
1650
|
+
if (typeof flattenedStyle?.fontWeight === 'number') {
|
|
1651
|
+
overrides = overrides || ({}: {...TextStyleInternal});
|
|
1652
|
+
overrides.fontWeight =
|
|
1653
|
+
// $FlowFixMe[incompatible-cast]
|
|
1654
|
+
(flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
|
|
1655
|
+
}
|
|
1518
1656
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1657
|
+
if (flattenedStyle.verticalAlign != null) {
|
|
1658
|
+
overrides = overrides || ({}: {...TextStyleInternal});
|
|
1659
|
+
overrides.textAlignVertical =
|
|
1660
|
+
verticalAlignToTextAlignVerticalMap[flattenedStyle.verticalAlign];
|
|
1661
|
+
overrides.verticalAlign = undefined;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
if (overrides != null) {
|
|
1665
|
+
// $FlowFixMe[incompatible-type]
|
|
1666
|
+
_style = [_style, overrides];
|
|
1667
|
+
}
|
|
1523
1668
|
}
|
|
1524
1669
|
|
|
1525
1670
|
if (Platform.OS === 'ios') {
|
|
@@ -1530,10 +1675,10 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1530
1675
|
|
|
1531
1676
|
const useMultilineDefaultStyle =
|
|
1532
1677
|
props.multiline === true &&
|
|
1533
|
-
(
|
|
1534
|
-
(
|
|
1535
|
-
|
|
1536
|
-
|
|
1678
|
+
(flattenedStyle == null ||
|
|
1679
|
+
(flattenedStyle.padding == null &&
|
|
1680
|
+
flattenedStyle.paddingVertical == null &&
|
|
1681
|
+
flattenedStyle.paddingTop == null));
|
|
1537
1682
|
|
|
1538
1683
|
textInput = (
|
|
1539
1684
|
<RCTTextInputView
|
|
@@ -1561,7 +1706,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1561
1706
|
selectionColor={selectionColor}
|
|
1562
1707
|
style={StyleSheet.compose(
|
|
1563
1708
|
useMultilineDefaultStyle ? styles.multilineDefault : null,
|
|
1564
|
-
|
|
1709
|
+
_style,
|
|
1565
1710
|
)}
|
|
1566
1711
|
text={text}
|
|
1567
1712
|
/>
|
|
@@ -1629,7 +1774,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1629
1774
|
onScroll={_onScroll}
|
|
1630
1775
|
onSelectionChange={_onSelectionChange}
|
|
1631
1776
|
placeholder={placeholder}
|
|
1632
|
-
style={
|
|
1777
|
+
style={_style}
|
|
1633
1778
|
text={text}
|
|
1634
1779
|
textBreakStrategy={props.textBreakStrategy}
|
|
1635
1780
|
/>
|
|
@@ -1783,20 +1928,6 @@ const ExportedForwardRef: React.AbstractComponent<
|
|
|
1783
1928
|
},
|
|
1784
1929
|
forwardedRef: ReactRefSetter<TextInputInstance>,
|
|
1785
1930
|
) {
|
|
1786
|
-
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
1787
|
-
let style = flattenStyle(restProps.style);
|
|
1788
|
-
|
|
1789
|
-
if (style?.verticalAlign != null) {
|
|
1790
|
-
// $FlowFixMe[prop-missing]
|
|
1791
|
-
// $FlowFixMe[cannot-write]
|
|
1792
|
-
style.textAlignVertical =
|
|
1793
|
-
// $FlowFixMe[invalid-computed-prop]
|
|
1794
|
-
verticalAlignToTextAlignVerticalMap[style.verticalAlign];
|
|
1795
|
-
// $FlowFixMe[prop-missing]
|
|
1796
|
-
// $FlowFixMe[cannot-write]
|
|
1797
|
-
delete style.verticalAlign;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
1931
|
return (
|
|
1801
1932
|
<InternalTextInput
|
|
1802
1933
|
allowFontScaling={allowFontScaling}
|
|
@@ -1832,7 +1963,6 @@ const ExportedForwardRef: React.AbstractComponent<
|
|
|
1832
1963
|
}
|
|
1833
1964
|
{...restProps}
|
|
1834
1965
|
forwardedRef={forwardedRef}
|
|
1835
|
-
style={style}
|
|
1836
1966
|
/>
|
|
1837
1967
|
);
|
|
1838
1968
|
});
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
|
|
13
13
|
import processAspectRatio from '../../StyleSheet/processAspectRatio';
|
|
14
|
+
import processBackgroundImage from '../../StyleSheet/processBackgroundImage';
|
|
15
|
+
import processBoxShadow from '../../StyleSheet/processBoxShadow';
|
|
14
16
|
import processColor from '../../StyleSheet/processColor';
|
|
15
17
|
import processFilter from '../../StyleSheet/processFilter';
|
|
16
18
|
import processFontVariant from '../../StyleSheet/processFontVariant';
|
|
@@ -120,6 +122,26 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
|
|
|
120
122
|
*/
|
|
121
123
|
experimental_filter: {process: processFilter},
|
|
122
124
|
|
|
125
|
+
/**
|
|
126
|
+
* MixBlendMode
|
|
127
|
+
*/
|
|
128
|
+
experimental_mixBlendMode: true,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Isolation
|
|
132
|
+
*/
|
|
133
|
+
isolation: true,
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* BoxShadow
|
|
137
|
+
*/
|
|
138
|
+
experimental_boxShadow: {process: processBoxShadow},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Linear Gradient
|
|
142
|
+
*/
|
|
143
|
+
experimental_backgroundImage: {process: processBackgroundImage},
|
|
144
|
+
|
|
123
145
|
/**
|
|
124
146
|
* View
|
|
125
147
|
*/
|
|
@@ -22,6 +22,8 @@ const UIView = {
|
|
|
22
22
|
accessibilityValue: true,
|
|
23
23
|
accessibilityHint: true,
|
|
24
24
|
accessibilityLanguage: true,
|
|
25
|
+
accessibilityShowsLargeContentViewer: true,
|
|
26
|
+
accessibilityLargeContentTitle: true,
|
|
25
27
|
importantForAccessibility: true,
|
|
26
28
|
nativeID: true,
|
|
27
29
|
testID: true,
|
|
@@ -22,6 +22,8 @@ const UIView = {
|
|
|
22
22
|
accessibilityValue: true,
|
|
23
23
|
accessibilityHint: true,
|
|
24
24
|
accessibilityLanguage: true,
|
|
25
|
+
accessibilityShowsLargeContentViewer: true,
|
|
26
|
+
accessibilityLargeContentTitle: true,
|
|
25
27
|
importantForAccessibility: true,
|
|
26
28
|
nativeID: true,
|
|
27
29
|
testID: true,
|
|
@@ -366,6 +366,21 @@ export interface AccessibilityPropsIOS {
|
|
|
366
366
|
* @platform ios
|
|
367
367
|
*/
|
|
368
368
|
accessibilityLanguage?: string | undefined;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A Boolean value that indicates whether or not to show the item in the large content viewer.
|
|
372
|
+
* Available on iOS 13.0+
|
|
373
|
+
* https://reactnative.dev/docs/accessibility#accessibilityshowslargecontentviewer
|
|
374
|
+
* @platform ios
|
|
375
|
+
*/
|
|
376
|
+
accessibilityShowsLargeContentViewer?: boolean | undefined;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* When `accessibilityShowsLargeContentViewer` is set, this string will be used as title for the large content viewer.
|
|
380
|
+
* https://reactnative.dev/docs/accessibility#accessibilitylargecontenttitle
|
|
381
|
+
* @platform ios
|
|
382
|
+
*/
|
|
383
|
+
accessibilityLargeContentTitle?: string | undefined;
|
|
369
384
|
}
|
|
370
385
|
|
|
371
386
|
// [Win32]
|
|
@@ -415,6 +415,20 @@ type IOSViewProps = $ReadOnly<{|
|
|
|
415
415
|
*/
|
|
416
416
|
accessibilityViewIsModal?: ?boolean,
|
|
417
417
|
|
|
418
|
+
/**
|
|
419
|
+
* @platform ios
|
|
420
|
+
*
|
|
421
|
+
* See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
|
|
422
|
+
*/
|
|
423
|
+
accessibilityShowsLargeContentViewer?: ?boolean,
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* @platform ios
|
|
427
|
+
*
|
|
428
|
+
* See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
|
|
429
|
+
*/
|
|
430
|
+
accessibilityLargeContentTitle?: ?string,
|
|
431
|
+
|
|
418
432
|
/**
|
|
419
433
|
* The aria-modal attribute indicates content contained within a modal with aria-modal="true"
|
|
420
434
|
* should be accessible to the user.
|
|
@@ -416,6 +416,20 @@ type IOSViewProps = $ReadOnly<{|
|
|
|
416
416
|
*/
|
|
417
417
|
accessibilityViewIsModal?: ?boolean,
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* @platform ios
|
|
421
|
+
*
|
|
422
|
+
* See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
|
|
423
|
+
*/
|
|
424
|
+
accessibilityShowsLargeContentViewer?: ?boolean,
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @platform ios
|
|
428
|
+
*
|
|
429
|
+
* See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
|
|
430
|
+
*/
|
|
431
|
+
accessibilityLargeContentTitle?: ?string,
|
|
432
|
+
|
|
419
433
|
/**
|
|
420
434
|
* The aria-modal attribute indicates content contained within a modal with aria-modal="true"
|
|
421
435
|
* should be accessible to the user.
|
|
@@ -154,6 +154,7 @@ function handleException(e: mixed, isFatal: boolean) {
|
|
|
154
154
|
inExceptionHandler = true;
|
|
155
155
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for this
|
|
156
156
|
* parameters */
|
|
157
|
+
// $FlowFixMe[incompatible-call]
|
|
157
158
|
reportException(error, isFatal, /*reportToConsole*/ true);
|
|
158
159
|
} finally {
|
|
159
160
|
inExceptionHandler = false;
|
|
@@ -225,6 +226,7 @@ function reactConsoleErrorHandler(...args) {
|
|
|
225
226
|
reportException(
|
|
226
227
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for this
|
|
227
228
|
* parameters */
|
|
229
|
+
// $FlowFixMe[incompatible-call]
|
|
228
230
|
error,
|
|
229
231
|
false, // isFatal
|
|
230
232
|
false, // reportToConsole
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
'use client';
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Sets up global variables typical in most JavaScript environments.
|
|
13
15
|
*
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
const start = Date.now();
|
|
28
30
|
|
|
29
31
|
require('./setUpGlobals');
|
|
30
|
-
require('../../src/private/
|
|
32
|
+
require('../../src/private/setup/setUpDOM').default();
|
|
31
33
|
require('./setUpPerformance');
|
|
32
34
|
require('./setUpErrorHandling');
|
|
33
35
|
require('./polyfillPromise');
|
|
@@ -32,14 +32,17 @@ const ReactFiberErrorDialog = {
|
|
|
32
32
|
if (errorValue instanceof Error) {
|
|
33
33
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
34
34
|
* this parameters */
|
|
35
|
+
// $FlowFixMe[incompatible-cast]
|
|
35
36
|
error = (errorValue: ExtendedError);
|
|
36
37
|
} else if (typeof errorValue === 'string') {
|
|
37
38
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
38
39
|
* this parameters */
|
|
40
|
+
// $FlowFixMe[incompatible-cast]
|
|
39
41
|
error = (new SyntheticError(errorValue): ExtendedError);
|
|
40
42
|
} else {
|
|
41
43
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
42
44
|
* this parameters */
|
|
45
|
+
// $FlowFixMe[incompatible-cast]
|
|
43
46
|
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
44
47
|
}
|
|
45
48
|
try {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @flow strict
|
|
8
|
-
* @generated by scripts/releases/set-
|
|
8
|
+
* @generated by scripts/releases/set-version.js
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
const version: $ReadOnly<{
|
|
@@ -15,9 +15,9 @@ const version: $ReadOnly<{
|
|
|
15
15
|
prerelease: string | null,
|
|
16
16
|
}> = {
|
|
17
17
|
major: 0,
|
|
18
|
-
minor:
|
|
19
|
-
patch:
|
|
20
|
-
prerelease:
|
|
18
|
+
minor: 76,
|
|
19
|
+
patch: 0,
|
|
20
|
+
prerelease: 'rc.0',
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
module.exports = {version};
|
|
@@ -36,7 +36,7 @@ const checkVersions = function checkVersions(): void {
|
|
|
36
36
|
`Native version: ${_formatVersion(nativeVersion)}\n\n` +
|
|
37
37
|
'Make sure that you have rebuilt the native code. If the problem ' +
|
|
38
38
|
'persists try clearing the Watchman and packager caches with ' +
|
|
39
|
-
'`watchman watch-del-all && npx react-native start --reset-cache`.',
|
|
39
|
+
'`watchman watch-del-all && npx @react-native-community/cli start --reset-cache`.',
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
@@ -21,7 +21,13 @@ ExceptionsManager.installConsoleErrorReporter();
|
|
|
21
21
|
if (!global.__fbDisableExceptionsManager) {
|
|
22
22
|
const handleError = (e: mixed, isFatal: boolean) => {
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
// TODO(T196834299): We should really use a c++ turbomodule for this
|
|
25
|
+
if (
|
|
26
|
+
!global.RN$handleException ||
|
|
27
|
+
!global.RN$handleException(e, isFatal)
|
|
28
|
+
) {
|
|
29
|
+
ExceptionsManager.handleException(e, isFatal);
|
|
30
|
+
}
|
|
25
31
|
} catch (ee) {
|
|
26
32
|
console.log('Failed to print error: ', ee.message);
|
|
27
33
|
throw e;
|
|
@@ -36,10 +36,6 @@ if (__DEV__) {
|
|
|
36
36
|
register: ReactRefreshRuntime.register,
|
|
37
37
|
|
|
38
38
|
performReactRefresh() {
|
|
39
|
-
if (ReactRefreshRuntime.hasUnrecoverableErrors()) {
|
|
40
|
-
DevSettings.reload('Fast Refresh - Unrecoverable');
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
39
|
ReactRefreshRuntime.performReactRefresh();
|
|
44
40
|
DevSettings.onFastRefresh();
|
|
45
41
|
},
|