Skip to content

Commit

Permalink
fix: 修复外部传入refreshing是没有显示下拉刷新的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chj-damon authored Dec 21, 2022
1 parent 419a9dd commit 3c4b44c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React, { useRef, useState } from "react";
import { View, Text, Animated, Platform } from "react-native";
import { requireNativeComponent, StyleSheet } from "react-native";
import { ActivityIndicator } from "react-native";
import { forwardRef, useImperativeHandle } from "react";
import { useCallback } from "react";
import React, { useRef, useState, useEffect, useCallback, forwardRef, useImperativeHandle } from "react";
import { View, Text, Animated, Platform, requireNativeComponent, StyleSheet, ActivityIndicator } from "react-native";

const iOS = Platform.OS === "ios";

Expand Down Expand Up @@ -61,7 +57,11 @@ export const RefreshControl = forwardRef(
const [title, setTitle] = useState("下拉可以刷新");
const [lastTime, setLastTime] = useState(fetchNowTime());
const animatedValue = useRef(new Animated.Value(0));
const [refreshing, setRefreshing] = useState(props.refreshing ?? false);
const [refreshing, setRefreshing] = useState(false);

useEffect(() => {
setRefreshing(props.refreshing ?? false);
}, [props.refreshing]);

useImperativeHandle(ref, () => ({
startRefresh: () => {
Expand Down

0 comments on commit 3c4b44c

Please sign in to comment.