罗广聪

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'
... ...
... ... @@ -37,6 +37,7 @@
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
D518858029F94685B8F3788F /* libRCTContacts.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F79F4C34D704A9EB2F130BA /* libRCTContacts.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
... ... @@ -222,6 +223,13 @@
remoteGlobalIDString = ADD01A681E09402E00F6D226;
remoteInfo = "RCTBlob-tvOS";
};
74D570A51F7E514F0073FEC9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D84D6CF8E76C444488A4BF29 /* RCTContacts.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1441618E1BD0A79300FA4F59;
remoteInfo = RCTContacts;
};
74DC15AE1F68D7360055FE42 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
... ... @@ -295,10 +303,12 @@
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* ProtectGod-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ProtectGod-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* ProtectGod-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ProtectGod-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
2F79F4C34D704A9EB2F130BA /* libRCTContacts.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTContacts.a; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
D84D6CF8E76C444488A4BF29 /* RCTContacts.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTContacts.xcodeproj; path = "../node_modules/react-native-contacts/ios/RCTContacts.xcodeproj"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
... ... @@ -327,6 +337,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
D518858029F94685B8F3788F /* libRCTContacts.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
... ... @@ -474,6 +485,22 @@
name = Products;
sourceTree = "<group>";
};
74D570821F7E514A0073FEC9 /* Recovered References */ = {
isa = PBXGroup;
children = (
2F79F4C34D704A9EB2F130BA /* libRCTContacts.a */,
);
name = "Recovered References";
sourceTree = "<group>";
};
74D570A21F7E514E0073FEC9 /* Products */ = {
isa = PBXGroup;
children = (
74D570A61F7E514F0073FEC9 /* libRCTContacts.a */,
);
name = Products;
sourceTree = "<group>";
};
78C398B11ACF4ADC00677621 /* Products */ = {
isa = PBXGroup;
children = (
... ... @@ -498,6 +525,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
D84D6CF8E76C444488A4BF29 /* RCTContacts.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
... ... @@ -518,6 +546,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* ProtectGodTests */,
83CBBA001A601CBA00E9B192 /* Products */,
74D570821F7E514A0073FEC9 /* Recovered References */,
);
indentWidth = 2;
sourceTree = "<group>";
... ... @@ -625,7 +654,7 @@
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastUpgradeCheck = 610;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
... ... @@ -673,6 +702,10 @@
ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
},
{
ProductGroup = 74D570A21F7E514E0073FEC9 /* Products */;
ProjectRef = D84D6CF8E76C444488A4BF29 /* RCTContacts.xcodeproj */;
},
{
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
},
... ... @@ -888,6 +921,13 @@
remoteRef = 74236DA61F62392F002577D2 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
74D570A61F7E514F0073FEC9 /* libRCTContacts.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTContacts.a;
remoteRef = 74D570A51F7E514F0073FEC9 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
74DC15AF1F68D7360055FE42 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
... ... @@ -1076,9 +1116,17 @@
"DEBUG=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = ProtectGodTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
... ... @@ -1094,9 +1142,17 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = S8LRX49C78;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = ProtectGodTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
... ... @@ -1115,6 +1171,10 @@
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = S8LRX49C78;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = ProtectGod/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
... ... @@ -1138,6 +1198,10 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S8LRX49C78;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = ProtectGod/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
... ... @@ -1165,8 +1229,16 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = "ProtectGod-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
... ... @@ -1191,8 +1263,16 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_NO_COMMON_BLOCKS = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
);
INFOPLIST_FILE = "ProtectGod-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
... ... @@ -1218,6 +1298,10 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "ProtectGod-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ProtectGod-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
... ... @@ -1239,6 +1323,10 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "ProtectGod-tvOSTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ProtectGod-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
... ...
... ... @@ -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"
... ...