Skip to content

Instantly share code, notes, and snippets.

I've lifted this from a project I'm working on, thought it might be interesting starting point for some sort of dynamic switching of styles with Alloy.

It's a hack, so please free to rip it apart.

  • Add the function to alloy.js

  • Add objects for "portrait" and "landscape" to your TSS (and leave defaults in there to be overridden, see the sample)

  • Call the function from your controller to a) init the view in case you have the device held in landscape when a window opens and b) within an event listener (remember to kill it)

@drmas
drmas / app.tss
Last active August 13, 2016 17:28 — forked from tonylukasavage/app.tss
'Label[platform=android]': {
color: '#000' // all platforms except Android default to black
}
'Window': {
backgroundColor: '#fff' // white background instead of default transparent
}
'Window[platform=android]': {
modal: false // make android windows all heavyweight
@drmas
drmas / navReducer.js
Last active June 21, 2016 09:58 — forked from dabit3/navReducer.js
React Native Navigator Experimental Part 2 — Implementing Redux navReducer.js
import { PUSH_ROUTE, POP_ROUTE } from '../constants/ActionTypes'
import { NavigationExperimental } from 'react-native'
const {
StateUtils: NavigationStateUtils
} = NavigationExperimental
const initialState = {
index: 0,
key: 'root',
routes: [{