抱歉,我的英语不是很好但是.
我使用日历类作为警报管理器的警报应用程序,但我有类日历实例的错误.我在其他论坛上投资,但我发现poblem是什么.拜托我需要你的帮忙.
我一直在尝试使用 React Native 和 Expo 在移动设备上保存图像,我尝试过这些软件包:
import RNFetchBlob from 'react-native-fetch-blob';
import RNfs from 'react-native-fs ';
Run Code Online (Sandbox Code Playgroud)
但在实现它们时都给了我这个错误
null is not an object (evaluating 'RNFetchBlob.DocumentDir')
Run Code Online (Sandbox Code Playgroud)
然后尝试 expo-file-system 但我没有看到任何清晰的示例来说明如何转换 base64 并将其下载到移动设备
更新
我能够做到这一点,我的目的是保存QR的base64并将其转换为png,同时能够共享它,我使用expo-file-system和做到了这一点expo-sharing
这是小米代码,
import * as FileSystem from 'expo-file-system';
import * as Sharing from 'expo-sharing';
//any image, I use it to initialize it
const image_source = 'https://images.unsplash.com/photo-1508138221679-760a23a2285b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80';
share=()=>{
var self = this;
self.setState({loading:true})
FileSystem.downloadAsync(
image_source,
FileSystem.documentDirectory + '.png'
)
.then(({ uri }) => {
console.log(self.state.base64Code);
FileSystem.writeAsStringAsync(
uri,
self.state.base64Code,
{'encoding':FileSystem.EncodingType.Base64} …Run Code Online (Sandbox Code Playgroud) 这是我的代码示例,但我不知道如何取值和使用后
class View extends Component {
componentDidMount() {
var id = {match.params.id}
}
render() {
return(
<Router>
<div>
<Route path="/View/:id" component={Child}/>
</div>
</Router>
)
}
}Run Code Online (Sandbox Code Playgroud)
我尝试在react中实现一个简单的轮播,我使用了纯css和库,但在所有情况下它总是显示如下
所有子项均以垂直线显示。
我尝试使用以下代码:
https://www.npmjs.com/package/react-responsive-carousel
https://www.npmjs.com/package/pure-react-carousel
总而言之,结果是相同的,我在 css 类中没有样式
import React, {Component} from 'react';
import { CarouselProvider, Slider, Slide, ButtonBack, ButtonNext }
from 'pure-react-carousel';
class App extends Component {
render() {
return (
<div className="App">
<CarouselProvider
naturalSlideWidth={30}
naturalSlideHeight={10}
totalSlides={3}
>
<Slide index={0}>
<img src="/img/Gallery01.png" />
</Slide>
<Slide index={1}>
<img src="/img/Gallery01.png" />
</Slide>
<Slide index={2}>
<img src="/img/Gallery01.png" />
</Slide>
</CarouselProvider>
</div>
);
}
}
export default App;
Run Code Online (Sandbox Code Playgroud) javascript ×2
reactjs ×2
alarmmanager ×1
android ×1
calendar ×1
css ×1
expo ×1
html ×1
java ×1
react-native ×1
react-router ×1