rnrf-relay-renderer icon indicating copy to clipboard operation
rnrf-relay-renderer copied to clipboard

Does not pass on static functions

Open mikberg opened this issue 9 years ago • 2 comments

Awesome library! 👍

I'm trying to use RNRF's renderNavigationBar, which is a static function. This library currently doesn't pass on these static functions, which causes issues in situations like this.

A quickfix for my specific problem:

export default (moduleProps) => (Component) => {
  if (!Relay.isContainer(Component)) {
    return Component;
  }
  const fn = props => (
    <RelayComponentRenderer
      {...moduleProps}
      {...props}
      component={Component}
    />
  );

  fn.renderNavigationBar = Component.renderNavigationBar;

  return fn;
};

For a more complete solution, perhaps hoist-non-react-statics could be used.

mikberg avatar Oct 13 '16 08:10 mikberg

@mikberg could u send a PR to address this issue?

sibelius avatar Oct 18 '16 12:10 sibelius

@sibelius Yeah, embarrassed I didn't just do that in the first place. Will try to find time.

mikberg avatar Oct 18 '16 16:10 mikberg