diff --git a/packages/react-native-renderer/src/ReactFabricHostConfig.js b/packages/react-native-renderer/src/ReactFabricHostConfig.js index 7a7f4e76b9008..24c90e07c068d 100644 --- a/packages/react-native-renderer/src/ReactFabricHostConfig.js +++ b/packages/react-native-renderer/src/ReactFabricHostConfig.js @@ -381,7 +381,16 @@ export function cloneHiddenInstance( props: Props, internalInstanceHandle: Object, ): Instance { - throw new Error('Not yet implemented.'); + const viewConfig = instance.canonical.viewConfig; + const node = instance.node; + const updatePayload = ReactNativeAttributePayload.create( + {style: {display: 'none'}}, + viewConfig.validAttributes, + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical, + }; } export function cloneUnhiddenInstance( @@ -390,7 +399,17 @@ export function cloneUnhiddenInstance( props: Props, internalInstanceHandle: Object, ): Instance { - throw new Error('Not yet implemented.'); + const viewConfig = instance.canonical.viewConfig; + const node = instance.node; + const updatePayload = ReactNativeAttributePayload.diff( + {...props, style: [props.style, {display: 'none'}]}, + props, + viewConfig.validAttributes, + ); + return { + node: cloneNodeWithNewProps(node, updatePayload), + canonical: instance.canonical, + }; } export function createHiddenTextInstance( diff --git a/packages/react-native-renderer/src/ReactNativeHostConfig.js b/packages/react-native-renderer/src/ReactNativeHostConfig.js index d650a7f4c3ae0..7ee6475884cdb 100644 --- a/packages/react-native-renderer/src/ReactNativeHostConfig.js +++ b/packages/react-native-renderer/src/ReactNativeHostConfig.js @@ -454,7 +454,16 @@ export function resetTextContent(instance: Instance): void { } export function hideInstance(instance: Instance): void { - throw new Error('Not yet implemented.'); + const viewConfig = instance.viewConfig; + const updatePayload = ReactNativeAttributePayload.create( + {style: {display: 'none'}}, + viewConfig.validAttributes, + ); + UIManager.updateView( + instance._nativeTag, + viewConfig.uiViewClassName, + updatePayload, + ); } export function hideTextInstance(textInstance: TextInstance): void { @@ -462,7 +471,17 @@ export function hideTextInstance(textInstance: TextInstance): void { } export function unhideInstance(instance: Instance, props: Props): void { - throw new Error('Not yet implemented.'); + const viewConfig = instance.viewConfig; + const updatePayload = ReactNativeAttributePayload.diff( + {...props, style: [props.style, {display: 'none'}]}, + props, + viewConfig.validAttributes, + ); + UIManager.updateView( + instance._nativeTag, + viewConfig.uiViewClassName, + updatePayload, + ); } export function unhideTextInstance(