Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
This repository was archived by the owner on May 20, 2025. It is now read-only.

Warning: Stateless function components cannot be given refs #750

@diegocouto

Description

@diegocouto

Hi, guys!

First of all, thanks for your amazing work with code-push, it's awesome! 😉

Description

After finishing codePush setup process, I've started to see a warning like:

Warning: Stateless function components cannot be given refs 
(See ref "rootComponent" in App created by CodePushComponent). 
Attempts to access this ref will fail.

Reproduction

Currently, I have a setup file which is responsible for defining the main component, which is just like:

setup.js

// ...
let App = () => (
  <Provider store={store}>
    <StyleProvider style={theme}>
      <RouterWithRedux scenes={scenes} />
    </StyleProvider>
  </Provider>
);

module.exports = codePush(App);

index.ios.js / index.android.js

import {AppRegistry} from 'react-native';
const App = require('./config/setup');

AppRegistry.registerComponent('MyApp', () => App);

Except for a ref used on a TextInput, defined on a component with state, I do not use any other refs. Removing codepush() makes this warning disappear.

Additional Information

  • react-native-code-push version: 1.17.2-beta
  • react-native version: 0.42.0
  • iOS/Android/Windows version: iOS 10.2
  • Does this reproduce on a debug build or release build? Debug
  • Does this reproduce on a simulator, or only on a physical device? Both

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions