static getInitialProps({ renderPage }: (cb: Function) => void) { AppRegistry.registerComponent('Main', () => Main); // $FlowFixMe Wrong libdef. https://gist.github.com/paularmstrong/f60b40d16fc83e1e8e532d483336f9bb const { getStyleElement } = AppRegistry.getApplication('Main'); const page = renderPage(); const styles = [ // eslint-disable-next-line react/jsx-key <style dangerouslySetInnerHTML={{ __html: normalizeNextElements }} />, getStyleElement(), ]; return { ...page, styles: React.Children.toArray(styles) }; }
render() { const { children, activeIndex, customStyle } = this.props; if (!children || activeIndex === undefined) { return null; } let props = {}; if (customStyle && customStyle.Panel) { props = { ...props, CustomPanelStyle: customStyle.Panel }; } // to prevent the type of one children is object type const result = React.Children.toArray(children).map((child, index) => React.cloneElement(child, { key: index, active: index === activeIndex, index, ...props, }), ); return <div>{result}</div>; }
var position = event.nativeEvent.position; if (position >= 0) { var children = React.Children.toArray(_this2.props.children); var value = children[position].props.value; _this2.props.onValueChange(value, position);