RN: Create Experiment for `collapsable` (iOS)
Summary: Sets up an experiment that enables `collapsable` in Fabric for iOS. This will enable us to validate with production data that enabling the use of this prop does not cause unexpected regressions. Changelog: [internal] Reviewed By: mdvacca Differential Revision: D27987619 fbshipit-source-id: 9b1c0ff45bed09b1e72ad7d9c782f07bb4211cc6
This commit is contained in:
Родитель
b914153286
Коммит
f598dd0ee3
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
export default {
|
||||
unstable_enableCollapsable: false,
|
||||
};
|
|
@ -13,8 +13,10 @@ import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|||
import Platform from '../../Utilities/Platform';
|
||||
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
||||
import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid';
|
||||
import ViewInjection from './ViewInjection';
|
||||
import {type ViewProps as Props} from './ViewPropTypes';
|
||||
import * as React from 'react';
|
||||
import ReactNativeViewConfigRegistry from '../../Renderer/shims/ReactNativeViewConfigRegistry';
|
||||
|
||||
const ViewNativeComponent: HostComponent<Props> = NativeComponentRegistry.get<Props>(
|
||||
'RCTView',
|
||||
|
@ -24,6 +26,14 @@ const ViewNativeComponent: HostComponent<Props> = NativeComponentRegistry.get<Pr
|
|||
: {uiViewClassName: 'RCTView'},
|
||||
);
|
||||
|
||||
if (Platform.OS === 'ios') {
|
||||
if (ViewInjection.unstable_enableCollapsable) {
|
||||
const viewConfig = ReactNativeViewConfigRegistry.get('RCTView');
|
||||
// $FlowFixMe - Yes, knowingly writing to a read-only property.
|
||||
viewConfig.validAttributes.collapsable = true;
|
||||
}
|
||||
}
|
||||
|
||||
interface NativeCommands {
|
||||
+hotspotUpdate: (
|
||||
viewRef: React.ElementRef<HostComponent<mixed>>,
|
||||
|
|
Загрузка…
Ссылка в новой задаче