Skip to content

Commit

Permalink
v3 alpha 🎉 (#86)
Browse files Browse the repository at this point in the history
Refactoring using typescript + new API
  • Loading branch information
Marvin Frachet authored Jul 16, 2019
1 parent 1153075 commit 070a1bb
Show file tree
Hide file tree
Showing 112 changed files with 34,803 additions and 7,872 deletions.
21 changes: 0 additions & 21 deletions .eslintrc.json

This file was deleted.

57 changes: 3 additions & 54 deletions .gitignore
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
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
docs
src/**/*.test.js
src/**/*.spec.js
example
4 changes: 3 additions & 1 deletion .travis.yml
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
93 changes: 49 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,66 @@
[![Build Status](https://travis-ci.org/mfrachet/rn-placeholder.svg?branch=master)](https://travis-ci.org/mfrachet/rn-placeholder)
[![Coverage Status](https://coveralls.io/repos/github/mfrachet/rn-placeholder/badge.svg?branch=master)](https://coveralls.io/github/mfrachet/rn-placeholder?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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
![Image of the placeholder in action](./docs/placeholder.gif)

_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)
9 changes: 0 additions & 9 deletions babel.config.js

This file was deleted.

76 changes: 0 additions & 76 deletions docs/ANIMATIONS.md

This file was deleted.

Loading

0 comments on commit 070a1bb

Please sign in to comment.