如何在React Native中刷新全屏并重新加载所有3个组件

huangapple go评论98阅读模式
英文:

How to refresh full screen and reload all 3 components in react-native

问题

我有一个应用程序,其中有3个组件,它们的数据都来自API,所有组件的数据都来自API。所有这些组件都被调用到单个屏幕中。我如何在这个单个页面上应用下拉刷新?

我已经尝试了所有预期的方法,但没有找到解决方案。

英文:

I have an app which has 3 components that has data which come from API and all component data come from API. All components are called into a single screen. How can I apply pull to refresh on that single page?

I have done all expected terms but didn't find a solution.

答案1

得分: 1

import { ScrollView } from 'react-native';

> 使用 Scroll View  RefreshControl 属性
> 
> 这里是一个链接展示了 RefreshControl 的示例你可以在 onRefresh 函数中调用 API 更新组件的数据

[https://reactnative.dev/docs/refreshcontrol][1]
英文:
import { ScrollView } from 'react-native';

> use RefreshControll that is the property of Scroll View
>
> here is the link that shows the example of RefreshControll and you can update the component's data using call api in onRefresh function.

https://reactnative.dev/docs/refreshcontrol

huangapple
  • 本文由 发表于 2023年6月8日 14:25:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76429116.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定