Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NFT
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hanfeng zhang
NFT
Commits
fad87138
Commit
fad87138
authored
Jul 27, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打包设置
parent
e858e003
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
8 deletions
+40
-8
App.js
App.js
+3
-7
README.md
README.md
+16
-0
build.gradle
android/app/build.gradle
+10
-1
AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+1
-0
gradle.properties
android/gradle.properties
+5
-0
package.json
package.json
+5
-0
iconfont.ttf
src/assets/fonts/iconfont.ttf
+0
-0
No files found.
App.js
View file @
fad87138
...
...
@@ -41,11 +41,7 @@ class App extends Component {
// 交互传值
handleInjectJavascript
=
(
data
)
=>
{
console
.
log
(
'send message: '
,
data
)
// const injectJavascriptStr = `(function() {
// window.WebViewBridge.onMessage(${JSON.stringify('hello,vue2!!! ')});
// })()`;
// this.webView.injectJavaScript(injectJavascriptStr);
console
.
log
(
'send message: '
,
data
)
const
injectJavascriptStr
=
`(function() {
window.WebViewBridge.onMessage(
${
JSON
.
stringify
(
data
)}
);
})()`
;
// 拼接 数据 为 方法
...
...
@@ -116,8 +112,8 @@ class App extends Component {
// 加载时强制使用loading转圈视图,注意如果为true,在低性能下,webview可能会加载失败,显示为空白
startInLoadingState
=
{
false
}
// webview加载错误页面
// source={ {uri: 'http://www.baidu.com/'}
} // 网络路径
source
=
{
{
uri
:
'http://192.168.1.60:1200'
}
}
//本地路径
source
=
{{
uri
:
'http://47.114.159.142:8983'
}
}
// 网络路径
// source={{uri: 'http://192.168.1.60:1200'}
} //本地路径
/
>
{
this
.
state
.
show
?
(
...
...
README.md
View file @
fad87138
# template
## 项目安装
需要 react-natvie 环境,
[
环境配置
](
https://reactnative.cn/docs/environment-setup
)
, 完成后执行
```
yarn
```
...
...
@@ -38,6 +39,21 @@ function onMessage() {
// code...
}
```
### 安卓打包
android 文件下设置 local.properties 文件, 内容如下, sdk.dir 为 sdk 文件位置
```
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C\:\\Users\\33\\AppData\\Local\\Android\\Sdk
```
打包主要流程见
[
react-native 安卓打包
](
https://reactnative.cn/docs/signed-apk-android
)
### 相机文档
[
react-native-camera
](
https://react-native-camera.github.io/react-native-camera/docs/api
)
...
...
android/app/build.gradle
View file @
fad87138
...
...
@@ -153,6 +153,14 @@ android {
keyAlias
'androiddebugkey'
keyPassword
'android'
}
release
{
if
(
project
.
hasProperty
(
'MYAPP_RELEASE_STORE_FILE'
))
{
storeFile
file
(
MYAPP_RELEASE_STORE_FILE
)
storePassword
MYAPP_RELEASE_STORE_PASSWORD
keyAlias
MYAPP_RELEASE_KEY_ALIAS
keyPassword
MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes
{
debug
{
...
...
@@ -161,7 +169,8 @@ android {
release
{
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig
signingConfigs
.
debug
// signingConfig signingConfigs.debug
signingConfig
signingConfigs
.
release
minifyEnabled
enableProguardInReleaseBuilds
proguardFiles
getDefaultProguardFile
(
"proguard-android.txt"
),
"proguard-rules.pro"
}
...
...
android/app/src/main/AndroidManifest.xml
View file @
fad87138
...
...
@@ -9,6 +9,7 @@
<application
android:name=
".MainApplication"
android:usesCleartextTraffic=
"true"
android:label=
"@string/app_name"
android:icon=
"@mipmap/ic_launcher"
android:roundIcon=
"@mipmap/ic_launcher_round"
...
...
android/gradle.properties
View file @
fad87138
...
...
@@ -26,3 +26,8 @@ android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION
=
0.75.1
MYAPP_RELEASE_STORE_FILE
=
my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS
=
my-key-alias
MYAPP_RELEASE_STORE_PASSWORD
=
testnft
MYAPP_RELEASE_KEY_PASSWORD
=
testnft
package.json
View file @
fad87138
...
...
@@ -27,5 +27,10 @@
},
"jest"
:
{
"preset"
:
"react-native"
},
"rnpm"
:
{
"assets"
:
[
"./src/assets/fonts/"
]
}
}
src/assets/fonts/iconfont.ttf
0 → 100644
View file @
fad87138
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment