1.0.3 • Published 5 years ago

react-native-flipboard-flex v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

react-native-flipboard-flex

npm version

Device Information for React Native.

TOC

General Info

A React Native library for Flex tool that belong Flipboard. The original tool just support iOS, but this wrapper make at least don't fail either for Android or Web. a

Installation

Using npm:

npm install --save react-native-flibpoard-flex

or using yarn:

yarn add react-native-flipboard-flex

⚠️ If you are on React Native > 0.47, you must use version 0.11.0 of this library or higher

Linking

Automatic

react-native link react-native-flipboard-flex

(or using rnpm for versions of React Native < 0.27)

rnpm link react-native-flipboard-flex

Manual

Add the following line to your build targets in your Podfile

pod 'react-native-flipboard-flex', :path => '{node_modules_path}/react-native-flipboard-flex'

Where {node_modules_path} is the path where you have the node_modules, ussually one level up.

Then run pod install

  • optional in android/build.gradle:
...
  ext {
    // dependency versions
    googlePlayServicesVersion = "<Your play services version>" // default: "+"
    compileSdkVersion = "<Your compile SDK version>" // default: 23
    buildToolsVersion = "<Your build tools version>" // default: "25.0.2"
    targetSdkVersion = "<Your target SDK version>" // default: 22
  }
...
  • in android/app/build.gradle:
dependencies {
    ...
    compile "com.facebook.react:react-native:+"  // From node_modules
+   compile project(':react-native-flipboard-flex')
}
  • in android/settings.gradle:
...
include ':app'
+ include ':react-native-flipboard-flex'
+ project(':react-native-flipboard-flex').projectDir = new File(rootProject.projectDir, '{node_modules_path}/react-native-flipboard-flex/android')

Where {node_modules_path} is the path where you have the node_modules, ussually one level up.

With React Native 0.29+

  • in MainApplication.java:
+ import com.fjtrujy.flex;

  public class MainApplication extends Application implements ReactApplication {
    //......

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
+         new RNFlipboardFlexPackage(),
          new MainReactPackage()
      );
    }

    ......
  }

With older versions of React Native:

  • in MainActivity.java:
+ import com.fjtrujy.flex;

  public class MainActivity extends ReactActivity {
    ......

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
+       new RNFlipboardFlexPackage(),
        new MainReactPackage()
      );
    }
  }

Usage

var RNFlipboardFlex = require('react-native-flipboard-flex');
// or import RNFlipboardFlex from 'react-native-flipboard-flex';

API

MethodReturn TypeiOSAndroidSince
showExplorer()void1.0.0
hideExplorer()void1.0.3
toggleExplorer()void1.0.3

showExplorer()

Show Flex explorer.

Examples

RNFlipboardFlex.showExplorer();

// iOS: Will Show the flex explorer
// Android: Will do nothing

hideExplorer()

Hide Flex explorer.

Examples

RNFlipboardFlex.hideExplorer();

// iOS: Will hide the flex explorer
// Android: Will do nothing

toggleExplorer()

Will Show Flex explorer if it is hidden and will hide the exploer if it is shown.

Examples

RNFlipboardFlex.toggleExplorer();

// iOS: Will toggle the flex explorer
// Android: Will do nothing

Notes

See Flex github


Release Notes

See the CHANGELOG.md.

react-native-web

This library was made compatible with react-native-web by providing an empty polyfill in order to avoid breaking builds.