首页 > 解决方案 > 在共享元素转换期间更改字体大小 [REACT-NATIVE]

问题描述

我正在使用 react-navigation-shared-element 开发一个 react-native 应用程序,当字体大小在共享元素转换期间,它似乎不起作用。我的意思是当文本的行从 2 变为 1 时会出现问题。这是一个视频,然后是我的代码:

https://drive.google.com/file/d/1RqCHJIl58_q3P30DSo57GwucL_mjH-GY/view?usp=sharing

// Thumbnail.js


      <SharedElement
        id={`story.${story.id}.title`}
        style={{
          position: "absolute",
          bottom: 16,
          zIndex: 3,
          alignSelf: "flex-start",
        }}
      >
        <Text
          numberOfLines={2}
          style={{ fontSize: 20, alignSelf: "flex-start" }}
        >
          {story.title}
        </Text>
      </SharedElement>

// Story.js

    <SharedElement
      id={`story.${story.id}.title`}
      style={{ position: "absolute", bottom: 100, alignSelf: "flex-start" }}
    >
      <Text
        numberOfLines={2}
        style={{ fontSize: 30, alignSelf: "flex-start" }}
      >
        {story.title}
      </Text>
    </SharedElement>

标签: react-nativeshared-element-transitionreact-native-shared-element

解决方案


推荐阅读