@office-iss/react-native-win32 0.0.0-canary.258 → 0.0.0-canary.260
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 +2 -4
- package/CHANGELOG.json +31 -1
- package/CHANGELOG.md +24 -8
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/animations/Animation.js +10 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
- package/Libraries/Animated/createAnimatedComponent.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -0
- package/Libraries/Animated/useAnimatedProps.js +138 -6
- 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/AndroidHorizontalScrollViewNativeComponent.js +3 -0
- package/Libraries/Components/ScrollView/ScrollView.js +5 -5
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +220 -80
- package/Libraries/Components/TextInput/TextInput.win32.js +220 -86
- 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 +6 -0
- 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 +1 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- 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 +10 -21
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +4 -0
- 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 +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +31 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +9 -2
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- 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 +24 -2
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -19
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -23
- package/Libraries/StyleSheet/processBackgroundImage.js +286 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +24 -14
- package/Libraries/Text/Text.js +395 -212
- package/Libraries/Text/Text.win32.js +443 -245
- package/Libraries/Text/TextNativeComponent.js +7 -0
- package/Libraries/Text/TextNativeComponent.win32.js +7 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/HMRClient.js +1 -0
- package/Libraries/Utilities/Platform.android.js +1 -1
- package/Libraries/Utilities/Platform.d.ts +1 -1
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +1 -0
- package/flow/jest.js +2 -2
- package/index.js +1 -0
- package/index.win32.js +1 -0
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -9
- package/overrides.json +16 -16
- package/package.json +15 -15
- package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
- package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
- package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +143 -19
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +25 -5
- package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
- package/src/private/hooks/useDebouncedEffect.js +23 -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/NativeDebuggerSessionObserver.js +23 -0
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWin.js +8 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +1 -1
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +5 -8
- 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 +1 -1
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +5 -5
- 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/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/Text/TextOptimized.js +0 -538
- 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
|
-
|
|
1334
|
+
const viewCommands =
|
|
1335
|
+
WindowsTextInputCommands || AndroidTextInputCommands || // [Windows]
|
|
1336
|
+
(props.multiline === true
|
|
1337
|
+
? RCTMultilineTextInputNativeCommands
|
|
1338
|
+
: RCTSinglelineTextInputNativeCommands)
|
|
1186
1339
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
if (Object.keys(nativeUpdate).length === 0) {
|
|
1203
|
-
return;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
if (inputRef.current != null) {
|
|
1207
|
-
viewCommands.setTextAndSelection(
|
|
1208
|
-
inputRef.current,
|
|
1209
|
-
mostRecentEventCount,
|
|
1210
|
-
text,
|
|
1211
|
-
selection?.start ?? -1,
|
|
1212
|
-
selection?.end ?? -1,
|
|
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,18 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1514
1642
|
};
|
|
1515
1643
|
}
|
|
1516
1644
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
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 (typeof flattenedStyle?.fontWeight === 'number') {
|
|
1649
|
+
_style = [
|
|
1650
|
+
_style,
|
|
1651
|
+
{
|
|
1652
|
+
fontWeight:
|
|
1653
|
+
// $FlowFixMe[incompatible-cast]
|
|
1654
|
+
(flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']),
|
|
1655
|
+
},
|
|
1656
|
+
];
|
|
1523
1657
|
}
|
|
1524
1658
|
|
|
1525
1659
|
if (Platform.OS === 'ios') {
|
|
@@ -1530,10 +1664,10 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1530
1664
|
|
|
1531
1665
|
const useMultilineDefaultStyle =
|
|
1532
1666
|
props.multiline === true &&
|
|
1533
|
-
(
|
|
1534
|
-
(
|
|
1535
|
-
|
|
1536
|
-
|
|
1667
|
+
(flattenedStyle == null ||
|
|
1668
|
+
(flattenedStyle.padding == null &&
|
|
1669
|
+
flattenedStyle.paddingVertical == null &&
|
|
1670
|
+
flattenedStyle.paddingTop == null));
|
|
1537
1671
|
|
|
1538
1672
|
textInput = (
|
|
1539
1673
|
<RCTTextInputView
|
|
@@ -1561,7 +1695,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1561
1695
|
selectionColor={selectionColor}
|
|
1562
1696
|
style={StyleSheet.compose(
|
|
1563
1697
|
useMultilineDefaultStyle ? styles.multilineDefault : null,
|
|
1564
|
-
|
|
1698
|
+
_style,
|
|
1565
1699
|
)}
|
|
1566
1700
|
text={text}
|
|
1567
1701
|
/>
|
|
@@ -1629,7 +1763,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1629
1763
|
onScroll={_onScroll}
|
|
1630
1764
|
onSelectionChange={_onSelectionChange}
|
|
1631
1765
|
placeholder={placeholder}
|
|
1632
|
-
style={
|
|
1766
|
+
style={_style}
|
|
1633
1767
|
text={text}
|
|
1634
1768
|
textBreakStrategy={props.textBreakStrategy}
|
|
1635
1769
|
/>
|
|
@@ -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]
|
|
@@ -94,11 +94,17 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|
|
94
94
|
borderBlockStartColor: {
|
|
95
95
|
process: require('../../StyleSheet/processColor').default,
|
|
96
96
|
},
|
|
97
|
+
experimental_boxShadow: {
|
|
98
|
+
process: require('../../StyleSheet/processBoxShadow').default,
|
|
99
|
+
},
|
|
97
100
|
|
|
98
101
|
focusable: true,
|
|
99
102
|
overflow: true,
|
|
100
103
|
backfaceVisibility: true,
|
|
101
104
|
experimental_layoutConformance: true,
|
|
105
|
+
experimental_backgroundImage: {
|
|
106
|
+
process: require('../../StyleSheet/processBackgroundImage').default,
|
|
107
|
+
},
|
|
102
108
|
},
|
|
103
109
|
}
|
|
104
110
|
: {
|
|
@@ -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
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
const start = Date.now();
|
|
30
30
|
|
|
31
31
|
require('./setUpGlobals');
|
|
32
|
-
require('../../src/private/
|
|
32
|
+
require('../../src/private/setup/setUpDOM').default();
|
|
33
33
|
require('./setUpPerformance');
|
|
34
34
|
require('./setUpErrorHandling');
|
|
35
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 {
|
|
@@ -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
|
},
|
|
@@ -18,7 +18,10 @@ export type ResolvedAssetSource = {|
|
|
|
18
18
|
+scale: number,
|
|
19
19
|
|};
|
|
20
20
|
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
AssetDestPathResolver,
|
|
23
|
+
PackagerAsset,
|
|
24
|
+
} from '@react-native/assets-registry/registry';
|
|
22
25
|
|
|
23
26
|
const PixelRatio = require('../Utilities/PixelRatio').default;
|
|
24
27
|
const Platform = require('../Utilities/Platform');
|
|
@@ -76,6 +79,10 @@ class AssetSourceResolver {
|
|
|
76
79
|
return this.assetServerURL();
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
if (this.asset.resolver != null) {
|
|
83
|
+
return this.getAssetUsingResolver(this.asset.resolver);
|
|
84
|
+
}
|
|
85
|
+
|
|
79
86
|
if (Platform.OS === 'android') {
|
|
80
87
|
return this.isLoadedFromFileSystem()
|
|
81
88
|
? this.drawableFolderInBundle()
|
|
@@ -85,6 +92,26 @@ class AssetSourceResolver {
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
getAssetUsingResolver(resolver: AssetDestPathResolver): ResolvedAssetSource {
|
|
96
|
+
switch (resolver) {
|
|
97
|
+
case 'android':
|
|
98
|
+
return this.isLoadedFromFileSystem()
|
|
99
|
+
? this.drawableFolderInBundle()
|
|
100
|
+
: this.resourceIdentifierWithoutScale();
|
|
101
|
+
case 'generic':
|
|
102
|
+
return this.scaledAssetURLNearBundle();
|
|
103
|
+
default:
|
|
104
|
+
throw new Error(
|
|
105
|
+
"Don't know how to get asset via provided resolver: " +
|
|
106
|
+
resolver +
|
|
107
|
+
'\nAsset: ' +
|
|
108
|
+
JSON.stringify(this.asset, null, '\t') +
|
|
109
|
+
'\nPossible resolvers are:' +
|
|
110
|
+
JSON.stringify(['android', 'generic'], null, '\t'),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
88
115
|
/**
|
|
89
116
|
* Returns an absolute URL which can be used to fetch the asset
|
|
90
117
|
* from the devserver
|