简体   繁体   中英

null is not an object (evaluating 'dispatcher.useRef')

I NEED HELP WITH THIS PROBLEM.

I tried to delete node modules, install it again. I have tried to rewrite the code, and use the useRef component different.

COULD YOU HELP ME WITH IT PLEASE?

[ Error ]( https://i.stack.imgur.com/Gr12j.png )

const flatListRef = React.useRef();
const scrollX = React.useRef(new Animated.Value(0)).current;

const onViewChangeRef = React.useRef(({viewableItems, changed}) => {
<View
  style={{
    flex: 1,
    justifyContent: 'center',
  }}>
  {index == 0 && <Walkthrough1 />}
  {index == 1 && <Walkthrough2 animate={walkthrough2Animate || false} />}
  {index == 2 && <Walkthrough3 animate={walkthrough3Animate} />}
  {index == 3 && <Walkthrough4 animate={walkthrough4Animate} />}
</View>

try to start the ref as null and then you use the reference inside of your Element exp:

const inputRef = useRef(null)

<Input ref(inputRef) placeholder="..." />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM