Javascript 如何删除react native file selector中的顶部应用程序栏?
我正在构建一个文件资源管理器,并为此使用react native file selector library,但我想从应用程序中删除顶部的应用程序栏,其中包含后退按钮和取消按钮,并默认使用react native file selector library。 下面是我使用的代码。在这个使用RNFileSelector(react native file selector的一部分)的例子中,它给出了一个由nbsp MaterialFilePicker(用于android)构建的android设计 在这里,我想删除顶部的应用程序栏,我如何才能实现这一点Javascript 如何删除react native file selector中的顶部应用程序栏?,javascript,android,reactjs,react-native,react-native-android,Javascript,Android,Reactjs,React Native,React Native Android,我正在构建一个文件资源管理器,并为此使用react native file selector library,但我想从应用程序中删除顶部的应用程序栏,其中包含后退按钮和取消按钮,并默认使用react native file selector library。 下面是我使用的代码。在这个使用RNFileSelector(react native file selector的一部分)的例子中,它给出了一个由nbsp MaterialFilePicker(用于android)构建的android设计
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
import RNFileSelector from 'react-native-file-selector'
import RNFS from 'react-native-fs'
export default class App extends Component<Props> {
constructor (props) {
super(props)
this.state = {
visible: true
}
}
_onPress () {
let filter;
if (Platform.OS === 'ios') {
filter = [];
} else if (Platform.OS === 'android') {
filter = ".*\\.*";
}
RNFileSelector.Show(
{
path: "/storage/",
filter: filter,
title: 'Select File',
closeMenu: true,
editable: true,
chooseFolderMode: true,
onDone: (path) => {
console.log('file selected: ' + path)
},
onCancel: () => {
console.log('cancelled')
}
}
)
}
componentDidMount () {
}
render() {
return <View style={styles.container}>
<TouchableOpacity onPress={() => {
this._onPress()
// this.setState({ visible: true });
}}>
<Text>Click</Text>
<RNFileSelector title={"Select File"} visible={this.state.visible} onDone={(path) => {
console.log("file selected: " + path);
this._onPress();
}} onCancel={() => {
this._onPress();
console.log("cancelled");
}}/>
</TouchableOpacity>
</View>;
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});
import React,{Component}来自'React';
进口{
平台,
样式表,
文本,
看法
可触摸不透明度
}从“反应本机”;
从“反应本机文件选择器”导入RNFileSelector
从“反应本机fs”导入RNFS
导出默认类应用程序扩展组件{
建造师(道具){
超级(道具)
此.state={
可见:正确
}
}
_onPress(){
让我们过滤;
如果(Platform.OS==='ios'){
过滤器=[];
}else if(Platform.OS==='android'){
筛选器=“\\\*”;
}
RNFileSelector.Show(
{
路径:“/storage/”,
过滤器:过滤器,
标题:“选择文件”,
关闭菜单:正确,
是的,
选择FolderMode:true,
onDone:(路径)=>{
console.log('所选文件:'+路径)
},
onCancel:()=>{
console.log('已取消')
}
}
)
}
组件安装(){
}
render(){
返回
{
这个._onPress()
//this.setState({visible:true});
}}>
点击
{
log(“所选文件:“+path”);
这个;
}}onCancel={()=>{
这个;
控制台日志(“取消”);
}}/>
;
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“#F5FCFF”,
}
});