iOS ref crashing Expo application

#1

Hello guys.
I have a very weird problem and maybe you can help me to find the answer.
I’ve tried to reinstall CRNA, update Node and everything else, but nothing helps.
I’m creating absolutely new application by CRNA and trying to check the code like this on my Iphone7 using Expo application:

import React from 'react';
import { ScrollView, Text } from 'react-native';

export default class App extends React.Component {
  constructor(props) {
    super(props)

    this.myView = React.createRef()
  }

  componentDidMount() {
    console.log(this.myView.current)
  }

  render() {
    return (
      <ScrollView ref={this.myView}>
        <Text>Hello</Text>
      </ScrollView>
    )
  }
}

When I use “Debug Remote JS” everything works fine, but if I try to run application not in my browser happens weirds things. Expo application freeze, in “Performance Monitor” RAM is getting higher (memory loop) and Expo application crashing.
I’ve tried to use diefferent code (string refs, callbacks, React.createRef), getting ref in child component. Nothing helps. Till I don’t use “ref” my application works perfect, but how can I use methods of components then?

0 Likes

#2

So I fixed it.
I updated Expo version to 29.0.0. But I think it’s not an Expo bug or something likes this. It’s more about specific of updating component by react-redux connect, own state and React.createRef().
If someone has the same problem, try to not use stateful component for saving ‘ref’ and create only stateless components.
I will be very thankful if someone close this topic.

0 Likes

closed #3

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

0 Likes