infinitered / redpotion

We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called RedPotion
MIT License
233 stars 40 forks source link

Styling, promotion-menu #166

Closed casper91 closed 8 years ago

casper91 commented 8 years ago

I can't seem to style promotion-menu like i want. Maybe I'm missing something or doing it completely wrong?

In AppDelegate:

class MenuDrawer < ProMotion::Menu::Drawer
    def setup()
      self.center = LoginScreen.new(nav_bar: true)
      self.left = MenuScreen
      self.to_show = :pan_nav_bar
      self.to_hide = :all
      self.transition_animation = :parallax #:slide_and_scale
      self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal
    end
  end

In my MenuScreen < PM::Screen i use MenuScreenStylesheet and trying to insert a 'UIButton' with a padding of 10 in the menu screen like the image below is trying to illustrate.

st.frame = { bp: 20, l: 10, fr: 10, h: 44 }
st.background_color = color.black

Is it possible? It seems like the MenuScreen (Left) is the full width behind and not only to where the LoginScreen (Center) is colliding as I would assume?

image

casper91 commented 8 years ago

Guess I have to figure out how to do it in another way.

casper91 commented 8 years ago

I found a work around. I appended a UIView 'menu_view' to the screen:

def menu_view(st)
   st.frame = { l: 0, t: 0, w: SIDE_NAV_WIDTH, h: :full }
end

Then SIDE_NAV_WIDTH is a constant defining the width of the nav menu. Then I use the constant to set max_left_width in the setup of the menu.

class MenuDrawer < PM::Menu::Drawer
  def setup
    ...
    self.max_left_width = SIDE_NAV_WIDTH
  end
end

Now I can append a UIButton to 'menu_view' with styles:

def button_style(st)
  st.frame = { t: 20, l: 10, fr: 10, h: 44 }
  st.background_color = color.black
end

And it works like a charm :)

jr180180 commented 8 years ago

Thanks for posting what fixed your issue. 👍

jamonholmgren commented 8 years ago

@casper91 Glad you got it straightened out! We don't watch this repo as closely as we used to, so I apologize for the non-response on it.

casper91 commented 8 years ago

@jamonholmgren I can see there haven't been much activity here and on BluePotion. Is it because you guys are you going to shutdown maintenance for these gems? Or are you just simply overflooded with other stuff?

jamonholmgren commented 8 years ago

@casper91 We don't intend to shut these down, and when we get the rare RubyMotion project we'll definitely use (and improve) them. But given that most of our clients want React Native these days, we're relying on the community to provide ongoing support as much as possible. Also, @andrewhavens has been doing a great job helping out.

EDIT: I should note that we aren't continuing work on BluePotion. RubyMotion Android wasn't performant nor stable enough to accomplish what we intended. I hope that's changed, but as of our last commit it was untenable.

GantMan commented 8 years ago

As secondmost contributor to BluePotion and core contributor I can tell you I have zero desire to continue down that road of landmines. I love Ruby, and I love what was built with RedPotion, but I've had to call my losses and get up from the poker table known as BluePotion based on RubyMotion Android.

What this means to me is that a new set of contributors needs to arise and work side by side with HipByte in order to keep it alive. Is this doable? Yes. Is it likely... welllllll....

casper91 commented 8 years ago

Ok, thanks for letting me know. I think you guys have made some amazing stuff.