我使用以下代码在UIScrollView中添加imageView
class App extends React.Component {
constructor() {
super();
}
render() {
const sample_rooster = {
"players":
[
{ "name": "Bill Freehan", "team": "Detroit Tigers", "points": "51" },
{ "name": "Bobby France", "team": "Montreal Oilers", "points": "13" },
{ "name": "Dwayne Johnson", "team": "Wrestlemania", "points": "25" },
{ "name": "Mario Lemeaux", "team": "Hockey Guy", "points": "89" },
{ "name": "Dancing Queen", "team": "ABBA", "points": "53" },
{ "name": "Eric The Red", "team": "Unicorns", "points": "43" },
{ "name": "Yasmeen Bleeth", "team": "Baywatch", "points": "151" },
{ "name": "Bill Lambeer", "team": "Detroit Pistons", "points": "8" },
{ "name": "Bill Pullman", "team": "Independence Day", "points": "111" },
{ "name": "Tony The Tiger", "team": "Detroit Tigers", "points": "41" },
{ "name": "Johnny Cage", "team": "Mortal Kombat", "points": "33" },
{ "name": "Ricky Gervais", "team": "The Offices", "points": "2001" },
{ "name": "Chester Cheetah", "team": "Detroit Tigers", "points": "21" },
{ "name": "Drake", "team": "Rap Guy", "points": "64" },
{ "name": "Lovely Rita", "team": "Beatles Song", "points": "11" },
{ "name": "Pinocchio", "team": "Fairy Tails", "points": "22" },
{ "name": "Pamela Anderson", "team": "Baywatch", "points": "31" },
{ "name": "Yellow Submarine", "team": "Beatles Song", "points": "221" },
{ "name": "Red Honda", "team": "Cool Cars", "points": "213" },
{ "name": "Mickey Lolich", "team": "Detroit Tigers", "points": "121" }
]
}
return (
<div>
<ReactTable
data={sample_rooster.players}
columns={[
{
Header: 'Name',
accessor: 'name'
},
{
Header: 'Team',
accessor: 'team'
},
{
Header: 'Points',
accessor: 'points'
}
]}
defaultPageSize={10}
className="-striped -highlight"
/>
</div>
);
}
}
代码按预期工作正常,但是当图像缩小时,imageView不再居中,但是如果我将其放大,则居中。
有关缩小后如何使图像居中的任何建议