-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring using typescript + new API
- Loading branch information
Marvin Frachet
authored
Jul 16, 2019
1 parent
1153075
commit 070a1bb
Showing
112 changed files
with
34,803 additions
and
7,872 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,3 @@ | ||
coverage | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
*.keystore | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
node_modules/**/* | ||
example/placeholder/** | ||
example/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
docs | ||
src/**/*.test.js | ||
src/**/*.spec.js | ||
example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- 'stable' | ||
- "stable" | ||
before_script: | ||
- yarn check:lint | ||
after_script: | ||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,66 @@ | ||
[](https://travis-ci.org/mfrachet/rn-placeholder) | ||
[](https://coveralls.io/github/mfrachet/rn-placeholder?branch=master) | ||
[](https://opensource.org/licenses/MIT) | ||
|
||
Display some placeholder stuff before rendering your text or media content in React Native. | ||
Display some placeholder stuff before rendering your text or media content in React Native. Compatible with [Expo](https://expo.io/) and [react-native-web](https://github.com/necolas/react-native-web). | ||
|
||
Fully compatible with [Expo](https://expo.io/) and [react-native-web](https://github.com/necolas/react-native-web). | ||
[Here's a Snack application using the module and the different animations **with copy to clipboard!**](https://snack.expo.io/@mfrachet/84bb31) | ||
|
||
<p align="center"> | ||
<img src="./docs/demo.gif" /> | ||
</p> | ||
--- | ||
|
||
# Content | ||
 | ||
|
||
_This is the content of the v2. If you're still using a version < 2, you should use [this documentation instead](https://github.com/mfrachet/rn-placeholder/tree/v1.3.2)._ | ||
# Usage | ||
|
||
- <a href="#usage">How to use it ?</a> | ||
- [Components available](./docs/COMPONENTS.md) | ||
- [Using default animations](./docs/ANIMATIONS.md#default) | ||
- [Using a custom animation](./docs/ANIMATIONS.md#custom-animations) | ||
|
||
<h1 name="#usage">Usage</h1> | ||
|
||
### Installation | ||
## Installation | ||
|
||
```javascript | ||
$ yarn add rn-placeholder | ||
``` | ||
|
||
### In your code | ||
|
||
_This is a new API coming from v2. However, the v1 APIs are still available in [components available](./docs/COMPONENTS.md)_ | ||
## In your code | ||
|
||
```jsx | ||
import Placeholder, { Line, Media } from "rn-placeholder"; | ||
|
||
const ComponentLoaded = () => <Text>I'm loaded!</Text>; | ||
const MyComponent = () => { | ||
const [isReady, setReady] = useState(false); | ||
// your logic | ||
return ( | ||
<Placeholder | ||
isReady={isReady} | ||
animation="fade" | ||
whenReadyRender={() => <ComponentLoaded />} | ||
renderLeft={() => <Media hasRadius />} | ||
renderRight={() => <Media />} | ||
> | ||
<Line width="70%" /> | ||
<Line /> | ||
<Line /> | ||
<Line width="30%" /> | ||
</Placeholder> | ||
); | ||
}; | ||
import { | ||
Placeholder, | ||
PlaceholderMedia, | ||
PlaceholderLine, | ||
Fade | ||
} from "rn-placeholder"; | ||
|
||
const App = () => ( | ||
<Placeholder | ||
Animation={Fade} | ||
Left={PlaceholderMedia} | ||
Right={PlaceholderMedia} | ||
> | ||
<PlaceholderLine width={80} /> | ||
<PlaceholderLine /> | ||
<PlaceholderLine width={30} /> | ||
</Placeholder> | ||
); | ||
``` | ||
|
||
The v3 comes with an example app that provides different stories and example of the library: | ||
|
||
- [Stories for elements](./example/storybook/stories/elements.tsx) | ||
- [Stories for animations](./example/storybook/stories/animations.tsx) | ||
- [Stories for customizing elements](./example/storybook/stories/customizeElements.tsx) | ||
- [Stories for customizing animations](./example/storybook/stories/customizeAnimation.tsx) | ||
|
||
## Run the example app | ||
|
||
To start the app: | ||
|
||
```sh | ||
$ git clone https://github.com/mfrachet/rn-placeholder | ||
$ cd rn-placeholder | ||
$ yarn | ||
$ yarn start | ||
``` | ||
|
||
When the value of `isReady` changes to something _truthy_, the `ComponentLoaded` will be rendered. | ||
## V3 features | ||
|
||
- Rewritten in [Typescript](https://www.typescriptlang.org/) | ||
- Less code, more fun 😎 | ||
- API [Suspense](https://reactjs.org/docs/code-splitting.html#suspense) oriented | ||
- [New animations](./src/animations) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.