react-native-uri-box
v0.0.7
Published
An extendible React <Component/> which will attempt to render source content consistently, based on the MIME type.
Downloads
24
Maintainers
Readme
react-native-uri-box
An extendible React <Component/> which will attempt to render source content consistently, based on the MIME type.
🚀 Getting Started
Using npm
:
yarn add react-native-uri-box
Using yarn
:
yarn add react-native-uri-box
✍️ Example
Just use this as a drop-in component for your remote content:
import UriBox, { LookUpTable } from 'react-native-uri-box';
import Video from 'react-native-video';
const App = () => (
<UriBox
style={{
flex: 1,
}}
source={{
// XXX: The content type is determined from the source.
uri: 'http://www.cawfree.com/mapsy/img/mapsy.jpg',
}}
lookUpTable={{
// XXX: The lookUpTable can be used to add support for
// additional MIME types.
...LookUpTable,
['video/mp4']: ({ ...extraProps }) => (
<Video
{...extraProps}
resizeMode="cover"
loop
muted
/>
),
}}
/>
);