Skip to content

Commit c7c4c6d

Browse files
Merge pull request #60 from Detaysoft/next
Next version v10.0.0 React Native Feature 🎉
2 parents 57ba36a + 862d50a commit c7c4c6d

69 files changed

Lines changed: 3900 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"presets": ["es2015", "react"],
2+
"presets": ["es2015", "react", "react-native"],
33
"plugins": ["transform-remove-strict-mode"]
4-
}
4+
}

.gitignore

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,52 @@ coverage
1010
npm-debug.log*
1111
yarn-debug.log*
1212
yarn-error.log*
13-
dist
13+
dist
14+
15+
# -------- React Native -------- #
16+
17+
# Xcode
18+
#
19+
build/
20+
*.pbxuser
21+
!default.pbxuser
22+
*.mode1v3
23+
!default.mode1v3
24+
*.mode2v3
25+
!default.mode2v3
26+
*.perspectivev3
27+
!default.perspectivev3
28+
xcuserdata
29+
*.xccheckout
30+
*.moved-aside
31+
DerivedData
32+
*.hmap
33+
*.ipa
34+
*.xcuserstate
35+
project.xcworkspace
36+
37+
# Android/IntelliJ
38+
#
39+
build/
40+
.idea
41+
.gradle
42+
local.properties
43+
*.iml
44+
45+
# BUCK
46+
buck-out/
47+
\.buckd/
48+
*.keystore
49+
50+
# fastlane
51+
#
52+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
53+
# screenshots whenever they are needed.
54+
# For more information about the recommended setup visit:
55+
# https://docs.fastlane.tools/best-practices/source-control/
56+
57+
*/fastlane/report.xml
58+
*/fastlane/Preview.html
59+
*/fastlane/screenshots
60+
61+
# -------- React Native -------- #

.npmignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@ coverage
99
.env
1010
npm-debug.log*
1111
yarn-debug.log*
12-
yarn-error.log*
12+
yarn-error.log*
13+
14+
# react-native
15+
/ios
16+
/android
17+
18+
# examples
19+
/example
20+
/example-native
21+

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,45 @@ Reactjs chat elements
44
## Install
55

66
```
7-
npm install react-chat-elements@latest --save
7+
npm install react-chat-elements --save
88
```
99

10+
### For React Native
11+
Step 1: Install react-chat-elements
12+
13+
```
14+
npm install react-chat-elements --save
15+
```
16+
17+
If you have already installed react-native-vector-icons as a dependency for your project you can skip this step. Otherwise run the following command:
18+
19+
Step 2: Install react-native-vector-icons
20+
21+
```
22+
npm i --save react-native-vector-icons
23+
```
24+
25+
**Link:**
26+
27+
```
28+
react-native link react-native-vector-icons
29+
```
30+
31+
*If you have any issues installing react-native-vector-icons, check out their installation guide [here](https://github.com/oblador/react-native-vector-icons#installation).*
1032

1133
### Imports
1234
```javascript
1335
// RCE CSS
1436
import 'react-chat-elements/dist/main.css';
1537
// MessageBox component
16-
import {MessageBox} from 'react-chat-elements';
38+
import { MessageBox } from 'react-chat-elements';
1739
```
1840

41+
#### React Native
42+
```javascript
43+
// MessageBox component
44+
import { MessageBox } from 'react-chat-elements/native';
45+
```
1946

2047
## Components
2148
1. [ChatItem](#chatitem-component)

android/app/BUCK

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
lib_deps = []
12+
13+
for jarfile in glob(['libs/*.jar']):
14+
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15+
lib_deps.append(':' + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)
20+
21+
for aarfile in glob(['libs/*.aar']):
22+
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23+
lib_deps.append(':' + name)
24+
android_prebuilt_aar(
25+
name = name,
26+
aar = aarfile,
27+
)
28+
29+
android_library(
30+
name = "all-libs",
31+
exported_deps = lib_deps,
32+
)
33+
34+
android_library(
35+
name = "app-code",
36+
srcs = glob([
37+
"src/main/java/**/*.java",
38+
]),
39+
deps = [
40+
":all-libs",
41+
":build_config",
42+
":res",
43+
],
44+
)
45+
46+
android_build_config(
47+
name = "build_config",
48+
package = "com.example",
49+
)
50+
51+
android_resource(
52+
name = "res",
53+
package = "com.example",
54+
res = "src/main/res",
55+
)
56+
57+
android_binary(
58+
name = "app",
59+
keystore = "//android/keystores:debug",
60+
manifest = "src/main/AndroidManifest.xml",
61+
package_type = "debug",
62+
deps = [
63+
":app-code",
64+
],
65+
)

android/app/build.gradle

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
apply plugin: "com.android.application"
2+
3+
import com.android.build.OutputFile
4+
5+
/**
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
8+
* These basically call `react-native bundle` with the correct arguments during the Android build
9+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+
* bundle directly from the development server. Below you can see all the possible configurations
11+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
13+
*
14+
* project.ext.react = [
15+
* // the name of the generated asset file containing your JS bundle
16+
* bundleAssetName: "index.android.bundle",
17+
*
18+
* // the entry file for bundle generation
19+
* entryFile: "index.android.js",
20+
*
21+
* // whether to bundle JS and assets in debug mode
22+
* bundleInDebug: false,
23+
*
24+
* // whether to bundle JS and assets in release mode
25+
* bundleInRelease: true,
26+
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property can be in the following formats
30+
* // 'bundleIn${productFlavor}${buildType}'
31+
* // 'bundleIn${buildType}'
32+
* // bundleInFreeDebug: true,
33+
* // bundleInPaidRelease: true,
34+
* // bundleInBeta: true,
35+
*
36+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
37+
* // for example: to disable dev mode in the staging build type (if configured)
38+
* devDisabledInStaging: true,
39+
* // The configuration property can be in the following formats
40+
* // 'devDisabledIn${productFlavor}${buildType}'
41+
* // 'devDisabledIn${buildType}'
42+
*
43+
* // the root of your project, i.e. where "package.json" lives
44+
* root: "../../",
45+
*
46+
* // where to put the JS bundle asset in debug mode
47+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48+
*
49+
* // where to put the JS bundle asset in release mode
50+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51+
*
52+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
53+
* // require('./image.png')), in debug mode
54+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55+
*
56+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
57+
* // require('./image.png')), in release mode
58+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59+
*
60+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
63+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64+
* // for example, you might want to remove it from here.
65+
* inputExcludes: ["android/**", "ios/**"],
66+
*
67+
* // override which node gets called and with what additional arguments
68+
* nodeExecutableAndArgs: ["node"],
69+
*
70+
* // supply additional arguments to the packager
71+
* extraPackagerArgs: []
72+
* ]
73+
*/
74+
75+
project.ext.react = [
76+
entryFile: "index.js"
77+
]
78+
79+
apply from: "../../node_modules/react-native/react.gradle"
80+
81+
/**
82+
* Set this to true to create two separate APKs instead of one:
83+
* - An APK that only works on ARM devices
84+
* - An APK that only works on x86 devices
85+
* The advantage is the size of the APK is reduced by about 4MB.
86+
* Upload all the APKs to the Play Store and people will download
87+
* the correct one based on the CPU architecture of their device.
88+
*/
89+
def enableSeparateBuildPerCPUArchitecture = false
90+
91+
/**
92+
* Run Proguard to shrink the Java bytecode in release builds.
93+
*/
94+
def enableProguardInReleaseBuilds = false
95+
96+
android {
97+
compileSdkVersion 23
98+
buildToolsVersion "23.0.1"
99+
100+
defaultConfig {
101+
applicationId "com.example"
102+
minSdkVersion 16
103+
targetSdkVersion 22
104+
versionCode 1
105+
versionName "1.0"
106+
ndk {
107+
abiFilters "armeabi-v7a", "x86"
108+
}
109+
}
110+
splits {
111+
abi {
112+
reset()
113+
enable enableSeparateBuildPerCPUArchitecture
114+
universalApk false // If true, also generate a universal APK
115+
include "armeabi-v7a", "x86"
116+
}
117+
}
118+
buildTypes {
119+
release {
120+
minifyEnabled enableProguardInReleaseBuilds
121+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122+
}
123+
}
124+
// applicationVariants are e.g. debug, release
125+
applicationVariants.all { variant ->
126+
variant.outputs.each { output ->
127+
// For each separate APK per architecture, set a unique version code as described here:
128+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129+
def versionCodes = ["armeabi-v7a":1, "x86":2]
130+
def abi = output.getFilter(OutputFile.ABI)
131+
if (abi != null) { // null for the universal-debug, universal-release variants
132+
output.versionCodeOverride =
133+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134+
}
135+
}
136+
}
137+
}
138+
139+
dependencies {
140+
compile project(':react-native-vector-icons')
141+
compile fileTree(dir: "libs", include: ["*.jar"])
142+
compile "com.android.support:appcompat-v7:23.0.1"
143+
compile "com.facebook.react:react-native:+" // From node_modules
144+
}
145+
146+
// Run this once to be able to run the application with BUCK
147+
// puts all compile dependencies into folder libs for BUCK to use
148+
task copyDownloadableDepsToLibs(type: Copy) {
149+
from configurations.compile
150+
into 'libs'
151+
}

0 commit comments

Comments
 (0)