Skip to content

Commit

Permalink
feat(animations): fade
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrk committed Nov 29, 2020
1 parent ff5ceeb commit ae20710
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 5 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@react-native-firebase/crashlytics": "10.0.0",
"@react-native-firebase/messaging": "10.1.0",
"@react-native-firebase/perf": "10.0.0",
"@react-native-firebase/remote-config": "10.1.0",
"@react-navigation/drawer": "5.11.3",
"@react-navigation/material-bottom-tabs": "5.3.9",
"@react-navigation/native": "5.8.9",
Expand All @@ -33,12 +34,14 @@
"react-native-navigation-bar-color": "2.0.1",
"react-native-paper": "4.0.0",
"react-native-reanimated": "1.13.2",
"react-native-redash": "15.11.1",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "2.15.0",
"react-native-shared-element": "0.7.0",
"react-native-svg": "12.1.0",
"react-native-vector-icons": "7.1.0",
"react-navigation-shared-element": "5.0.0-alpha1",
"semver": "7.3.2",
"storeon": "3.1.1"
},
"devDependencies": {
Expand All @@ -50,6 +53,7 @@
"@types/react-native": "0.63.1",
"@types/react-native-dotenv": "0.2.0",
"@types/react-native-vector-icons": "6.4.6",
"@types/semver": "7.3.4",
"@typescript-eslint/eslint-plugin": "3.6.1",
"@typescript-eslint/parser": "3.6.1",
"babel-jest": "26.1.0",
Expand Down
17 changes: 17 additions & 0 deletions src/components/Animations/Fade/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from 'react'
import Animated from 'react-native-reanimated'
import { useTimingTransition } from 'react-native-redash/lib/module/v1'

import { FadeProps } from './types'

export const Fade: React.FC<FadeProps> = ({ value, style, ...rest }) => {
const opacity = useTimingTransition(value, { duration: 200 })

return (
<Animated.View
style={[style, { opacity }]}
pointerEvents={value > 0 ? 'auto' : 'none'}
{...rest}
/>
)
}
6 changes: 6 additions & 0 deletions src/components/Animations/Fade/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ViewProps } from 'react-native'

export interface FadeProps extends ViewProps {
/** data */
value: number,
}
1 change: 1 addition & 0 deletions src/components/Animations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Fade } from './Fade'
51 changes: 46 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,11 @@
resolved "https://registry.yarnpkg.com/@react-native-firebase/perf/-/perf-10.0.0.tgz#bfe24075925d686c314cf6432b75a7a3ca60eb81"
integrity sha512-ubOzI5QrszElz20QSpB0O92ZZdY6Wc/z8QL14W/RmMSPfHS2casDY2NMPKhQPp4FuTxuXc/UkcBSvybGeE5ycg==

"@react-native-firebase/remote-config@10.1.0":
version "10.1.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/remote-config/-/remote-config-10.1.0.tgz#f99da58e7723956b54b5b0df5785adc3d3b55a09"
integrity sha512-FOzNw3QCZGfAh3UpYAm2o0GIS8Rw/MYbJlKKb4gxcRcM08xHFS6h/mmhQKaE7FBDtUyJng0pM0rTv4YupsMI2g==

"@react-navigation/core@^5.14.3":
version "5.14.3"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.14.3.tgz#6bbbfe1fb90aa64068fdb69bbb6c55120b7b24f1"
Expand Down Expand Up @@ -1706,6 +1711,11 @@
"@types/prop-types" "*"
csstype "^2.2.0"

"@types/semver@7.3.4":
version "7.3.4"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb"
integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==

"@types/stack-utils@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
Expand Down Expand Up @@ -1802,6 +1812,11 @@ abort-controller@^3.0.0:
dependencies:
event-target-shim "^5.0.0"

abs-svg-path@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/abs-svg-path/-/abs-svg-path-0.1.1.tgz#df601c8e8d2ba10d4a76d625e236a9a39c2723bf"
integrity sha1-32Acjo0roQ1KdtYl4japo5wnI78=

absolute-path@^0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/absolute-path/-/absolute-path-0.0.0.tgz#a78762fbdadfb5297be99b15d35a785b2f095bf7"
Expand Down Expand Up @@ -5989,6 +6004,13 @@ normalize-path@^3.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==

normalize-svg-path@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/normalize-svg-path/-/normalize-svg-path-1.1.0.tgz#0e614eca23c39f0cffe821d6be6cd17e569a766c"
integrity sha512-r9KHKG2UUeB5LoTouwDzBy2VxXlHsiM6fyLQvnJa0S5hrhzqElH/CH7TUGhT1fVvIYBIKf3OpY4YJ4CK+iaqHg==
dependencies:
svg-arc-to-cubic-bezier "^3.0.0"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand Down Expand Up @@ -6328,6 +6350,11 @@ parse-node-version@^1.0.0:
resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b"
integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==

parse-svg-path@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/parse-svg-path/-/parse-svg-path-0.1.2.tgz#7a7ec0d1eb06fa5325c7d3e009b859a09b5d49eb"
integrity sha1-en7A0esG+lMlx9PgCbhZoJtdSes=

parse5@5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178"
Expand Down Expand Up @@ -6708,6 +6735,15 @@ react-native-reanimated@1.13.2:
dependencies:
fbjs "^1.0.0"

react-native-redash@15.11.1:
version "15.11.1"
resolved "https://registry.yarnpkg.com/react-native-redash/-/react-native-redash-15.11.1.tgz#c9a21b20157fb6e0d35337d0dc159371248d78b5"
integrity sha512-chQkd9t4gecqEz5Gr7D+bl3q5eG2hhHyadO7QT5l893abLFkRHDGY9YtEGwkR/j050TQl5A1KdxuCJEzxhogQw==
dependencies:
abs-svg-path "^0.1.1"
normalize-svg-path "^1.0.1"
parse-svg-path "^0.1.2"

react-native-safe-area-context@3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.1.9.tgz#48864ea976b0fa57142a2cc523e1fd3314e7247e"
Expand Down Expand Up @@ -7197,16 +7233,16 @@ scheduler@0.19.1, scheduler@^0.19.1:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

semver@7.3.2, semver@^7.2.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==

semver@^6.0.0, semver@^6.1.0, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.2.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==

send@0.17.1:
version "0.17.1"
resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"
Expand Down Expand Up @@ -7747,6 +7783,11 @@ supports-hyperlinks@^2.0.0:
has-flag "^4.0.0"
supports-color "^7.0.0"

svg-arc-to-cubic-bezier@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/svg-arc-to-cubic-bezier/-/svg-arc-to-cubic-bezier-3.2.0.tgz#390c450035ae1c4a0104d90650304c3bc814abe6"
integrity sha512-djbJ/vZKZO+gPoSDThGNpKDO+o+bAeA4XQKovvkNCqnIS2t+S4qnLAGQhyyrulhCFRl1WWzAp0wUDV8PpTVU3g==

symbol-observable@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
Expand Down

0 comments on commit ae20710

Please sign in to comment.