Reputation: 110
In the below code snippet from F8App, I am not able to understand what is going on, can someone explain what's going on in line 3 of code and point to resources on the web where I can read about this.
'use strict';
import {StyleSheet, Platform} from 'react-native';
export function create(styles: Object): {[name: string]: number} {
const platformStyles = {};
Object.keys(styles).forEach((name) => {
let {ios, android, ...style} = {...styles[name]};
if (ios && Platform.OS === 'ios') {
style = {...style, ...ios};
}
if (android && Platform.OS === 'android') {
style = {...style, ...android};
}
platformStyles[name] = style;
});
return StyleSheet.create(platformStyles);
}
Upvotes: 0
Views: 56
Reputation: 71
I think you are having trouble with the type checking
that's added. That's actually not es6 but flow
. You can read more about it here
Upvotes: 1