| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import React from "react";
- import { ScrollView, RefreshControl } from "react-native";
- function scrollPage(Component) {
- class NewPage extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- refreshing: false,
- };
- }
- _onRefresh = () => {
- this.setState({ refreshing: true });
- fetchData().then(() => {
- this.setState({ refreshing: false });
- });
- };
- render(props) {
- return (
- <ScrollView
- contentContainerStyle={{ flexGrow: 1 }}
- refreshControl={
- <RefreshControl
- refreshing={this.state.refreshing}
- onRefresh={this._onRefresh}
- enabled={true}
- />
- }
- >
- <Component {...props} />
- </ScrollView>
- );
- }
- }
- return () => {
- return <NewPage />;
- };
- }
- export default scrollPage;
|