Mobile apps with HTML, CSS & JS Target multiple platforms with one code base Free and open source


웹 베이스로 하이브리드 앱을 만들기 위한 프레임워크 중 하나로 Apache Software Foundation 에서 만들고 있다. 라이센스는 당연히 Apache License, Version 2.0.

 

요즘 계속 Native만 작업했는데, 오랜만에 이런 하이브리드 환경을 접하게 되었다. 

잘해보자구! 

 

 

Apache Cordova

Supported Platforms See a list of features supported in each platform Cordova wraps your HTML/JavaScript app into a native container which can access the device functions of several platforms. These functions are exposed via a unified JavaScript API, allow

cordova.apache.org

 

반응형

 

Warning: Async Storage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. See https://github.com/react-native-community/react-native-async-storage

1. npm install  

npm install @react-native-community_async-storage -save

2. react-native link 

react-native link @react-native-community_async-storage

 3. In android/app/build.gradle add to dependencies:

implementation project(':@react-native-community_async-storage')

 

> Task :app:compileDebugJavaWithJavac FAILED
MainApplication.java:6: error: package com.reactnativecommunity.asyncstorage does not exist
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
                                            ^
MainApplication.java:37: error: cannot find symbol
            new AsyncStoragePackage(),
                ^
  symbol: class AsyncStoragePackage

 

 

https://github.com/react-native-community/react-native-async-storage

 

react-native-community/react-native-async-storage

An asynchronous, persistent, key-value storage system for React Native. - react-native-community/react-native-async-storage

github.com

 

 

 

반응형

FileCache cache1 = ImagePipelineFactory.getInstance().getMainDiskStorageCache();   FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageDiskStorageCache();

 

solution:
【L69】FileCache cache1 = ImagePipelineFactory.getInstance().getMainFileCache();
【L80】FileCache cache2 = ImagePipelineFactory.getInstance().getSmallImageFileCache();

 

https://github.com/reactnativecn/react-native-http-cache/issues/23

 

Throwing error cannot find symbol method getMainDiskStorageCache() on building · Issue #23 · reactnativecn/react-native-http-cac

I followed the doc and added react-native-http-cache to my project, but on building the app I am getting the following error /Users/sooraj/test/node_modules/react-native-http-cache/android/src/main...

github.com

 

반응형

Installation

npm install --save react-native-device-info

Linking

react-native link react-native-device-info

 

 

 

 

 

https://www.npmjs.com/package/react-native-device-info

 

react-native-device-info

Get device information using react-native

www.npmjs.com

 

 

 

 

반응형

Warning: NetInfo has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. See https://github.com/react-native-community/react-native-netinfo

 

npm install --save @react-native-community/netinfo

react-native link @react-native-community/netinfo

 

https://github.com/react-native-community/react-native-netinfo

반응형

#Android & Chrome

소스적용 : MainApplication.java

 

 

 

 

 

 

import android.webkit.WebView;

@Override public void onCreate() { 
   super.onCreate();   
   WebView.setWebContentsDebuggingEnabled(true); 
}

 

확인 : chrome://inspect/#devices 

 

 

 

 

 

 

 

https://github.com/react-native-community/react-native-webview/blob/master/docs/Debugging.md

 

react-native-community/react-native-webview

React Native Cross-Platform WebView. Contribute to react-native-community/react-native-webview development by creating an account on GitHub.

github.com

 #WebView.setWebContentsDebuggingEnabled(true);

반응형

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

=> MainApplication.java

from : import com.philipphecht.RNDocViewerPackage;

To: import com.reactlibrary.RNReactNativeDocViewerPackage;

 

from :  new RNDocViewerPackage()

to : new RNReactNativeDocViewerPackage()

 

반응형

처음 호출한 URL에서 다시 Redirect하는 경우에, 사용하면 navState를 정확히 파악할 수 있다. 

=> BackHandler 사용 시, canGoBack의 결과에 따라 앱을 종료하는 로직을 사용할 수 있음. 

 

onShouldStartLoadWithRequest

Function that allows custom handling of any web view requests. Return true from the function to continue loading the request and false to stop loading.

On Android, is not called on the first load.

TypeRequired

function No

Example:

<WebView source={{ uri: 'https://facebook.github.io/react-native' }} onShouldStartLoadWithRequest={request => { // Only allow navigating within this website return request.url.startsWith('https://facebook.github.io/react-native'); }} />

The request object includes these properties:

title url loading target canGoBack canGoForward lockIdentifier navigationType

반응형
반응형

 

':app@debug/compileClasspath': Could not resolve project :react-native-gesture-handler.

 

STEP1) npm install --save react-native-gesture-handler

STEP2) react-native link react-native-gesture-handler
info iOS module "react-native-gesture-handler" is already linked
info Android module "react-native-gesture-handler" is already linked

https://reactnavigation.org/docs/en/getting-started.html#installation

 

React Navigation · Routing and navigation for your React Native apps

Routing and navigation for your React Native apps

reactnavigation.org

 

 

반응형

"RNCWebView" was not found in the UIManger.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

step1. $ react-native link react-native-webview

step2. Android - react-native-webview version >=6.X.X: Please make sure AndroidX is enabled in your project by editting android/gradle.properties and adding 2 lines:

android.useAndroidX=true

android.enableJetifier=true

https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md

 

STEP3) error: package android.support.v4.util does not exist 

(https://github.com/react-native-community/react-native-webview/issues/580

3-1) react-native install react-native-webview@5.8.1

반응형
반응형

이슈 : NPM START 했을때 발생

원인 :  8081 PORT를 사용하는데, 해당포트가 이미 iis에 다른 서비스로 할당되어 있어서 접근 거부가 되었던 것.

해결 : 기존 iis에 설정해둔 포트를 다른 포트로 할당하고, 다시 실행. 

=>실행 잘된다! 

반응형

'Mobile > ReactNative' 카테고리의 다른 글

[RN] Invariant Violation: requireNativeComponents:  (0) 2019.05.22
[RN] React-Native Start : 1  (0) 2019.05.21
[ERROR] Unable to resolve "react-navigation" from "App.js"  (0) 2019.03.29
React build  (0) 2019.03.06
React Native (1)  (0) 2019.02.26
반응형

'Mobile > ReactNative' 카테고리의 다른 글

[RN] React-Native Start : 1  (0) 2019.05.21
[RN] Error: listen EACCES: permission denied 0.0.0.0:8081  (0) 2019.05.21
React build  (0) 2019.03.06
React Native (1)  (0) 2019.02.26
React 개발환경 구축  (0) 2019.02.25

Error: node_modules directory is missing. Please run `npm install` in your project directory.

Couldn't start project. Please fix the errors and restart the project.



반응형

'Mobile > ReactNative' 카테고리의 다른 글

[RN] Error: listen EACCES: permission denied 0.0.0.0:8081  (0) 2019.05.21
[ERROR] Unable to resolve "react-navigation" from "App.js"  (0) 2019.03.29
React Native (1)  (0) 2019.02.26
React 개발환경 구축  (0) 2019.02.25
Flutter Framework  (0) 2019.02.14

+ Recent posts