jamonholmgren/ProMotion

CollectionScreen#on_load never gets called

Opened this issue · 1 comments

To whom it may concern,

In the documentation, the CollectionScreen should call the on_load method once viewDidLoad gets called. Via manual testing, I found this doesn't happen.

I also believe I found the issue in the code.

The following method, view_did_load, calls on_load, and is common to all screens:
https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/lib/ProMotion/screen/screen_module.rb#L38

In ProMotion::Collection#viewDidLoad, which is an include of CollectionScreen, you'll notice that self.view_did_load is never called:
https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/lib/ProMotion/collection/collection.rb#L19

Whereas in ScreenModuleViewController#viewDidLoad, it is called (as it should be):
https://github.com/infinitered/ProMotion/blob/a40c03ca89e21c21ef4c2fc35d5d3b85ea4c77de/app/screens/screen_module_view_controller.rb#L13

Please fix! :) Meanwhile, I will override viewDidLoad in my subclass of PM::CollectionScreen, and place the following code there:

  def viewDidLoad
    super
    self.view_did_load if self.respond_to?(:view_did_load)
  end

Best regards,
Sathya Sekaran

Hi @sfsekaran, thanks for reporting this. This should be a simple fix and we'd welcome a pull request with accompanying tests.