Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ElementWrapper from '../elements/element-wrapper';
import { Registry } from '../registration/registry';
import { SelectAction } from '../actions';
import * as Constants from '../../utils/constants';
import * as Utils from '../../utils/util';
import { HostConfigManager } from '../../utils/host-config';
import { InputContext } from '../../utils/context';
import { ContainerWrapper } from './';
Expand All @@ -37,11 +38,11 @@ export class Container extends React.Component {
return children;
}

if (this.payload.isFallbackActivated){
if(this.payload.fallbackType == "drop"){
if (this.payload.isFallbackActivated) {
if (this.payload.fallbackType == "drop") {
return null;
}else if(!Utils.isNullOrEmpty(element.fallback)){
return Registry.getManager().parseComponent(this.payload.fallback,this.context.onParseError);
} else if (!Utils.isNullOrEmpty(element.fallback)) {
return Registry.getManager().parseComponent(this.payload.fallback, this.context.onParseError);
}
}

Expand All @@ -51,9 +52,21 @@ export class Container extends React.Component {

internalRenderer = () => {
const payload = this.payload;
let containerStyle;
let minHeight = payload.minHeight;
if (minHeight) {
if (typeof (minHeight) == 'string') {
const lastIndex = minHeight.lastIndexOf('px');
minHeight = lastIndex != -1 ? parseInt(minHeight.substring(0, lastIndex)) : minHeight
Comment thread
IbrahimSulai marked this conversation as resolved.
Resolved
}
//If it is number, then directly we can assign minHeight
containerStyle = [styles.container, { minHeight }];
} else {
containerStyle = [styles.container];
}

var containerContent = (
<ContainerWrapper json={this.payload} style={[styles.container]} containerStyle={this.props.containerStyle}>
<ContainerWrapper json={this.payload} style={containerStyle} containerStyle={this.props.containerStyle}>
<ElementWrapper json={this.payload} style={[styles.defaultBGStyle, { flexGrow: 0 }]} isFirst={this.props.isFirst}>
{this.parsePayload()}
</ElementWrapper>
Expand Down
7 changes: 4 additions & 3 deletions source/community/reactnative/src/models/container-model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BaseModel } from './base-model'
import { ModelFactory } from './model-factory';
import { ElementType } from '../utils/enums'
import {ImageModel} from './element-model'
import { ImageModel } from './element-model'

class BaseContainerModel extends BaseModel {
constructor(payload, parent) {
Expand Down Expand Up @@ -37,9 +37,10 @@ export class ContainerModel extends BaseContainerModel {
this.children = [];
this.children.push(...ModelFactory.createGroup(payload.items, this));
this.height = payload.height;
this.minHeight = payload.minHeight;
}

get items(){
get items() {
return this.children;
}
}
Expand Down Expand Up @@ -136,7 +137,7 @@ export class ImageSetModel extends BaseContainerModel {
}
}

export class ActionSetModel extends BaseContainerModel{
export class ActionSetModel extends BaseContainerModel {
constructor(payload, parent) {
super(payload, parent);
this.type = ElementType.ActionSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "Container",
"minHeight": "100px",
"style": "emphasis",
"items": [
{
"type": "TextBlock",
"wrap": true,
"text": "This textblock is inside a container with a min height of 100px"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export default payloads = [
"title": "Bleed.json",
"json": require('./Bleed.json')
},
{
"title": "Container.MinHeight.json",
"json": require('./Container.MinHeight.json')
},
{
"title": "Container.BackgroundImageRepeatHorizontally.json",
"json": require('./Container.BackgroundImageRepeatHorizontally.json')
Expand Down