罗广聪

contact 可读取电话了

... ... @@ -133,6 +133,7 @@ android {
}
dependencies {
compile project(':react-native-contacts')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
... ...
... ... @@ -3,6 +3,7 @@ package com.protectgod;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
... ... @@ -22,7 +23,8 @@ public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new ReactNativeContacts()
);
}
};
... ...
rootProject.name = 'ProtectGod'
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':app'
... ...
This diff is collapsed. Click to expand it.
... ... @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSContactsUsageDescription</key>
<string>是否允许访问通信录</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
... ... @@ -51,5 +53,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>LSApplicationCategoryType</key>
<string></string>
</dict>
</plist>
... ...
... ... @@ -9,6 +9,7 @@
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.48.1",
"react-native-contacts": "^1.0.2",
"react-native-easy-grid": "^0.1.15",
"react-native-swiper": "^1.5.11",
"react-navigation": "^1.0.0-beta.11"
... ...
... ... @@ -14,6 +14,7 @@ import {
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import post from "../../utils/fetch";
import Contacts from 'react-native-contacts';
export default class Customer extends Component {
constructor(props) {
... ... @@ -43,6 +44,7 @@ export default class Customer extends Component {
}
]
};
this.getAllPhone = this.getAllPhone.bind(this);
}
componentWillMount() {
this.getAsyncStorage();
... ... @@ -63,16 +65,17 @@ export default class Customer extends Component {
phones.push(phone.number);
});
});
post(
"/spreader/rank/friends/contact",
{ contact: phones },
res => {
this.getRankData();
},
resErr => {
Toast.show(resErr.cnmsg, Toast.error);
}
);
console.log("通信录",phones)
// post(
// "/spreader/rank/friends/contact",
// { contact: phones },
// res => {
// this.getRankData();
// },
// resErr => {
// Toast.show(resErr.cnmsg, Toast.error);
// }
// );
}
});
}
... ... @@ -124,6 +127,7 @@ export default class Customer extends Component {
} else {
{
/* navigate("CustomerEdit"); */
this.getAllPhone()
}
}
}}
... ...
... ... @@ -3548,6 +3548,10 @@ react-devtools-core@^2.5.0:
shell-quote "^1.6.1"
ws "^2.0.3"
react-native-contacts@^1.0.2:
version "1.0.2"
resolved "http://registry.npm.taobao.org/react-native-contacts/download/react-native-contacts-1.0.2.tgz#58b3b0572e3972a320c731ff639091b013a3c4b0"
react-native-dismiss-keyboard@1.0.0:
version "1.0.0"
resolved "http://registry.npm.taobao.org/react-native-dismiss-keyboard/download/react-native-dismiss-keyboard-1.0.0.tgz#32886242b3f2317e121f3aeb9b0a585e2b879b49"
... ...