内联元素实现

时间:2016-01-10 11:33:46

标签: react-native react-native-text

我想创建Text组件并将它们连续显示,例如html中的span元素。如果我这样做:

<View>
  <Text> Start here, </Text> <Text> finish here </Text>
</View>

它们之间的断开线看起来像:

  

从这里开始,
  在这里结束

如何防止断线并将它们显示在同一条线上?

2 个答案:

答案 0 :(得分:60)

只需设置正确的flexDirection即可。默认值为<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="test"> <img src="http://placehold.it/100x100" /> <div class="caption"> <h4> <span class="active toggle_link toggle_img" data-src='http://placehold.it/100x100'>Image1</span> <span class="toggle_link toggle_img" data-src='http://placehold.it/150x150'>Image2</span> </h4> </div> </div>

column

答案 1 :(得分:20)

使用其他 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Data; using System.Data.OleDb; namespace ImpExpExc { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PopulateData(); lblMessage.Text = "Current Database Data!"; } } private void PopulateData() { using (TEDataEntities dc = new TEDataEntities()) { gvData.DataSource = dc.ImportExportExcels.ToList(); gvData.DataBind(); } } protected void btnImport_Click(object sender, EventArgs e) { if (FileUpload1.PostedFile.ContentType == "application/vnd.ms-excel" || FileUpload1.PostedFile.ContentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { try { string fileName = Path.Combine(Server.MapPath("~/ImportDocument"), Guid.NewGuid().ToString() + Path.GetExtension(FileUpload1.PostedFile.FileName)); FileUpload1.PostedFile.SaveAs(fileName); string conString = ""; string ext = Path.GetExtension(FileUpload1.PostedFile.FileName); if (ext.ToLower() == ".xls") { conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; } else if (ext.ToLower() == ".xlsx") { conString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; } string query = "Select [ID], [Activities], [Governorate], [Exchange], [Client], [Technician], [CircuitNo], [Comment], [Date] from [Sheet1$]"; OleDbConnection con = new OleDbConnection(conString); if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } OleDbCommand cmd = new OleDbCommand(query, con); OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); da.Dispose(); con.Close(); con.Dispose(); //Import to Database using (TEDataEntities dc = new TEDataEntities()) { foreach (DataRow dr in ds.Tables[0].Rows) { string empID = dr["ID"].ToString(); var v = dc.ImportExportExcels.Where(a => a.ID.Equals(empID)).FirstOrDefault(); if (v != null) { //Update here v.Activities = dr["Activities"].ToString(); v.Governorate = dr["Governorate"].ToString(); v.Exchange = dr["Exchange"].ToString(); v.Client = dr["Client"].ToString(); v.Technician = dr["Technician"].ToString(); v.CircuitNo = dr["CircuitNo"].ToString(); v.Comment = dr["Comment"].ToString(); v.Date = dr["Date"].ToString(); } else { //Insert here dc.ImportExportExcels.AddObject(new ImportExportExcel { ID = dr["ID"].ToString(), Activities = dr["Activities"].ToString(), Exchange = dr["Exchange"].ToString(), Client = dr["Client"].ToString(), Technician = dr["Technician"].ToString(), CircuitNo = dr["CircuitNo"].ToString(), Comment = dr["Comment"].ToString(), Date = dr["Date"].ToString() }); } } dc.SaveChanges(); } PopulateData(); lblMessage.Text = "Successfully data import done!"; } catch (Exception) { throw; } } } } } 元素包装

Text个组件时内联,如:

Text