React-native 读取md 文件
2018-09-19 本文已影响3人
ziqiDev
put your file in assets folder and then fetch using react-native-fetch-blob package
RNFetchBlob.fs.readStream(RNFetchBlob.fs.asset('test.md'), 'utf8')
.then((stream) => {
let data = '';
stream.open();
stream.onData((chunk) => {
data += chunk;
});
stream.onEnd(() => {
this.setState({
data,
});
});
});