App config for android / iOS

hi

we are using few app config only for android and few for iOS only.

is there a way to get them together in single app.js?

eg.

for iOS we use this

var app = new Framework7({
id: projectID,
root: ‘#app’,
theme: theme,
statusbar: {
enabled: true,
overlay :true
},
input : {
scrollIntoViewAlways:true,
scrollIntoViewOnFocus: true,
scrollIntoViewCentered: true
},
});

for android we use this

var app = new Framework7({
id: projectID,
root: ‘#app’,
theme: theme,
statusbar: {
enabled: true,
overlay :false,
androidOverlaysWebView: false
},
touch: {
tapHold: true, //enable tap hold events
disableContextMenu: false
},
input : {
scrollIntoViewAlways:true,
scrollIntoViewOnFocus: true,
scrollIntoViewCentered: true
},
});

we need
touch: {
tapHold: true, //enable tap hold events
disableContextMenu: false
},

only for android,

is there a way to configure this in the app.js?

please help.

thank you

Вопрос конфигурации не относится к F7, а относится к JavaScript в целом. Как удобнее, так и делайте. Что-то выносите в общие данные, что-то делайте взависимости от темы.

var config = Framework.device.ios
  ? {
    /* ios config here */
    id: projectID,
    ...
  }
  : {
    /* android config here */
    id: projectID,
    ...
  }
var app = new Framework7(config);

thank you so much for the help. much appreciated.

Here’s a better solution if you don’t want two completely different configurations :

// Init App
var app = new Framework7({
    id: projectID,
    popup:  Framework7.device.ios ?
                { animate: true }
            :
                { animate: false }
    ,
    ...
});

The above example will render popup animations in iOS devices only!