mirror of
https://github.com/zhigang1992/react-native-web-lottie.git
synced 2026-01-12 17:43:01 +08:00
Initial commit
This commit is contained in:
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
dist
|
||||
11
.npmignore
Normal file
11
.npmignore
Normal file
@@ -0,0 +1,11 @@
|
||||
*.test.js
|
||||
__snapshots/**
|
||||
.babelrc
|
||||
.eslintrc
|
||||
.eslintignore
|
||||
.flowconfig
|
||||
.yarn.lock
|
||||
.gitattributes
|
||||
.prettierrc
|
||||
docs/
|
||||
.idea
|
||||
5
.prettierrc
Normal file
5
.prettierrc
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Louis Lagrange
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
26
README.md
Normal file
26
README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# react-native-web-lottie
|
||||
> React Native for Web implementation of Lottie
|
||||
|
||||
## Getting started
|
||||
`$ npm install react-native-web-lottie --save`
|
||||
|
||||
Alias the package in your webpack config:
|
||||
|
||||
```
|
||||
resolve: {
|
||||
alias: {
|
||||
'react-native': 'react-native-web',
|
||||
...
|
||||
'lottie-react-native': 'react-native-web-lottie',
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
See [Lottie's docs](http://airbnb.io/lottie/react-native/react-native.html/).
|
||||
|
||||
## Examples
|
||||
See the [storybook](https://react-native-web-community.github.io/react-native-web-lottie/storybook).
|
||||
|
||||
## Contributing
|
||||
PRs are welcome!
|
||||
1
docs/.storybook/addons.js
Normal file
1
docs/.storybook/addons.js
Normal file
@@ -0,0 +1 @@
|
||||
import '@storybook/addon-options/register';
|
||||
20
docs/.storybook/config.js
Normal file
20
docs/.storybook/config.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { setOptions } from '@storybook/addon-options';
|
||||
import { configure, addDecorator } from '@storybook/react';
|
||||
import centered from './decorator-centered';
|
||||
|
||||
addDecorator(centered);
|
||||
|
||||
setOptions({
|
||||
name: 'Name',
|
||||
url: 'https://react-native-web-community.github.io/react-native-web-name',
|
||||
goFullScreen: false,
|
||||
showLeftPanel: true,
|
||||
showDownPanel: false,
|
||||
downPanelInRight: false
|
||||
});
|
||||
|
||||
function loadStories() {
|
||||
require('../stories');
|
||||
}
|
||||
|
||||
configure(loadStories, module);
|
||||
15
docs/.storybook/decorator-centered.js
Normal file
15
docs/.storybook/decorator-centered.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
minHeight: '100vh',
|
||||
},
|
||||
});
|
||||
|
||||
export default function(renderStory) {
|
||||
return <View style={styles.root}>{renderStory()}</View>;
|
||||
}
|
||||
29
docs/.storybook/webpack.config.js
Normal file
29
docs/.storybook/webpack.config.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = (storybookBaseConfig, configType) => {
|
||||
const DEV = configType === 'DEVELOPMENT';
|
||||
|
||||
storybookBaseConfig.module.rules.push({
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: { cacheDirectory: true }
|
||||
}
|
||||
});
|
||||
|
||||
storybookBaseConfig.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||
'process.env.__REACT_NATIVE_DEBUG_ENABLED__': DEV
|
||||
})
|
||||
);
|
||||
|
||||
storybookBaseConfig.resolve.alias = {
|
||||
'react-native': 'react-native-web',
|
||||
'lottie-react-native': path.join(__dirname, '../../src/')
|
||||
};
|
||||
|
||||
return storybookBaseConfig;
|
||||
};
|
||||
11
docs/package.json
Normal file
11
docs/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "yarn && build-storybook -o ./dist -c ./.storybook",
|
||||
"start": "start-storybook -p 9001 -c ./.storybook",
|
||||
"release": "yarn build && git checkout gh-pages && rm -rf ../storybook && mv dist ../storybook && git add -A && git commit -m \"Storybook deploy\" && git push origin gh-pages && git checkout -"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/addon-options": "^3.2.10",
|
||||
"@storybook/react": "^3.1.9"
|
||||
}
|
||||
}
|
||||
6
docs/stories/index.js
Normal file
6
docs/stories/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
import Lottie from 'lottie-react-native';
|
||||
|
||||
import { storiesOf } from '@storybook/react';
|
||||
|
||||
storiesOf('Lottie', module).add('basic', () => <Lottie />);
|
||||
5098
docs/yarn.lock
Normal file
5098
docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
42
package.json
Normal file
42
package.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "react-native-web-lottie",
|
||||
"version": "0.0.0",
|
||||
"description": "React Native for Web implementation of Lottie",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:react-native-web-community/react-native-web-lottie.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "Louis Lagrange",
|
||||
"email": "lagrange.louis@gmail.com",
|
||||
"url": "https://github.com/Minishlink"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
"react-native-web",
|
||||
"lottie-react-native"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"react-native"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-preset-react-native": "^4.0.0",
|
||||
"prettier": "^1.7.3",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"react-native-web": "^0.1.1",
|
||||
"webpack": "^3.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react-native-web": "*"
|
||||
}
|
||||
}
|
||||
1
src/index.js
Normal file
1
src/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export default () => null;
|
||||
Reference in New Issue
Block a user