npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rn-photo-upload-page

v0.4.4-o2o

Published

React Native FullScreen api and Photo Upload Component

Downloads

8

Readme

Android Installation

Install the npm package rn-photo-upload-page.

npm install --save rn-photo-upload-page

In android/settings.gradle, remove the line include ':app' and add the following lines

include ':rn-photo-upload-page'
project(':rn-photo-upload-page').projectDir = file('../node_modules/rn-photo-upload-page/android')

NOTE : If you have included other libraries in your project, the include line will contain the other dependencies too.

In android/app/build.gradle, add a dependency to ':rn-photo-upload-page'

dependencies {
    compile project(':rn-photo-upload-page')
}

Next, you need to change the MainApplication of your app to register FullScreenPackage :

import com.rn.photo.upload.page.FullScreenPackage; // add this import

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

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new FullScreenPackage() // add this manager
      );
    }

Next, you need to add the MainActivity of your app to register LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :

import android.view.WindowManager;
import android.os.Build;
import android.os.Bundle;

public class MainActivity extends ReactActivity {
    //...

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
          WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
          layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
          getWindow().setAttributes(layoutParams);
        }
        super.onCreate(savedInstanceState);
    }
    

Next, you need to add the these to your own component :

import PhotoUpload  from 'rn-photo-upload-page';

 //...

  return (
    <...>
      <PhotoUpload token={yourToken} instructions={yourTokenText} style={yourOwnStyle} />
    <...>
  )

Next, don't forget to add this to your build.gradle dependency to make sure the gif image work correctly:

  dependencies {
    // For animated GIF support
    implementation 'com.facebook.fresco:animated-gif:0.11.0'
    // For RN >= 0.60
    implementation 'com.facebook.fresco:fresco:2.0.0'
    implementation 'com.facebook.fresco:animated-gif:2.0.0'
  }

Next, don't forget to add this to your AndroidManifest.xml, to make sure you can restore to previous brightness:

  <uses-permission android:name="android.permission.WRITE_SETTINGS" />

Next, if have an issues on dependencies, you need to add this to your build.gradle, setting.gradle, MainApplication.java dependency :

  dependencies {
    implementation project(':react-native-device-info')
    // implementation project(':KeepScreenOn')
    implementation project(':react-native-system-setting')
  }
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
// include ':KeepScreenOn'
// project(':KeepScreenOn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-screen-on/android')
include ':react-native-system-setting'
project(':react-native-system-setting').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-system-setting/android')
import com.learnium.RNDeviceInfo.RNDeviceInfo;
// import com.gijoehosaphat.keepscreenon.KeepScreenOnPackage;
import com.ninty.system.setting.SystemSettingPackage;

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

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      packages.add(new RNDeviceInfo());
      // packages.add(new KeepScreenOnPackage());
      packages.add(new SystemSettingPackage());
      
      return packages;
    }

If there is any error, please take a look at these dependencies below :

    "react-native-qrcode-svg",
    "react-native-svg",
    "react-native-device-info",
    "react-native-system-setting",
    "react-native-keep-screen-on"

Version below < 0.60, need to run react-native link <package>. For version above >= 0.60, if still got an error, you can run react-native link <package> or do manual linking based on those package npm/github documentation.

For iOS you only need to wrap your own component using View instead of SafeAreaView.