React Native Bridge for Native Spruce Animation Library

Overview

PRs Welcome

ReactNative Spruce - (Android & iOS): Deprecated

Due to time constraint, this library is deprecated and not maintained anymore, You can still use this library.

If this project has helped you out, please support us with a star 🌟

Spruce is a lightweight animation library that helps choreograph the animations on the screen. With so many different animation libraries out there, developers need to make sure that each view is animating at the appropriate time. Spruce can help designers request complex multi-view animations and not have the developers cringe at the prototype.

It provides a React Native Bridge around native spruce library. Here is a quick example of how you can Spruce up your screens!

Note: Currently on iOS it is not supported due to unavailable of Spruce Objective-C wrappers, please refer issue: 101

📖 Getting started

$ npm install react-native-spruce --save

$ react-native link react-native-spruce

  • Android

    • Please copy below snippet in your app build.gradle file:
buildscript {
    repositories {
        jcenter()
        google()
        ...
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        google()
        ...
    }
}

Note: Android SDK 27 > is supported

💻 Usage

import {
  Spruce,
  CorneredSort,
  DefaultAnimations
} from "react-native-spruce";


// TODO: What to do with the module?

render () {
  let sortWith = new CorneredSort(100);
  let animateWith = DefaultAnimations.shrinkAnimator(1000)

  <Spruce sortWith={sortWith} animateWith={animateWith} animator={{ propertyName: "translationX", values: [5000, 0], duration: 800 }}>
    <View />
  </Spruce>
}

Using a SortFunction

Luckily, RNSpruce comes with 8 SortFunction implementations with a wide open possibility to make more! Use the SortFunction to change the order in which views animate. Consider the following example:

let sort = new LinearSort(/*interObjectDelay=*/100L, /*reversed=*/false, LinearSort.Direction.TOP_TO_BOTTOM);

To make sure that developers can use RNSpruce out of the box, we included about 8 stock SortFunction implementations. These are some of the main functions we use at WillowTree and are so excited to see what others come up with!

  • DefaultSort
let sort = new DefaultSort(/*interObjectDelay=*/100L);
  • LinearSort
let sort = new LinearSort(/*interObjectDelay=*/100L, /*reversed=*/false, LinearSort.Direction.TOP_TO_BOTTOM);
  • CorneredSort
let sort = new CorneredSort(/*interObjectDelay=*/100L, /*reversed=*/false, CorneredSort.Corner.TOP_LEFT);
  • RadialSort
let sort = new RadialSort(/*interObjectDelay=*/100L, /*reversed=*/false, RadialSort.Position.TOP_LEFT);
  • RandomSort
let sort = new RandomSort(/*interObjectDelay=*/100L);
  • InlineSort
let sort = new InlineSort(/*interObjectDelay=*/100L, /*reversed=*/false, LinearSort.Direction.TOP_TO_BOTTOM);
  • ContinousSort
let sort = new ContinousSort(/*interObjectDelay=*/100L, /*reversed=*/false, ContinousSort.Position.TOP_LEFT);

Stock Animators

To make everybody's lives easier, the stock animators perform basic View animations that a lot of apps use today. Mix and match these animators to get the core motion you are looking for.

  • DefaultAnimations.growAnimator(duration:number)
  • DefaultAnimations.shrinkAnimator(duration:number)
  • DefaultAnimations.fadeAwayAnimator(duration:number)
  • DefaultAnimations.fadeInAnimator(duration:number)
  • DefaultAnimations.spinAnimator(duration:number)

Experiment which ones work for you! If you think of anymore feel free to add them to the library yourself!

Credits

🤔 How to contribute

Have an idea? Found a bug? Please raise to ISSUES. Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list below.

📜 License

This library is provided under the Apache 2 License.

RNSpruce @ prscX

💖 Support my projects

I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like 🚀

  • If you're feeling especially charitable, please follow prscX on GitHub.

    Buy Me A Coffee

    Thanks! ❤️
    prscX.github.io
    </ Pranav >

Comments
  • Use the module together with another module: react-native-super-grid

    Use the module together with another module: react-native-super-grid

    @prscX : Hi, I would like to get the same effect that you see in the image, the number 3. Image: https://raw.githubusercontent.com/willowtreeapps/spruce-ios/master/imgs/extensibility-tests.gif

    To make the grid-view, use: react-native-super-grid. But I can not get the same result.

    Here is a code example: https://snack.expo.io/Sk2gfsZUM

    How can I do?

    P.Š. Is it possible to reset animation on command to be able to repeat it?

    bug 
    opened by Angelk90 11
  • app:processDebugResources Error retrieving parent for item (values-v24.xml)

    app:processDebugResources Error retrieving parent for item (values-v24.xml)

    I've managed to react-native link by re-creating the project.

    Now, when i try to react-native run-android the application, build fails.

    Here is the error:

    :app:processDebugResources
    
    C:\Users\mtlok\Desktop\pep\myspruce\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
    
    C:\Users\mtlok\Desktop\pep\myspruce\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
    
    
    :app:processDebugResources FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > com.android.ide.common.process.ProcessException: Failed to execute aapt
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    

    I have done something wrong? Why this is saying there is missing resource files?

    opened by joaoalbertocsjunior 10
  • Invariant Violation: Native component for

    Invariant Violation: Native component for "RNSpruceView" does not exist

    What i did:

    react-native init myproject

    cd myproject

    yarn add react-native-spruce

    react-native link

    copy-paste how to use section on readme.

    What i got:

    Invariant Violation: Native component for "RNSpruceView" does not exist

    https://ibb.co/kJ2zEG

    opened by joaoalbertocsjunior 3
  • error in iOS example

    error in iOS example

    TypeError: undefined is not a constructor (evaluating 'new _reactNativeSpruce.CorneredSort(60)')
    
    This error is located at:
        in App (at renderApplication.js:33)
    
    render
        App.js:8:36
    

    The issue is here: https://github.com/prscX/react-native-spruce/blob/7d4e556ab8e5cecc4f35ccd0c0998156a5ddd82b/SpruceExample/App.js#L8

    steps

    git clone [email protected]:prscX/react-native-spruce.git
    cd react-native-spruce/SpruceExample
    yarn
    react-native run-ios
    

    Got this warning when building the app:

    The following commands produced analyzer issues:
    	Analyze Base/RCTModuleMethod.mm normal x86_64
    (1 command with analyzer issues)
    

    Extra info:

    $ react-native info
    
    Environment:
      OS: macOS High Sierra 10.13.4
      Node: 8.11.1
      Yarn: 1.5.1
      npm: 5.8.0
      Watchman: 4.9.0
      Xcode: Xcode 9.3.1 Build version 9E501
      Android Studio: 3.1 AI-173.4720617
    
    Packages: (wanted => installed)
      react: 16.3.1 => 16.3.1
      react-native: 0.55.4 => 0.55.4
    
    opened by gianpaj 2
  • Could this framework work with react-native-web?

    Could this framework work with react-native-web?

    Hi, I have seen that spruce is a wrapper for IOS and Android, however I have seen that there is a js folder in the project. Would the library be able to work with react native web or react web?

    https://github.com/taobaofed/react-web
    https://github.com/necolas/react-native-web

    opened by DavidGOrtega 1
  • Fix example: add gradle's google repository

    Fix example: add gradle's google repository

    Fix example build.

    A problem occurred configuring root project 'SpruceExample'.

    Could not resolve all files for configuration ':classpath'. Could not find com.android.tools.build:gradle:3.0.1. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar_

    opened by maggialejandro 1
  • PNSpruceView was not found in the UIManager

    PNSpruceView was not found in the UIManager

    Thanks for your component first. I have checked the other relative issues and havn't found solution.

    I run the command react-native link react-native-spruce and this my relative file: image image image

    here's error trace screenshot_2018-12-30-00-01-07-452_com gakki2

    opened by shuiRong 0
  • Not recognizing children sizes

    Not recognizing children sizes

    Hello, thanks for your plugin, it seems that is not respecting the size of the component children, i have the Spruce component and his children is a button with height:20 and here is the result

    captura de pantalla 2018-06-12 a la s 13 27 46

    any fix for this?

    bug 
    opened by cinder92 1
  • invariant Violation: Native component for

    invariant Violation: Native component for "RNSpruceView" does not exist

    Hello, After installing react-native-spruce, I tried to use in the example of the List component and I get this error C:\Users\XXX/\node_modules\react-native\Libraries\Core\Exceptio…:65 Invariant Violation: Native component for "RNSpruceView" does not exist

    bug 
    opened by adirzoari 10
Releases(v0.0.6)
  • v0.0.6(May 21, 2018)

Owner
Pranav Raj Singh Chauhan
Technical Director at @MetricStream
Pranav Raj Singh Chauhan
Gesture based interruptible animation samples in React Native.

Gesture based interruptible animation samples in React Native.

Ashu 178 Dec 28, 2022
A simple animation for react-native

Simple structure Simple and performance Easy to start a new project Support more platform: android, ios and web Techincal react-native: lets you creat

null 9 Nov 6, 2022
React Native's Animated library reimplemented

React Native's Animated library reimplemented Reanimated 2 is here! Check out our documentation page for more information React Native Reanimated prov

Software Mansion 6.8k Jan 2, 2023
Legend Motion is a declarative animations library for React Native, to make it easy to transition between styles without needing to manage animations.

Legend Motion is a declarative animations library for React Native, to make it easy to transition between styles without needing to manage animations.

Legend 199 Dec 29, 2022
Modern Animated UI Library For React-Native

react-native-ui-toolkit UI Toolkit For React Native Installation npm install react-native-ui-toolkit Usage import { ScrollableHeader } from "react-nat

Tariq Khan 3 Sep 14, 2022
Standard set of easy to use animations and declarative transitions for React Native

react-native-animatable Declarative transitions and animations for React Native Installation $ npm install react-native-animatable --save Usage To ani

Joel Arvidsson 9.4k Jan 3, 2023
Experimental implementation of high performance interactable views in React Native

Interactable react-native-interactable LOOKING FOR A MAINTAINER We love this project, but currently we don’t have enough time to work on it. So we are

Wix.com 5.2k Dec 29, 2022
Create magical move transitions between scenes in react-native 🐰🎩✨

Important react-native-shared-element update! A follow up project called react-native-shared-element has been created which can be considered the succ

Hein Rutjes 980 Nov 27, 2022
React Native component for animated sprite and tweening

The React Native Animated Sprite react-native-animated-sprite (RNAS) package is a feature rich declarative component for animation, tweening, and drag

null 131 Jan 4, 2023
React-native-animatable-flatlist: Ready to go animatable flatlist based on reanimated 2

react-native-animatable-flatlist ready to go animatable flatlist based on reanimated 2 Features Hooks support Not opinionaded, Fully extendable Suppor

kubilay 5 Apr 27, 2022
React Native Fiesta - A set of celebration animations

?? A set of celebration animations powered by @shopify/react-native-skia. Engage more with your users by celebrating in your React Native application.

Mateo Guzmán 174 Jan 8, 2023
🎞️ Animated API math extension - approximates sin, cos and tan by combining Animated Nodes with full Native Driver support

react-native-animated-math An Animated API math extension - implementing sine, cosine, tangent and others as AnimatedNodes. All calculations are imple

Michael Straßburger 74 Dec 7, 2022
React Bridge to the ART Drawing Library

Note: This package is now part of the facebook/react monorepo. React ART React ART is a JavaScript library for drawing vector graphics using React. It

React Community 2k Jan 3, 2023
React Bridge to the ART Drawing Library

Note: This package is now part of the facebook/react monorepo. React ART React ART is a JavaScript library for drawing vector graphics using React. It

React Community 2k Dec 10, 2022
Snoopy is a profiling tool for React Native, that lets you snoop on the React Native Bridge.

React Native Snoopy UPDATE: I wrote an article with the story behind this library. Snoopy is a profiling tool for React Native, that lets you snoop on

Dotan J. Nahum 527 Sep 29, 2022
React Native bridge for gtk desktop applications

react-gtk cross-platform react native desktop applications Please ★ this repo if you found it useful ★ ★ ★ Built with Node GTK Built by Silicon Hills

Clay Risser 266 Jan 6, 2023
React native bridge for AppAuth - an SDK for communicating with OAuth2 providers

React Native App Auth React native bridge for AppAuth - an SDK for communicating with OAuth2 providers This versions supports [email protected]+. The

Formidable 1.6k Dec 28, 2022
A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app

react-native-idle-timer A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app Install npm insta

Marc Shilling 160 Dec 13, 2022
React Native Bridge for ADBannerView – DEPRECATED

react-native-adbannerview [DEPRECATED] This component serves as a bridge for ADBannerview. Feel free to contribute :-) Installation npm install react-

Patrick Puritscher 56 May 31, 2020
React Native module bridge to iOS MFMessageComposeViewController

08/01/2017 - This project is no longer actively maintained. It will remain here so it can still be used but there will be no further updates or bug fi

null 48 Oct 4, 2021