mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b8ca59cd74
Summary: The `isFabric` method used in createAnimatedComponent is unreliable (another reason in a long list of reasons why you should not duplicate this code elsewhere, and why we want to delete it ASAP). In particular, during the first render, the ref component has not been set yet, so we /cannot/ detect if the component is Fabric or non-Fabric and assume it's non-Fabric. In Fabric, this causes `collapsable` and `nativeID` values to change after the first render. To reduce this re-rendering, but not eliminate it for all components, I've introduced a flag that indicates if a component will /never/ be flattened. In particular, Image components, ScrollViews, Text cannot ever be flattened, so we should always pass `collapsable:false` and the same nativeID prop for those components. For Animated <View>s and other components, the re-rendering issue is still a problem in Fabric for now. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D25720322 fbshipit-source-id: fe3234d8ae974911a2b5f82e4f6a093216f43d4b
26 lines
645 B
JavaScript
26 lines
645 B
JavaScript
/**
|
|
* 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-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import * as React from 'react';
|
|
|
|
const Text = require('../../Text/Text');
|
|
const createAnimatedComponent = require('../createAnimatedComponent');
|
|
|
|
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
|
|
|
module.exports = (createAnimatedComponent((Text: $FlowFixMe), {
|
|
collapsable: false,
|
|
}): AnimatedComponentType<
|
|
React.ElementConfig<typeof Text>,
|
|
React.ElementRef<typeof Text>,
|
|
>);
|