小编Lau*_*nny的帖子

React Native 应用程序 - NativeBase DeckSwiper 在数据源更改时不会立即重新渲染

我正在使用 NativeBase 中的 Picker 和 DeckSwiper,当我从 Picker 菜单中选择不同的主题时,它会更新 DeckSwiper 组件上的 dataSource 读取的状态,该状态应该重新渲染以显示新内容。目前仅在刷第一张卡时才会重新渲染。状态改变后如何重新渲染? 是一个 GIF,展示了它当前的工作原理。

这是代码

const Item = Picker.Item;

const topics = [
  { label: "topic 1", value: "1" },
  { label: "topic 2", value: "2" },
  { label: "topic 3", value: "3" }
];

const cards = [
  { text: "Card A", topicId: "1", name: "One" },
  { text: "Card B", topicId: "2", name: "Two" },
  { text: "Card C", topicId: "3", name: "Three" },
  { text: "Card …
Run Code Online (Sandbox Code Playgroud)

react-native native-base

5
推荐指数
0
解决办法
786
查看次数

标签 统计

native-base ×1

react-native ×1