我试图用两个不同风格的文本来实现一个视图。我有这个:
<?php
//error reporting
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
class vehicle {
public function __construct($db)
{
$this->db = $db;
}
//The vehicle years list will always be the same regardless of make or model - block_var = "vehicle_years"
public function years()
{
$sql = 'SELECT DISTINCT year FROM phpbb_vehicles';
var_dump($sql);
$result = $this->db->sql_query($sql);
$data = array();
while ($row = $this->db->sql_fetchrow($result)) {
$data = $row['year'];
}
$this->db->sql_freeresult($result);
$myArray = array(1, 2, 3);
echo ("good job");
exit;
}
//.. your other functions
}
//handle ajax post data
if (isset($_POST['action']) && !empty($_POST['action'])) {
$action = $_POST['action'];
$vehicle = new vehicle($db);
switch($action) {
case 'get_vehicle_makes' :
$vehicle->makes();
break;
case 'get_vehicle_models' :
$vehicle->models();
break;
case 'test' :
$vehicle->years();
break;
}
}
其中显示的内容如下: This is my actual result 但是我希望得到这个: My desired result
答案 0 :(得分:0)
如果您只使用Text组件而不是View来包装它们,它应该可以工作:
<Text>
<Text style={styles.style1}>
{text1}
</Text>
<Text style={styles.style2}>
{text2}
</Text>
</Text>
答案 1 :(得分:0)
<Text>
<Text style={{fontWeight: "bold"}}>Description: </Text>
This is an example of the text flow I want to achieve.
</Text>