@office-iss/react-native-win32 0.71.5 → 0.72.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +15 -3
- package/CHANGELOG.json +302 -47
- package/CHANGELOG.md +141 -27
- package/IntegrationTests/IntegrationTestHarnessTest.js +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
- package/Libraries/Alert/Alert.d.ts +4 -4
- package/Libraries/Alert/Alert.win32.js +1 -0
- package/Libraries/Animated/Animated.d.ts +17 -6
- package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +606 -0
- package/Libraries/Animated/bezier.js +1 -1
- package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
- package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
- package/Libraries/Animated/createAnimatedComponent.js +26 -239
- package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
- package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
- package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +7 -10
- package/Libraries/BatchedBridge/MessageQueue.js +2 -1
- package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
- package/Libraries/BatchedBridge/NativeModules.js +1 -0
- package/Libraries/Blob/Blob.js +4 -0
- package/Libraries/Blob/FileReader.js +30 -2
- package/Libraries/Blob/URL.js +3 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -3
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
- package/Libraries/Components/Button.js +3 -2
- package/Libraries/Components/Button.win32.js +451 -0
- package/Libraries/Components/Clipboard/Clipboard.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
- package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
- package/Libraries/Components/Pressable/Pressable.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -2
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
- package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +149 -91
- package/Libraries/Components/ScrollView/ScrollView.win32.js +1939 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -0
- package/Libraries/Components/Switch/Switch.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
- package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +51 -0
- package/Libraries/Components/TextInput/TextInput.Types.win32.js +3 -0
- package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
- package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
- package/Libraries/Components/TextInput/TextInput.js +130 -103
- package/Libraries/Components/TextInput/TextInput.win32.js +202 -890
- package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
- package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
- package/Libraries/Components/Touchable/Touchable.js +6 -3
- package/Libraries/Components/Touchable/Touchable.win32.js +6 -3
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +189 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
- package/Libraries/Components/View/View.js +71 -45
- package/Libraries/Components/View/View.win32.js +38 -16
- package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
- package/Libraries/Components/View/ViewAccessibility.js +10 -1
- package/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
- package/Libraries/Components/View/ViewNativeComponent.js +32 -8
- package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
- package/Libraries/Components/View/ViewPropTypes.js +1 -1
- package/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
- package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
- package/Libraries/Components/View/ViewWin32.js +3 -3
- package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
- package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
- package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/InitializeCore.js +2 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +1 -9
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -9
- package/Libraries/Core/Timers/JSTimers.js +1 -1
- package/Libraries/Core/Timers/immediateShim.js +1 -0
- package/Libraries/Core/Timers/queueMicrotask.js +1 -1
- package/Libraries/Core/setUpAlert.js +1 -1
- package/Libraries/Core/setUpDOM.js +18 -0
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpGlobals.js +5 -2
- package/Libraries/Core/setUpNavigator.js +6 -5
- package/Libraries/Core/setUpPerformance.js +23 -13
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Core/setUpSegmentFetcher.js +0 -41
- package/Libraries/Core/setUpTimers.js +2 -2
- package/Libraries/DOM/Geometry/DOMRect.js +82 -0
- package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
- package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
- package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
- package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
- package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
- package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +35 -0
- package/Libraries/{Utilities/NativeDevSplitBundleLoader.js → DevToolsSettings/NativeDevToolsSettingsManager.js} +7 -2
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
- package/Libraries/Events/EventPolyfill.js +1 -1
- package/Libraries/Image/AssetRegistry.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +3 -3
- package/Libraries/Image/Image.android.js +4 -1
- package/Libraries/Image/Image.d.ts +63 -2
- package/Libraries/Image/Image.ios.js +3 -0
- package/Libraries/Image/Image.win32.js +3 -0
- package/Libraries/Image/ImageBackground.js +1 -0
- package/Libraries/Image/ImageProps.js +1 -1
- package/Libraries/Image/ImageViewNativeComponent.js +4 -4
- package/Libraries/Image/RelativeImageStub.js +1 -1
- package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Inspector/DevtoolsOverlay.js +29 -19
- package/Libraries/Inspector/ElementBox.js +4 -1
- package/Libraries/Inspector/Inspector.js +5 -6
- package/Libraries/Inspector/Inspector.win32.js +7 -6
- package/Libraries/Inspector/InspectorOverlay.js +3 -3
- package/Libraries/Inspector/InspectorOverlay.win32.js +2 -1
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
- package/Libraries/Interaction/PanResponder.js +5 -6
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
- package/Libraries/Linking/Linking.js +1 -4
- package/Libraries/Lists/FillRateHelper.js +4 -238
- package/Libraries/Lists/FlatList.d.ts +15 -22
- package/Libraries/Lists/FlatList.js +9 -6
- package/Libraries/Lists/SectionList.d.ts +10 -6
- package/Libraries/Lists/SectionList.js +5 -3
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/Lists/ViewabilityHelper.js +8 -344
- package/Libraries/Lists/VirtualizeUtils.js +4 -244
- package/Libraries/Lists/VirtualizedList.js +10 -1867
- package/Libraries/Lists/VirtualizedListContext.js +6 -104
- package/Libraries/Lists/VirtualizedSectionList.js +9 -602
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +193 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +7 -3
- package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
- package/Libraries/Modal/Modal.js +2 -2
- package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +43 -19
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
- package/Libraries/NativeComponent/ViewConfig.js +1 -0
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
- package/Libraries/Network/RCTNetworking.android.js +2 -2
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/Pressability/Pressability.js +11 -5
- package/Libraries/Pressability/Pressability.win32.js +9 -3
- package/Libraries/ReactNative/AppContainer.js +7 -1
- package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
- package/Libraries/ReactNative/AppRegistry.js +10 -13
- package/Libraries/ReactNative/FabricUIManager.js +24 -8
- package/Libraries/ReactNative/NativeUIManager.js +5 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
- package/Libraries/ReactNative/UIManager.js +142 -1
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
- package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
- package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +38 -20
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
- package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
- package/Libraries/StyleSheet/flattenStyle.js +2 -0
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processColor.js +1 -1
- package/Libraries/Text/Text.d.ts +12 -2
- package/Libraries/Text/Text.js +50 -41
- package/Libraries/Text/TextProps.js +3 -4
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/Types/CodegenTypes.js +1 -0
- package/Libraries/UTFSequence.js +3 -1
- package/Libraries/Utilities/Appearance.d.ts +10 -0
- package/Libraries/Utilities/Appearance.js +13 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
- package/Libraries/Utilities/HMRClient.js +16 -10
- package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
- package/Libraries/Utilities/IPerformanceLogger.js +49 -0
- package/Libraries/Utilities/LoadingView.android.js +28 -11
- package/Libraries/Utilities/NativeAppearance.js +1 -0
- package/Libraries/Utilities/NativePlatformConstantsWin.js +1 -1
- package/Libraries/Utilities/PixelRatio.js +2 -2
- package/Libraries/Utilities/Platform.win32.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +2 -0
- package/Libraries/Utilities/createPerformanceLogger.js +55 -43
- package/Libraries/Utilities/stringifySafe.js +2 -7
- package/Libraries/Utilities/useColorScheme.js +1 -1
- package/Libraries/Utilities/useWindowDimensions.js +3 -3
- package/Libraries/WebPerformance/EventCounts.js +78 -0
- package/Libraries/WebPerformance/MemoryInfo.js +54 -0
- package/Libraries/WebPerformance/NativePerformance.js +38 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
- package/Libraries/WebPerformance/Performance.js +312 -0
- package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
- package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
- package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
- package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
- package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
- package/Libraries/vendor/core/ErrorUtils.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
- package/Libraries/vendor/emitter/EventEmitter.js +9 -1
- package/flow/global.js +29 -4
- package/flow/jest.js +258 -164
- package/index.js +56 -42
- package/index.win32.js +56 -42
- package/interface.js +1 -1
- package/jest/local-setup.js +33 -0
- package/jest/mockComponent.js +4 -2
- package/jest/mockNativeComponent.js +1 -1
- package/jest/mockScrollView.js +2 -1
- package/jest/react-native-env.js +1 -3
- package/jest/setup.js +11 -8
- package/overrides.json +115 -85
- package/package.json +38 -28
- package/rn-get-polyfills.js +1 -1
- package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +68 -0
- package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
- package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
- package/types/index.d.ts +2 -6
- package/types/modules/Codegen.d.ts +4 -4
- package/types/modules/globals.d.ts +27 -25
- package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
- package/types/public/ReactNativeRenderer.d.ts +2 -7
- package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
- package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
- package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
- package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
- package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
- package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -47
- package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
- package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -45
- package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
- package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
- package/Libraries/Components/Slider/Slider.d.ts +0 -132
- package/Libraries/Components/Slider/Slider.js +0 -282
- package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +0 -23
- package/Libraries/Interaction/Batchinator.js +0 -76
- package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
- package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
- package/Libraries/Interaction/PanResponder.flow.js +0 -257
- package/Libraries/Lists/CellRenderMask.js +0 -155
- package/Libraries/Lists/ChildListCollection.js +0 -72
- package/Libraries/Lists/StateSafePureComponent.js +0 -85
- package/Libraries/Lists/VirtualizedList.d.ts +0 -347
- package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
- package/Libraries/Lists/VirtualizedListProps.js +0 -279
- package/Libraries/Performance/PureComponentDebug.js +0 -74
- package/Libraries/Reliability/UserFlow.js +0 -158
- package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
- package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
- package/Libraries/Utilities/MatrixMath.js +0 -748
- package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
- package/Libraries/Utilities/clamp.js +0 -23
- package/Libraries/Utilities/deprecatedPropType.js +0 -36
- package/Libraries/Utilities/groupByEveryN.js +0 -51
- package/Libraries/Utilities/mergeIntoFast.js +0 -26
- package/Libraries/Utilities/setAndForwardRef.js +0 -71
- package/Libraries/Utilities/truncate.js +0 -51
- package/flow/JSITimerInternalType.js +0 -30
- package/flow/use-sync-external-store.js +0 -19
package/Libraries/Blob/Blob.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type Blob from './Blob';
|
|
12
12
|
|
|
13
13
|
import NativeFileReaderModule from './NativeFileReaderModule';
|
|
14
|
+
import {toByteArray} from 'base64-js';
|
|
14
15
|
|
|
15
16
|
const EventTarget = require('event-target-shim');
|
|
16
17
|
|
|
@@ -74,8 +75,35 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
readAsArrayBuffer():
|
|
78
|
-
|
|
78
|
+
readAsArrayBuffer(blob: ?Blob): void {
|
|
79
|
+
this._aborted = false;
|
|
80
|
+
|
|
81
|
+
if (blob == null) {
|
|
82
|
+
throw new TypeError(
|
|
83
|
+
"Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'",
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
NativeFileReaderModule.readAsDataURL(blob.data).then(
|
|
88
|
+
(text: string) => {
|
|
89
|
+
if (this._aborted) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const base64 = text.split(',')[1];
|
|
94
|
+
const typedArray = toByteArray(base64);
|
|
95
|
+
|
|
96
|
+
this._result = typedArray.buffer;
|
|
97
|
+
this._setReadyState(DONE);
|
|
98
|
+
},
|
|
99
|
+
error => {
|
|
100
|
+
if (this._aborted) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this._error = error;
|
|
104
|
+
this._setReadyState(DONE);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
79
107
|
}
|
|
80
108
|
|
|
81
109
|
readAsDataURL(blob: ?Blob): void {
|
package/Libraries/Blob/URL.js
CHANGED
|
@@ -20,6 +20,7 @@ if (
|
|
|
20
20
|
) {
|
|
21
21
|
const constants = NativeBlobModule.getConstants();
|
|
22
22
|
// $FlowFixMe[incompatible-type] asserted above
|
|
23
|
+
// $FlowFixMe[unsafe-addition]
|
|
23
24
|
BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':';
|
|
24
25
|
if (typeof constants.BLOB_URI_HOST === 'string') {
|
|
25
26
|
BLOB_URL_PREFIX += `//${constants.BLOB_URI_HOST}/`;
|
|
@@ -122,7 +123,7 @@ function validateBaseUrl(url: string) {
|
|
|
122
123
|
|
|
123
124
|
export class URL {
|
|
124
125
|
_url: string;
|
|
125
|
-
_searchParamsInstance = null;
|
|
126
|
+
_searchParamsInstance: ?URLSearchParams = null;
|
|
126
127
|
|
|
127
128
|
static createObjectURL(blob: Blob): string {
|
|
128
129
|
if (BLOB_URL_PREFIX === null) {
|
|
@@ -220,6 +221,7 @@ export class URL {
|
|
|
220
221
|
if (this._searchParamsInstance === null) {
|
|
221
222
|
return this._url;
|
|
222
223
|
}
|
|
224
|
+
// $FlowFixMe[incompatible-use]
|
|
223
225
|
const instanceString = this._searchParamsInstance.toString();
|
|
224
226
|
const separator = this._url.indexOf('?') > -1 ? '&' : '?';
|
|
225
227
|
return this._url + separator + instanceString;
|
|
@@ -37,7 +37,7 @@ type AccessibilityAnnouncementFinishedEventHandler = (
|
|
|
37
37
|
event: AccessibilityAnnouncementFinishedEvent,
|
|
38
38
|
) => void;
|
|
39
39
|
|
|
40
|
-
type AccessibilityEventTypes = 'click' | 'focus';
|
|
40
|
+
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @see https://reactnative.dev/docs/accessibilityinfo
|
|
@@ -137,7 +137,7 @@ export interface AccessibilityInfoStatic {
|
|
|
137
137
|
*/
|
|
138
138
|
announceForAccessibilityWithOptions(
|
|
139
139
|
announcement: string,
|
|
140
|
-
options: {queue?: boolean},
|
|
140
|
+
options: {queue?: boolean | undefined},
|
|
141
141
|
): void;
|
|
142
142
|
|
|
143
143
|
/**
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
|
13
|
-
import type {AccessibilityInfoType} from './AccessibilityInfo.flow';
|
|
14
13
|
import type {ElementRef} from 'react';
|
|
15
14
|
|
|
16
15
|
import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
|
|
@@ -42,7 +41,7 @@ type AccessibilityEventDefinitions = {
|
|
|
42
41
|
screenReaderChanged: [boolean],
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
type AccessibilityEventTypes = 'click' | 'focus';
|
|
44
|
+
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
|
|
46
45
|
|
|
47
46
|
// Mapping of public event names to platform-specific event names.
|
|
48
47
|
const EventNames: Map<
|
|
@@ -75,7 +74,7 @@ const EventNames: Map<
|
|
|
75
74
|
*
|
|
76
75
|
* See https://reactnative.dev/docs/accessibilityinfo
|
|
77
76
|
*/
|
|
78
|
-
const AccessibilityInfo
|
|
77
|
+
const AccessibilityInfo = {
|
|
79
78
|
/**
|
|
80
79
|
* Query whether bold text is currently enabled.
|
|
81
80
|
*
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
|
13
|
-
import type {AccessibilityInfoType} from './AccessibilityInfo.flow';
|
|
14
13
|
import type {ElementRef} from 'react';
|
|
15
14
|
|
|
16
15
|
import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
|
|
@@ -42,7 +41,7 @@ type AccessibilityEventDefinitions = {
|
|
|
42
41
|
screenReaderChanged: [boolean],
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
type AccessibilityEventTypes = 'click' | 'focus';
|
|
44
|
+
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
|
|
46
45
|
|
|
47
46
|
// Mapping of public event names to platform-specific event names.
|
|
48
47
|
const EventNames: Map<
|
|
@@ -81,7 +80,7 @@ const EventNames: Map<
|
|
|
81
80
|
*
|
|
82
81
|
* See https://reactnative.dev/docs/accessibilityinfo
|
|
83
82
|
*/
|
|
84
|
-
const AccessibilityInfo
|
|
83
|
+
const AccessibilityInfo = {
|
|
85
84
|
/**
|
|
86
85
|
* Query whether bold text is currently enabled.
|
|
87
86
|
*
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
|
+
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
13
14
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
14
|
-
import type {ActivityIndicator as ActivityIndicatorType} from './ActivityIndicator.flow';
|
|
15
15
|
|
|
16
16
|
import StyleSheet, {type ColorValue} from '../../StyleSheet/StyleSheet';
|
|
17
17
|
import Platform from '../../Utilities/Platform';
|
|
@@ -184,8 +184,10 @@ const ActivityIndicator = (
|
|
|
184
184
|
```
|
|
185
185
|
*/
|
|
186
186
|
|
|
187
|
-
const ActivityIndicatorWithRef:
|
|
188
|
-
|
|
187
|
+
const ActivityIndicatorWithRef: React.AbstractComponent<
|
|
188
|
+
Props,
|
|
189
|
+
HostComponent<mixed>,
|
|
190
|
+
> = React.forwardRef(ActivityIndicator);
|
|
189
191
|
ActivityIndicatorWithRef.displayName = 'ActivityIndicator';
|
|
190
192
|
|
|
191
193
|
const styles = StyleSheet.create({
|
|
@@ -203,4 +205,4 @@ const styles = StyleSheet.create({
|
|
|
203
205
|
},
|
|
204
206
|
});
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
export default ActivityIndicatorWithRef;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
|
|
14
15
|
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
15
16
|
import type {Button as ButtonType} from './Button.flow';
|
|
16
17
|
import type {
|
|
@@ -310,8 +311,8 @@ class Button extends React.Component<ButtonProps> {
|
|
|
310
311
|
accessibilityLanguage,
|
|
311
312
|
onAccessibilityAction,
|
|
312
313
|
} = this.props;
|
|
313
|
-
const buttonStyles = [styles.button];
|
|
314
|
-
const textStyles = [styles.text];
|
|
314
|
+
const buttonStyles: Array<ViewStyleProp> = [styles.button];
|
|
315
|
+
const textStyles: Array<TextStyleProp> = [styles.text];
|
|
315
316
|
if (color) {
|
|
316
317
|
if (Platform.OS === 'ios') {
|
|
317
318
|
textStyles.push({color: color});
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @flow
|
|
9
|
+
* @generate-docs
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
|
|
15
|
+
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
16
|
+
import type {Button as ButtonType} from './Button.flow';
|
|
17
|
+
import type {
|
|
18
|
+
AccessibilityActionEvent,
|
|
19
|
+
AccessibilityActionInfo,
|
|
20
|
+
AccessibilityState,
|
|
21
|
+
} from './View/ViewAccessibility';
|
|
22
|
+
|
|
23
|
+
import StyleSheet, {type ColorValue} from '../StyleSheet/StyleSheet';
|
|
24
|
+
import Text from '../Text/Text';
|
|
25
|
+
import Platform from '../Utilities/Platform';
|
|
26
|
+
import {PlatformColor} from '../StyleSheet/PlatformColorValueTypes';
|
|
27
|
+
import TouchableNativeFeedback from './Touchable/TouchableNativeFeedback';
|
|
28
|
+
import TouchableOpacity from './Touchable/TouchableOpacity';
|
|
29
|
+
import View from './View/View';
|
|
30
|
+
import invariant from 'invariant';
|
|
31
|
+
import * as React from 'react';
|
|
32
|
+
|
|
33
|
+
type ButtonProps = $ReadOnly<{|
|
|
34
|
+
/**
|
|
35
|
+
Text to display inside the button. On Android the given title will be
|
|
36
|
+
converted to the uppercased form.
|
|
37
|
+
*/
|
|
38
|
+
title: string,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
Handler to be called when the user taps the button. The first function
|
|
42
|
+
argument is an event in form of [PressEvent](pressevent).
|
|
43
|
+
*/
|
|
44
|
+
onPress: (event?: PressEvent) => mixed,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
If `true`, doesn't play system sound on touch.
|
|
48
|
+
|
|
49
|
+
@platform android
|
|
50
|
+
|
|
51
|
+
@default false
|
|
52
|
+
*/
|
|
53
|
+
touchSoundDisabled?: ?boolean,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
Color of the text (iOS), or background color of the button (Android).
|
|
57
|
+
|
|
58
|
+
@default {@platform android} '#2196F3'
|
|
59
|
+
@default {@platform ios} '#007AFF'
|
|
60
|
+
*/
|
|
61
|
+
color?: ?ColorValue,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
TV preferred focus.
|
|
65
|
+
|
|
66
|
+
@platform tv
|
|
67
|
+
|
|
68
|
+
@default false
|
|
69
|
+
*/
|
|
70
|
+
hasTVPreferredFocus?: ?boolean,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
Designates the next view to receive focus when the user navigates down. See
|
|
74
|
+
the [Android documentation][android:nextFocusDown].
|
|
75
|
+
|
|
76
|
+
[android:nextFocusDown]:
|
|
77
|
+
https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusDown
|
|
78
|
+
|
|
79
|
+
@platform android, tv
|
|
80
|
+
*/
|
|
81
|
+
nextFocusDown?: ?number,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
Designates the next view to receive focus when the user navigates forward.
|
|
85
|
+
See the [Android documentation][android:nextFocusForward].
|
|
86
|
+
|
|
87
|
+
[android:nextFocusForward]:
|
|
88
|
+
https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusForward
|
|
89
|
+
|
|
90
|
+
@platform android, tv
|
|
91
|
+
*/
|
|
92
|
+
nextFocusForward?: ?number,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
Designates the next view to receive focus when the user navigates left. See
|
|
96
|
+
the [Android documentation][android:nextFocusLeft].
|
|
97
|
+
|
|
98
|
+
[android:nextFocusLeft]:
|
|
99
|
+
https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusLeft
|
|
100
|
+
|
|
101
|
+
@platform android, tv
|
|
102
|
+
*/
|
|
103
|
+
nextFocusLeft?: ?number,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
Designates the next view to receive focus when the user navigates right. See
|
|
107
|
+
the [Android documentation][android:nextFocusRight].
|
|
108
|
+
|
|
109
|
+
[android:nextFocusRight]:
|
|
110
|
+
https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusRight
|
|
111
|
+
|
|
112
|
+
@platform android, tv
|
|
113
|
+
*/
|
|
114
|
+
nextFocusRight?: ?number,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
Designates the next view to receive focus when the user navigates up. See
|
|
118
|
+
the [Android documentation][android:nextFocusUp].
|
|
119
|
+
|
|
120
|
+
[android:nextFocusUp]:
|
|
121
|
+
https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusUp
|
|
122
|
+
|
|
123
|
+
@platform android, tv
|
|
124
|
+
*/
|
|
125
|
+
nextFocusUp?: ?number,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
Text to display for blindness accessibility features.
|
|
129
|
+
*/
|
|
130
|
+
accessibilityLabel?: ?string,
|
|
131
|
+
/**
|
|
132
|
+
* Alias for accessibilityLabel https://reactnative.dev/docs/view#accessibilitylabel
|
|
133
|
+
* https://github.com/facebook/react-native/issues/34424
|
|
134
|
+
*/
|
|
135
|
+
'aria-label'?: ?string,
|
|
136
|
+
/**
|
|
137
|
+
If `true`, disable all interactions for this component.
|
|
138
|
+
|
|
139
|
+
@default false
|
|
140
|
+
*/
|
|
141
|
+
disabled?: ?boolean,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
Used to locate this view in end-to-end tests.
|
|
145
|
+
*/
|
|
146
|
+
testID?: ?string,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Accessibility props.
|
|
150
|
+
*/
|
|
151
|
+
accessible?: ?boolean,
|
|
152
|
+
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
153
|
+
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
|
154
|
+
accessibilityState?: ?AccessibilityState,
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* alias for accessibilityState
|
|
158
|
+
*
|
|
159
|
+
* see https://reactnative.dev/docs/accessibility#accessibilitystate
|
|
160
|
+
*/
|
|
161
|
+
'aria-busy'?: ?boolean,
|
|
162
|
+
'aria-checked'?: ?boolean | 'mixed',
|
|
163
|
+
'aria-disabled'?: ?boolean,
|
|
164
|
+
'aria-expanded'?: ?boolean,
|
|
165
|
+
'aria-selected'?: ?boolean,
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* [Android] Controlling if a view fires accessibility events and if it is reported to accessibility services.
|
|
169
|
+
*/
|
|
170
|
+
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
171
|
+
accessibilityHint?: ?string,
|
|
172
|
+
accessibilityLanguage?: ?Stringish,
|
|
173
|
+
|}>;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
A basic button component that should render nicely on any platform. Supports a
|
|
177
|
+
minimal level of customization.
|
|
178
|
+
|
|
179
|
+
If this button doesn't look right for your app, you can build your own button
|
|
180
|
+
using [TouchableOpacity](touchableopacity) or
|
|
181
|
+
[TouchableWithoutFeedback](touchablewithoutfeedback). For inspiration, look at
|
|
182
|
+
the [source code for this button component][button:source]. Or, take a look at
|
|
183
|
+
the [wide variety of button components built by the community]
|
|
184
|
+
[button:examples].
|
|
185
|
+
|
|
186
|
+
[button:source]:
|
|
187
|
+
https://github.com/facebook/react-native/blob/HEAD/Libraries/Components/Button.js
|
|
188
|
+
|
|
189
|
+
[button:examples]:
|
|
190
|
+
https://js.coach/?menu%5Bcollections%5D=React%20Native&page=1&query=button
|
|
191
|
+
|
|
192
|
+
```jsx
|
|
193
|
+
<Button
|
|
194
|
+
onPress={onPressLearnMore}
|
|
195
|
+
title="Learn More"
|
|
196
|
+
color="#841584"
|
|
197
|
+
accessibilityLabel="Learn more about this purple button"
|
|
198
|
+
/>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```SnackPlayer name=Button%20Example
|
|
202
|
+
import React from 'react';
|
|
203
|
+
import { StyleSheet, Button, View, SafeAreaView, Text, Alert } from 'react-native';
|
|
204
|
+
|
|
205
|
+
const Separator = () => (
|
|
206
|
+
<View style={styles.separator} />
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const App = () => (
|
|
210
|
+
<SafeAreaView style={styles.container}>
|
|
211
|
+
<View>
|
|
212
|
+
<Text style={styles.title}>
|
|
213
|
+
The title and onPress handler are required. It is recommended to set accessibilityLabel to help make your app usable by everyone.
|
|
214
|
+
</Text>
|
|
215
|
+
<Button
|
|
216
|
+
title="Press me"
|
|
217
|
+
onPress={() => Alert.alert('Simple Button pressed')}
|
|
218
|
+
/>
|
|
219
|
+
</View>
|
|
220
|
+
<Separator />
|
|
221
|
+
<View>
|
|
222
|
+
<Text style={styles.title}>
|
|
223
|
+
Adjust the color in a way that looks standard on each platform. On iOS, the color prop controls the color of the text. On Android, the color adjusts the background color of the button.
|
|
224
|
+
</Text>
|
|
225
|
+
<Button
|
|
226
|
+
title="Press me"
|
|
227
|
+
color="#f194ff"
|
|
228
|
+
onPress={() => Alert.alert('Button with adjusted color pressed')}
|
|
229
|
+
/>
|
|
230
|
+
</View>
|
|
231
|
+
<Separator />
|
|
232
|
+
<View>
|
|
233
|
+
<Text style={styles.title}>
|
|
234
|
+
All interaction for the component are disabled.
|
|
235
|
+
</Text>
|
|
236
|
+
<Button
|
|
237
|
+
title="Press me"
|
|
238
|
+
disabled
|
|
239
|
+
onPress={() => Alert.alert('Cannot press this one')}
|
|
240
|
+
/>
|
|
241
|
+
</View>
|
|
242
|
+
<Separator />
|
|
243
|
+
<View>
|
|
244
|
+
<Text style={styles.title}>
|
|
245
|
+
This layout strategy lets the title define the width of the button.
|
|
246
|
+
</Text>
|
|
247
|
+
<View style={styles.fixToText}>
|
|
248
|
+
<Button
|
|
249
|
+
title="Left button"
|
|
250
|
+
onPress={() => Alert.alert('Left button pressed')}
|
|
251
|
+
/>
|
|
252
|
+
<Button
|
|
253
|
+
title="Right button"
|
|
254
|
+
onPress={() => Alert.alert('Right button pressed')}
|
|
255
|
+
/>
|
|
256
|
+
</View>
|
|
257
|
+
</View>
|
|
258
|
+
</SafeAreaView>
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
const styles = StyleSheet.create({
|
|
262
|
+
container: {
|
|
263
|
+
flex: 1,
|
|
264
|
+
justifyContent: 'center',
|
|
265
|
+
marginHorizontal: 16,
|
|
266
|
+
},
|
|
267
|
+
title: {
|
|
268
|
+
textAlign: 'center',
|
|
269
|
+
marginVertical: 8,
|
|
270
|
+
},
|
|
271
|
+
fixToText: {
|
|
272
|
+
flexDirection: 'row',
|
|
273
|
+
justifyContent: 'space-between',
|
|
274
|
+
},
|
|
275
|
+
separator: {
|
|
276
|
+
marginVertical: 8,
|
|
277
|
+
borderBottomColor: '#737373',
|
|
278
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
export default App;
|
|
283
|
+
```
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
class Button extends React.Component<ButtonProps> {
|
|
287
|
+
render(): React.Node {
|
|
288
|
+
const {
|
|
289
|
+
accessibilityLabel,
|
|
290
|
+
accessibilityState,
|
|
291
|
+
'aria-busy': ariaBusy,
|
|
292
|
+
'aria-checked': ariaChecked,
|
|
293
|
+
'aria-disabled': ariaDisabled,
|
|
294
|
+
'aria-expanded': ariaExpanded,
|
|
295
|
+
'aria-label': ariaLabel,
|
|
296
|
+
'aria-selected': ariaSelected,
|
|
297
|
+
importantForAccessibility,
|
|
298
|
+
color,
|
|
299
|
+
onPress,
|
|
300
|
+
touchSoundDisabled,
|
|
301
|
+
title,
|
|
302
|
+
hasTVPreferredFocus,
|
|
303
|
+
nextFocusDown,
|
|
304
|
+
nextFocusForward,
|
|
305
|
+
nextFocusLeft,
|
|
306
|
+
nextFocusRight,
|
|
307
|
+
nextFocusUp,
|
|
308
|
+
testID,
|
|
309
|
+
accessible,
|
|
310
|
+
accessibilityActions,
|
|
311
|
+
accessibilityHint,
|
|
312
|
+
accessibilityLanguage,
|
|
313
|
+
onAccessibilityAction,
|
|
314
|
+
} = this.props;
|
|
315
|
+
const buttonStyles: Array<ViewStyleProp> = [styles.button];
|
|
316
|
+
const textStyles: Array<TextStyleProp> = [styles.text];
|
|
317
|
+
if (color) {
|
|
318
|
+
if (Platform.OS === 'ios') {
|
|
319
|
+
textStyles.push({color: color});
|
|
320
|
+
} else {
|
|
321
|
+
buttonStyles.push({backgroundColor: color});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
let _accessibilityState = {
|
|
326
|
+
busy: ariaBusy ?? accessibilityState?.busy,
|
|
327
|
+
checked: ariaChecked ?? accessibilityState?.checked,
|
|
328
|
+
disabled: ariaDisabled ?? accessibilityState?.disabled,
|
|
329
|
+
expanded: ariaExpanded ?? accessibilityState?.expanded,
|
|
330
|
+
selected: ariaSelected ?? accessibilityState?.selected,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const disabled =
|
|
334
|
+
this.props.disabled != null
|
|
335
|
+
? this.props.disabled
|
|
336
|
+
: _accessibilityState?.disabled;
|
|
337
|
+
|
|
338
|
+
_accessibilityState =
|
|
339
|
+
disabled !== _accessibilityState?.disabled
|
|
340
|
+
? {..._accessibilityState, disabled}
|
|
341
|
+
: _accessibilityState;
|
|
342
|
+
|
|
343
|
+
if (disabled) {
|
|
344
|
+
buttonStyles.push(styles.buttonDisabled);
|
|
345
|
+
textStyles.push(styles.textDisabled);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
invariant(
|
|
349
|
+
typeof title === 'string',
|
|
350
|
+
'The title prop of a Button must be a string',
|
|
351
|
+
);
|
|
352
|
+
const formattedTitle =
|
|
353
|
+
Platform.OS === 'android' ? title.toUpperCase() : title;
|
|
354
|
+
const Touchable =
|
|
355
|
+
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
356
|
+
|
|
357
|
+
// If `no` is specified for `importantForAccessibility`, it will be changed to `no-hide-descendants` because the text inside should not be focused.
|
|
358
|
+
const _importantForAccessibility =
|
|
359
|
+
importantForAccessibility === 'no'
|
|
360
|
+
? 'no-hide-descendants'
|
|
361
|
+
: importantForAccessibility;
|
|
362
|
+
|
|
363
|
+
return (
|
|
364
|
+
<Touchable
|
|
365
|
+
accessible={accessible}
|
|
366
|
+
accessibilityActions={accessibilityActions}
|
|
367
|
+
onAccessibilityAction={onAccessibilityAction}
|
|
368
|
+
accessibilityLabel={ariaLabel || accessibilityLabel}
|
|
369
|
+
accessibilityHint={accessibilityHint}
|
|
370
|
+
accessibilityLanguage={accessibilityLanguage}
|
|
371
|
+
accessibilityRole="button"
|
|
372
|
+
accessibilityState={_accessibilityState}
|
|
373
|
+
importantForAccessibility={_importantForAccessibility}
|
|
374
|
+
hasTVPreferredFocus={hasTVPreferredFocus}
|
|
375
|
+
nextFocusDown={nextFocusDown}
|
|
376
|
+
nextFocusForward={nextFocusForward}
|
|
377
|
+
nextFocusLeft={nextFocusLeft}
|
|
378
|
+
nextFocusRight={nextFocusRight}
|
|
379
|
+
nextFocusUp={nextFocusUp}
|
|
380
|
+
testID={testID}
|
|
381
|
+
disabled={disabled}
|
|
382
|
+
onPress={onPress}
|
|
383
|
+
touchSoundDisabled={touchSoundDisabled}>
|
|
384
|
+
<View style={buttonStyles}>
|
|
385
|
+
<Text style={textStyles} disabled={disabled}>
|
|
386
|
+
{formattedTitle}
|
|
387
|
+
</Text>
|
|
388
|
+
</View>
|
|
389
|
+
</Touchable>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const styles = StyleSheet.create({
|
|
395
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
396
|
+
button: Platform.select({
|
|
397
|
+
ios: {},
|
|
398
|
+
android: {
|
|
399
|
+
elevation: 4,
|
|
400
|
+
// Material design blue from https://material.google.com/style/color.html#color-color-palette
|
|
401
|
+
backgroundColor: '#2196F3',
|
|
402
|
+
borderRadius: 2,
|
|
403
|
+
},
|
|
404
|
+
}),
|
|
405
|
+
text: {
|
|
406
|
+
textAlign: 'center',
|
|
407
|
+
margin: 8,
|
|
408
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
409
|
+
...Platform.select({
|
|
410
|
+
ios: {
|
|
411
|
+
// iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
|
|
412
|
+
color: '#007AFF',
|
|
413
|
+
fontSize: 18,
|
|
414
|
+
},
|
|
415
|
+
android: {
|
|
416
|
+
color: 'white',
|
|
417
|
+
fontWeight: '500',
|
|
418
|
+
},
|
|
419
|
+
}),
|
|
420
|
+
},
|
|
421
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
422
|
+
buttonDisabled: Platform.select({
|
|
423
|
+
ios: {},
|
|
424
|
+
android: {
|
|
425
|
+
elevation: 0,
|
|
426
|
+
backgroundColor: '#dfdfdf',
|
|
427
|
+
},
|
|
428
|
+
// [Windows
|
|
429
|
+
windows: {
|
|
430
|
+
backgroundColor: PlatformColor('ButtonBackgroundDisabled'),
|
|
431
|
+
borderColor: PlatformColor('ButtonBorderBrushDisabled'),
|
|
432
|
+
},
|
|
433
|
+
// Windows]
|
|
434
|
+
}),
|
|
435
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
436
|
+
textDisabled: Platform.select({
|
|
437
|
+
ios: {
|
|
438
|
+
color: '#cdcdcd',
|
|
439
|
+
},
|
|
440
|
+
android: {
|
|
441
|
+
color: '#a1a1a1',
|
|
442
|
+
},
|
|
443
|
+
// [Windows
|
|
444
|
+
windows: {
|
|
445
|
+
color: PlatformColor('ButtonForegroundDisabled'),
|
|
446
|
+
},
|
|
447
|
+
// Windows]
|
|
448
|
+
}),
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
module.exports = (Button: ButtonType);
|
|
@@ -32,7 +32,7 @@ module.exports = {
|
|
|
32
32
|
* Clipboard.setString('hello world');
|
|
33
33
|
* }
|
|
34
34
|
* ```
|
|
35
|
-
* @param the content to be stored in the clipboard.
|
|
35
|
+
* @param {string} content the content to be stored in the clipboard.
|
|
36
36
|
*/
|
|
37
37
|
setString(content: string) {
|
|
38
38
|
NativeClipboard.setString(content);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {AccessibilityRole} from '../../Components/View/ViewAccessibility';
|
|
11
12
|
import type {
|
|
12
13
|
MeasureInWindowOnSuccessCallback,
|
|
13
14
|
MeasureLayoutOnSuccessCallback,
|
|
@@ -36,6 +37,8 @@ type DrawerSlideEvent = $ReadOnly<{|
|
|
|
36
37
|
|}>;
|
|
37
38
|
|
|
38
39
|
type Props = $ReadOnly<{|
|
|
40
|
+
accessibilityRole?: ?AccessibilityRole,
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* Determines whether the keyboard gets dismissed in response to a drag.
|
|
41
44
|
* - 'none' (the default), drags do not dismiss the keyboard.
|
|
@@ -235,6 +238,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
|
|
|
235
238
|
* LTI update could not be added via codemod */
|
|
236
239
|
_onDrawerSlide = event => {
|
|
237
240
|
if (this.props.onDrawerSlide) {
|
|
241
|
+
// $FlowFixMe[unused-promise]
|
|
238
242
|
this.props.onDrawerSlide(event);
|
|
239
243
|
}
|
|
240
244
|
if (this.props.keyboardDismissMode === 'on-drag') {
|