什么是实施的最佳实践SegmentedControllIOS与ListView?我尝试了三个解决方案,所有示例都包含SegmentedControllIOS两个段和两个段ListView.我邀请您讨论这三个的表现(也许有人可以提出其他更好的解决方案).从我的角度来看,示例是从最有效的顺序给出的.
class Example extends Component {
constructor(props) {
super(props);
this.state = {
ds1: new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2,}),
ds2: new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2,}),
index: 0,
};
}
render() {
return (
<View>
<SegmentedControlIOS
selectedIndex={this.state.index}
values={['ds1', 'ds2']}
onChange={() => this.setState({index: (this.state.index+1)%2})}
/>
<ListView dataSource={this.state.index ? this.state.ds2 : this.state.ds1} />
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
class Example extends Component {
constructor(props) {
super(props);
this.state …Run Code Online (Sandbox Code Playgroud) 我想用不透明的框架和透明的中心显示来自相机的视图。像图片中的东西(黑色部分是相机的视图)。我正在寻找具有纯 react-native 组件的解决方案,没有额外的库(如https://github.com/gilbox/react-native-masked-view),而不添加带有透明中心或其他黑客的全屏图像。