Giter VIP home page Giter VIP logo

now-you-see-react's Introduction

Logo

Now You See Me

Platform Swift License

NowYouSeeReact adds support for react native views on top of the iOS tracking framework NowYouSeeMe.

Need

There is no Cell class in React Native equivalent to UIKit's UITableViewCell or UICollectionViewCell.

Hence, it becomes difficult to identify when a react native view (RCTView) is recycled as we do not have access to the actual recycled view (cell) which in turn causes problems in calculating the absolute frame and viewability of the view and its subviews once recycled.

Hence, as a solution to the problem, we have enabled tracking for all the react native views by default, so that we can get hold of the recycled react native view (cell) and successfully update the viewability of all of its children.

Usage

To enable the framework you need to call the following method before the UI is created:

NowYou.seeReact()  // didFinishLaunchingWithOptions is a good place to initialise the framework

The method internally calls NowYou.seeMe() to enable the parent framework

For all other usage details, please refer NowYouSeeMe.

Demo project

There is a demo project present in the Example directory. The demo project contains a react native app which consists of a recyler list view, and each item in the recyler list view is a native view component with viewability conditions attached to it. Demo is created using react-native-cli

Steps to run demo project

  • Clone the repo
  • cd into Example/ios folder
  • pod install
  • open NowYouSeeReact.xcworkspace
  • Build and run
  • In case port 8081 is already occupied and you get an error, replace all occurrences of 8081 with some other port number and run npm start --port={port number} in terminal, post which you can build and run the demo app

Running demo

NowYouSeeReact-Demo

Installation

To integrate NowYouSeeMe into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'NowYouSeeReact', :git => 'https://github.com/Flipkart/now-you-see-react.git', :tag => '1.0.0'

# Not able to push to cocoapods due to React dependency

Then, run the following command:

$ pod install

Dependencies

Requirements

  • iOS 10.0+
  • Swift 5

Readme Score

now-you-see-react's People

Contributors

keerthika-priya avatar naveen-c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

now-you-see-react's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.