mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-08-15 18:45:06 +00:00
[fix] Animated no longer sets non-unique IDs on elements
Remove problematic code added only for native platforms using Fabric. Fix #2136
This commit is contained in:
-29
@@ -224,39 +224,10 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
||||
this.props.passthroughAnimatedPropExplicitValues || {};
|
||||
const mergedStyle = {...style, ...passthruStyle};
|
||||
|
||||
// On Fabric, we always want to ensure the container Animated View is *not*
|
||||
// flattened.
|
||||
// Because we do not get a host component ref immediately and thus cannot
|
||||
// do a proper Fabric vs non-Fabric detection immediately, we default to assuming
|
||||
// that Fabric *is* enabled until we know otherwise.
|
||||
// Thus, in Fabric, this view will never be flattened. In non-Fabric, the view will
|
||||
// not be flattened during the initial render but may be flattened in the second render
|
||||
// and onwards.
|
||||
const forceNativeIdFabric =
|
||||
(this._component == null &&
|
||||
(options?.collapsable === false || props.collapsable !== true)) ||
|
||||
this._isFabric();
|
||||
|
||||
const forceNativeId =
|
||||
props.collapsable ??
|
||||
(this._propsAnimated.__isNative ||
|
||||
forceNativeIdFabric ||
|
||||
options?.collapsable === false);
|
||||
// The native driver updates views directly through the UI thread so we
|
||||
// have to make sure the view doesn't get optimized away because it cannot
|
||||
// go through the NativeViewHierarchyManager since it operates on the shadow
|
||||
// thread. TODO: T68258846
|
||||
const collapsableProps = forceNativeId
|
||||
? {
|
||||
nativeID: props.nativeID ?? 'animatedComponent',
|
||||
collapsable: false,
|
||||
}
|
||||
: {};
|
||||
return (
|
||||
<Component
|
||||
{...props}
|
||||
{...passthruProps}
|
||||
{...collapsableProps}
|
||||
style={mergedStyle}
|
||||
ref={this._setComponentRef}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user