@office-iss/react-native-win32 0.68.0 → 0.69.0-preview.3
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 +1 -0
- package/.flowconfig +1 -3
- package/CHANGELOG.json +386 -32
- package/CHANGELOG.md +166 -19
- package/IntegrationTests/BUCK +4 -1
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -0
- package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +1 -0
- package/Libraries/Alert/Alert.win32.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +55 -9
- package/Libraries/Animated/NativeAnimatedModule.js +1 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +6 -11
- package/Libraries/Animated/createAnimatedComponent.js +2 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +95 -29
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +19 -22
- package/Libraries/Animated/nodes/AnimatedNode.js +2 -2
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/AppState/AppState.js +1 -1
- package/Libraries/Blob/URL.js +7 -1
- package/Libraries/Components/Button.js +3 -0
- package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +5 -0
- package/Libraries/Components/Pressable/Pressable.js +3 -3
- package/Libraries/Components/Pressable/Pressable.win32.js +3 -3
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +47 -38
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +15 -7
- package/Libraries/Components/ScrollView/ScrollView.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -3
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -1
- package/Libraries/Components/Slider/Slider.js +0 -2
- package/Libraries/Components/Slider/SliderNativeComponent.js +0 -1
- package/Libraries/Components/StatusBar/StatusBar.js +6 -1
- package/Libraries/Components/Switch/Switch.js +11 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +114 -109
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +17 -9
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +13 -5
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +10 -0
- package/Libraries/Components/TextInput/TextInput.js +1 -8
- package/Libraries/Components/TextInput/TextInputState.js +10 -2
- package/Libraries/Components/TextInput/TextInputState.win32.js +10 -2
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -0
- package/Libraries/Components/Touchable/TouchableOpacity.js +7 -1
- package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +3 -1
- package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.win32.js +33 -1
- package/Libraries/Components/View/ViewNativeComponent.js +68 -8
- package/Libraries/Components/View/ViewPropTypes.js +36 -4
- package/Libraries/Components/View/ViewPropTypes.win32.js +36 -4
- package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
- package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
- package/Libraries/Core/Devtools/parseHermesStack.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +1 -1
- package/Libraries/Core/RawEventEmitter.js +38 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/polyfillPromise.js +32 -0
- package/Libraries/Core/setUpReactDevTools.js +3 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +3 -3
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +2 -1
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -3
- package/Libraries/Events/CustomEvent.js +32 -0
- package/Libraries/Events/EventPolyfill.js +239 -0
- package/Libraries/Image/Image.android.js +0 -6
- package/Libraries/Image/Image.ios.js +0 -6
- package/Libraries/Image/Image.win32.js +2 -8
- package/Libraries/Image/ImageViewNativeComponent.js +18 -3
- package/Libraries/Image/TextInlineImageNativeComponent.js +23 -15
- package/Libraries/Image/resolveAssetSource.win32.js +1 -1
- package/Libraries/Inspector/Inspector.js +2 -4
- package/Libraries/Inspector/Inspector.win32.js +7 -9
- package/Libraries/Interaction/BridgeSpyStallHandler.js +4 -3
- package/Libraries/Interaction/InteractionManager.js +1 -12
- package/Libraries/Interaction/TaskQueue.js +5 -4
- package/Libraries/LayoutAnimation/LayoutAnimation.js +13 -0
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +27 -6
- package/Libraries/Lists/VirtualizedList.js +71 -55
- package/Libraries/Lists/VirtualizedListContext.js +7 -3
- package/Libraries/Lists/VirtualizedSectionList.js +2 -2
- package/Libraries/Lists/__tests__/{FillRateHelper-test.windows.js → FillRateHelper-test.js} +2 -2
- package/Libraries/Lists/__tests__/{FlatList-test.windows.js → FlatList-test.js} +2 -2
- package/Libraries/Lists/__tests__/{SectionList-test.windows.js → SectionList-test.js} +14 -14
- package/Libraries/Lists/__tests__/{VirtualizeUtils-test.windows.js → VirtualizeUtils-test.js} +3 -3
- package/Libraries/Lists/__tests__/{VirtualizedList-test.windows.js → VirtualizedList-test.js} +92 -43
- package/Libraries/Lists/__tests__/{VirtualizedSectionList-test.windows.js → VirtualizedSectionList-test.js} +16 -14
- package/Libraries/LogBox/Data/LogBoxData.js +2 -2
- package/Libraries/LogBox/Data/LogBoxLog.js +1 -1
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +2 -21
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +2 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +295 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +333 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +334 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +0 -2
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +24 -0
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +7 -42
- package/Libraries/NativeComponent/ViewConfig.js +4 -4
- package/Libraries/NativeComponent/ViewConfigIgnore.js +54 -0
- package/Libraries/Network/FormData.js +7 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Pressability/Pressability.js +115 -46
- package/Libraries/Pressability/Pressability.win32.js +174 -69
- package/Libraries/Pressability/PressabilityDebug.js +5 -9
- package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +1 -0
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/{DummyUIManager.js → BridgelessUIManager.js} +62 -40
- package/Libraries/ReactNative/PaperUIManager.win32.js +5 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +39 -0
- package/Libraries/ReactNative/UIManager.js +2 -3
- package/Libraries/ReactNative/renderApplication.js +4 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +8 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +5908 -4906
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +2100 -1918
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2567 -2352
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5610 -4844
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1710 -1556
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1830 -1639
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -1
- package/Libraries/StyleSheet/EdgeInsetsPropType.js +4 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +59 -66
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +15 -0
- package/Libraries/StyleSheet/private/_TransformStyle.js +53 -0
- package/Libraries/Text/Text.js +13 -7
- package/Libraries/Text/TextNativeComponent.js +2 -0
- package/Libraries/Text/TextNativeComponent.win32.js +2 -0
- package/Libraries/Text/TextProps.js +10 -0
- package/Libraries/Types/CoreEventTypes.js +13 -1
- package/Libraries/Types/CoreEventTypes.win32.js +26 -1
- package/Libraries/Utilities/Appearance.js +0 -8
- package/Libraries/Utilities/HMRClient.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -0
- package/Libraries/Utilities/codegenNativeComponent.js +16 -6
- package/Libraries/Utilities/stringifySafe.js +4 -1
- package/Libraries/Utilities/useColorScheme.js +9 -15
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +3 -3
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/vendor/emitter/_EmitterSubscription.js +1 -1
- package/Libraries/vendor/emitter/_EventEmitter.js +1 -1
- package/Libraries/vendor/emitter/_EventSubscription.js +1 -1
- package/flow/{use-subscription.js → use-sync-external-store.js} +4 -4
- package/index.js +30 -25
- package/index.win32.js +30 -25
- package/jest/preprocessor.js +24 -107
- package/jest/preprocessor_DO_NOT_USE.js +122 -0
- package/metro.config.js +3 -47
- package/overrides.json +39 -46
- package/package.json +32 -29
- package/rntypes/index.d.ts +19 -7
- package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
- package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +3 -1
- package/src/Libraries/Components/View/ViewWin32.Props.ts +1 -0
- package/src/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +427 -0
- package/src/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap +391 -0
- package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +3 -0
- package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +4565 -0
- package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +1153 -0
- package/src/rntypes/index.d.ts +19 -7
- package/typings-index.js +5 -1
- package/typings-index.js.map +1 -1
- package/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +0 -44
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +0 -45
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +0 -123
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js +0 -45
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -360
- package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +0 -401
- package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -83
- package/Libraries/ReactNative/UIManagerInjection.js +0 -15
- package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +0 -24527
- package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +0 -8309
- package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +0 -8961
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +0 -24948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +0 -8400
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +0 -9049
- package/flow/Promise.js +0 -47
package/src/rntypes/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
// Dominique Richard <https://github.com/doumart>
|
|
32
32
|
// Mohamed Shaban <https://github.com/drmas>
|
|
33
33
|
// Jérémy Barbet <https://github.com/jeremybarbet>
|
|
34
|
-
// Christian Ost <https://github.com/ca057>
|
|
35
34
|
// David Sheldrick <https://github.com/ds300>
|
|
36
35
|
// Natsathorn Yuthakovit <https://github.com/natsathorn>
|
|
37
36
|
// ConnectDotz <https://github.com/connectdotz>
|
|
@@ -41,6 +40,7 @@
|
|
|
41
40
|
// Arafat Zahan <https://github.com/kuasha420>
|
|
42
41
|
// Pedro Hernández <https://github.com/phvillegas>
|
|
43
42
|
// Sebastian Silbermann <https://github.com/eps1lon>
|
|
43
|
+
// Zihan Chen <https://github.com/ZihanChen-MSFT>
|
|
44
44
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
45
45
|
// TypeScript Version: 3.0
|
|
46
46
|
|
|
@@ -3220,12 +3220,6 @@ export interface RefreshControlPropsAndroid extends ViewProps {
|
|
|
3220
3220
|
* Size of the refresh indicator, see RefreshControl.SIZE.
|
|
3221
3221
|
*/
|
|
3222
3222
|
size?: number | undefined;
|
|
3223
|
-
|
|
3224
|
-
/**
|
|
3225
|
-
* Progress view top offset
|
|
3226
|
-
* @platform android
|
|
3227
|
-
*/
|
|
3228
|
-
progressViewOffset?: number | undefined;
|
|
3229
3223
|
}
|
|
3230
3224
|
|
|
3231
3225
|
export interface RefreshControlProps extends RefreshControlPropsIOS, RefreshControlPropsAndroid {
|
|
@@ -3238,6 +3232,11 @@ export interface RefreshControlProps extends RefreshControlPropsIOS, RefreshCont
|
|
|
3238
3232
|
* Whether the view should be indicating an active refresh.
|
|
3239
3233
|
*/
|
|
3240
3234
|
refreshing: boolean;
|
|
3235
|
+
|
|
3236
|
+
/**
|
|
3237
|
+
* Progress view top offset
|
|
3238
|
+
*/
|
|
3239
|
+
progressViewOffset?: number | undefined;
|
|
3241
3240
|
}
|
|
3242
3241
|
|
|
3243
3242
|
/**
|
|
@@ -9159,6 +9158,19 @@ export interface ImageStoreStatic {
|
|
|
9159
9158
|
getBase64ForTag(uri: string, success: (base64ImageData: string) => void, failure: (error: any) => void): void;
|
|
9160
9159
|
}
|
|
9161
9160
|
|
|
9161
|
+
//
|
|
9162
|
+
// Turbo Module
|
|
9163
|
+
//
|
|
9164
|
+
|
|
9165
|
+
export interface TurboModule {
|
|
9166
|
+
getConstants?(): {}
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9169
|
+
export const TurboModuleRegistry: {
|
|
9170
|
+
get<T extends TurboModule>(name: string): T | null;
|
|
9171
|
+
getEnforcing<T extends TurboModule>(name: string): T;
|
|
9172
|
+
}
|
|
9173
|
+
|
|
9162
9174
|
//
|
|
9163
9175
|
// Interfacing with Native Modules
|
|
9164
9176
|
// https://reactnative.dev/docs/native-modules-ios
|
package/typings-index.js
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
|
-
Object.
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
13
17
|
}) : (function(o, m, k, k2) {
|
|
14
18
|
if (k2 === undefined) k2 = k;
|
|
15
19
|
o[k2] = m[k];
|
package/typings-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings-index.js","sourceRoot":"","sources":["src/typings-index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG
|
|
1
|
+
{"version":3,"file":"typings-index.js","sourceRoot":"","sources":["src/typings-index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAEH;;;;EAIE;AAEF,2EAA2E;AAC3E,sFAAsF;AACtF,+CAA+C;AAC/C,kDAAgC;AAMhC,8EAA4D;AAC5D,wEAAsD;AACtD,8EAA4D;AAC5D,wEAAsD;AACtD,kFAAgE;AAChE,4EAA0D;AAC1D,sFAAoE;AACpE,wFAAsE;AACtE,wFAAsE;AACtE,kFAAgE;AAChE,sEAAoD;AACpD,2EAAyD;AACzD,2EAAyD","sourcesContent":["/**\n * @packagedocumentation\n *\n * This package provides Win32 specific components in addition to providing the core react-native primities.\n * Cross platform React-native primitives should be imported from 'react-native'\n * Win32 specific components need to be imported from '\\@office-iss/react-native-win32'\n *\n */\n\n/*\n This file is used to provide the typings for this package.\n NOTE: Concrete classes, objects etc that actually need to be exported from the package,\n need to also be added to index.win32.js\n*/\n\n// Importing from a copy of react-native types instead of from react-native\n// to allow custom typescript resolvers to redirect react-native to react-native-win32\n// when building bundles for the win32 platform\nexport * from './rntypes/index';\nexport type { \n AccessibilityActionInfo,\n AccessibilityActionName,\n AccessibilityState\n} from './Libraries/Components/View/ViewWin32.Props';\nexport * from './Libraries/Components/View/ViewWin32.Props';\nexport * from './Libraries/Components/View/ViewWin32';\nexport * from './Libraries/Components/Text/TextWin32.Props';\nexport * from './Libraries/Components/Text/TextWin32';\nexport * from './Libraries/Components/Button/ButtonWin32.Props';\nexport * from './Libraries/Components/Button/ButtonWin32';\nexport * from './Libraries/StyleSheet/PlatformColorValueTypesWin32';\nexport * from './Libraries/Components/Touchable/TouchableWin32.Props';\nexport * from './Libraries/Components/Touchable/TouchableWin32.Types';\nexport * from './Libraries/Components/Touchable/TouchableWin32';\nexport * from './Libraries/PersonaCoin/PersonaCoin';\nexport * from './Libraries/PersonaCoin/PersonaCoinTypes';\nexport * from './Libraries/Utilities/FocusManager.win32';"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
* @flow strict-local
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
|
|
12
|
-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
13
|
-
import type {ViewProps} from '../View/ViewPropTypes';
|
|
14
|
-
import type {
|
|
15
|
-
BubblingEventHandler,
|
|
16
|
-
WithDefault,
|
|
17
|
-
Int32,
|
|
18
|
-
} from '../../Types/CodegenTypes';
|
|
19
|
-
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
20
|
-
|
|
21
|
-
export type OnChangeEvent = $ReadOnly<{|
|
|
22
|
-
value: Int32,
|
|
23
|
-
selectedSegmentIndex: Int32,
|
|
24
|
-
|}>;
|
|
25
|
-
|
|
26
|
-
type NativeProps = $ReadOnly<{|
|
|
27
|
-
...ViewProps,
|
|
28
|
-
|
|
29
|
-
// Props
|
|
30
|
-
values?: $ReadOnlyArray<string>,
|
|
31
|
-
selectedIndex?: WithDefault<Int32, 0>,
|
|
32
|
-
enabled?: WithDefault<boolean, true>,
|
|
33
|
-
tintColor?: ?ColorValue,
|
|
34
|
-
textColor?: ?ColorValue,
|
|
35
|
-
backgroundColor?: ?ColorValue,
|
|
36
|
-
momentary?: WithDefault<boolean, false>,
|
|
37
|
-
|
|
38
|
-
// Events
|
|
39
|
-
onChange?: ?BubblingEventHandler<OnChangeEvent>,
|
|
40
|
-
|}>;
|
|
41
|
-
|
|
42
|
-
export default (codegenNativeComponent<NativeProps>(
|
|
43
|
-
'RCTSegmentedControl',
|
|
44
|
-
): HostComponent<NativeProps>);
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
13
|
-
import Text from '../../Text/Text';
|
|
14
|
-
import View from '../View/View';
|
|
15
|
-
|
|
16
|
-
class DummySegmentedControlIOS extends React.Component {
|
|
17
|
-
render() {
|
|
18
|
-
return (
|
|
19
|
-
<View style={[styles.dummy, this.props.style]}>
|
|
20
|
-
<Text style={styles.text}>
|
|
21
|
-
SegmentedControlIOS is not supported on this platform!
|
|
22
|
-
</Text>
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
dummy: {
|
|
30
|
-
width: 120,
|
|
31
|
-
height: 50,
|
|
32
|
-
backgroundColor: '#ffbcbc',
|
|
33
|
-
borderWidth: 1,
|
|
34
|
-
borderColor: 'red',
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
justifyContent: 'center',
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
color: '#333333',
|
|
40
|
-
margin: 5,
|
|
41
|
-
fontSize: 10,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
module.exports = DummySegmentedControlIOS;
|
|
@@ -1,123 +0,0 @@
|
|
|
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 strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
13
|
-
import type {OnChangeEvent} from './RCTSegmentedControlNativeComponent';
|
|
14
|
-
import type {ViewProps} from '../View/ViewPropTypes';
|
|
15
|
-
import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent';
|
|
16
|
-
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
|
17
|
-
|
|
18
|
-
type SegmentedControlIOSProps = $ReadOnly<{|
|
|
19
|
-
...ViewProps,
|
|
20
|
-
/**
|
|
21
|
-
* The labels for the control's segment buttons, in order.
|
|
22
|
-
*
|
|
23
|
-
* The default value is an empty array.
|
|
24
|
-
*/
|
|
25
|
-
values?: $ReadOnlyArray<string>,
|
|
26
|
-
/**
|
|
27
|
-
* The index in `props.values` of the segment to be (pre)selected.
|
|
28
|
-
*/
|
|
29
|
-
selectedIndex?: ?number,
|
|
30
|
-
/**
|
|
31
|
-
* If false the user won't be able to interact with the control.
|
|
32
|
-
*
|
|
33
|
-
* The default value is true.
|
|
34
|
-
*/
|
|
35
|
-
enabled?: boolean,
|
|
36
|
-
/**
|
|
37
|
-
* Accent color of the control.
|
|
38
|
-
*/
|
|
39
|
-
tintColor?: ?string,
|
|
40
|
-
/**
|
|
41
|
-
* If true, then selecting a segment won't persist visually.
|
|
42
|
-
* The `onValueChange` callback will still work as expected.
|
|
43
|
-
*/
|
|
44
|
-
momentary?: ?boolean,
|
|
45
|
-
/**
|
|
46
|
-
* Callback that is called when the user taps a segment
|
|
47
|
-
*/
|
|
48
|
-
onChange?: ?(event: SyntheticEvent<OnChangeEvent>) => void,
|
|
49
|
-
/**
|
|
50
|
-
* Callback that is called when the user taps a segment;
|
|
51
|
-
* passes the segment's value as an argument
|
|
52
|
-
*/
|
|
53
|
-
onValueChange?: ?(value: number) => mixed,
|
|
54
|
-
|}>;
|
|
55
|
-
|
|
56
|
-
type Props = $ReadOnly<{|
|
|
57
|
-
...SegmentedControlIOSProps,
|
|
58
|
-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
|
|
59
|
-
|}>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Use `SegmentedControlIOS` to render a UISegmentedControl iOS.
|
|
63
|
-
*
|
|
64
|
-
* #### Programmatically changing selected index
|
|
65
|
-
*
|
|
66
|
-
* The selected index can be changed on the fly by assigning the
|
|
67
|
-
* selectedIndex prop to a state variable, then changing that variable.
|
|
68
|
-
* Note that the state variable would need to be updated as the user
|
|
69
|
-
* selects a value and changes the index, as shown in the example below.
|
|
70
|
-
*
|
|
71
|
-
* ````
|
|
72
|
-
* <SegmentedControlIOS
|
|
73
|
-
* values={['One', 'Two']}
|
|
74
|
-
* selectedIndex={this.state.selectedIndex}
|
|
75
|
-
* onChange={(event) => {
|
|
76
|
-
* this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
|
|
77
|
-
* }}
|
|
78
|
-
* />
|
|
79
|
-
* ````
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
class SegmentedControlIOS extends React.Component<Props> {
|
|
83
|
-
_onChange = (event: SyntheticEvent<OnChangeEvent>) => {
|
|
84
|
-
this.props.onChange && this.props.onChange(event);
|
|
85
|
-
this.props.onValueChange &&
|
|
86
|
-
this.props.onValueChange(event.nativeEvent.value);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
render() {
|
|
90
|
-
const {enabled, forwardedRef, onValueChange, style, values, ...props} =
|
|
91
|
-
this.props;
|
|
92
|
-
return (
|
|
93
|
-
<RCTSegmentedControlNativeComponent
|
|
94
|
-
{...props}
|
|
95
|
-
ref={forwardedRef}
|
|
96
|
-
style={[styles.segmentedControl, style]}
|
|
97
|
-
enabled={enabled !== false}
|
|
98
|
-
values={values ?? []}
|
|
99
|
-
onChange={this._onChange}
|
|
100
|
-
/>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const styles = StyleSheet.create({
|
|
106
|
-
segmentedControl: {
|
|
107
|
-
height: 28,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const SegmentedControlIOSWithRef = React.forwardRef(
|
|
112
|
-
(
|
|
113
|
-
props: SegmentedControlIOSProps,
|
|
114
|
-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
|
|
115
|
-
) => {
|
|
116
|
-
return <SegmentedControlIOS {...props} forwardedRef={forwardedRef} />;
|
|
117
|
-
},
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
/* $FlowFixMe[cannot-resolve-name] (>=0.89.0 site=react_native_ios_fb) This
|
|
121
|
-
* comment suppresses an error found when Flow v0.89 was deployed. To see the
|
|
122
|
-
* error, delete this comment and run Flow. */
|
|
123
|
-
module.exports = (SegmentedControlIOSWithRef: NativeSegmentedControlIOS);
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
13
|
-
import Text from '../../Text/Text';
|
|
14
|
-
import View from '../View/View';
|
|
15
|
-
|
|
16
|
-
class DummySegmentedControlIOS extends React.Component {
|
|
17
|
-
render() {
|
|
18
|
-
return (
|
|
19
|
-
<View style={[styles.dummy, this.props.style]}>
|
|
20
|
-
<Text style={styles.text}>
|
|
21
|
-
SegmentedControlIOS is not supported on this platform!
|
|
22
|
-
</Text>
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
dummy: {
|
|
30
|
-
width: 120,
|
|
31
|
-
height: 50,
|
|
32
|
-
backgroundColor: '#ffbcbc',
|
|
33
|
-
borderWidth: 1,
|
|
34
|
-
borderColor: 'red',
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
justifyContent: 'center',
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
color: '#333333',
|
|
40
|
-
margin: 5,
|
|
41
|
-
fontSize: 10,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
module.exports = DummySegmentedControlIOS;
|