Skip to content

Commit 9a55dec

Browse files
author
andy
committed
修复客户反馈自定义视图无法点击的问题;添加dismiss认证页面的接口
1 parent 64e0d84 commit 9a55dec

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

example/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ const customConfigParams = {
141141
};
142142

143143
const customViewParams = [
144-
{customViewName: 'customView1', customViewPoint: [20, 200]},
145-
{customViewName: 'customView2', customViewPoint: [20, 300]},
146-
{customViewName: 'customView3', customViewPoint: [20, 400]},
144+
{customViewName: 'customView1', customViewPoint: [20, 200, 150, 30]},
145+
{customViewName: 'customView2', customViewPoint: [20, 300, 150, 30]},
146+
{customViewName: 'customView3', customViewPoint: [20, 400, 150, 30]},
147147
];
148148

149149
export default class App extends React.Component {

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ export default class JVerification {
122122
if (Platform.OS == 'android') {
123123
JVerificationModule.dismissLoginAuthActivity();
124124
}
125+
else {
126+
JVerificationModule.dismissLoginController();
127+
}
125128
}
126129

127130
/**

ios/RCTJVerificationModule/RCTJVerificationModule.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,26 @@ + (BOOL)requiresMainQueueSetup
196196
dispatch_async(dispatch_get_main_queue(), ^{
197197
[JVERIFICATIONService customUIWithConfig:config customViews:^(UIView *customAreaView) {
198198
for (int i = 0; i < viewParams.count; i++) {
199-
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
200-
RCTRootView *rctView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:viewParams[i][CUSTOM_VIEW_NAME] initialProperties:nil launchOptions:nil];
199+
RCTRootView *rctView;
200+
if (self.bridge) {
201+
rctView = [[RCTRootView alloc] initWithBridge:self.bridge moduleName:viewParams[i][CUSTOM_VIEW_NAME] initialProperties:nil];
202+
}
203+
else {
204+
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
205+
rctView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:viewParams[i][CUSTOM_VIEW_NAME] initialProperties:nil launchOptions:nil];
206+
}
201207
NSArray *point = viewParams[i][CUSTOM_VIEW_POINT];
202208
NSNumber *pointX = point[0];
203209
NSNumber *pointY = point[1];
210+
NSNumber *pointW = point[2];
211+
NSNumber *pointH = point[3];
204212
CGFloat x = [pointX doubleValue];
205213
CGFloat y = [pointY doubleValue];
214+
CGFloat w = [pointW doubleValue];
215+
CGFloat h = [pointH doubleValue];
206216
CGRect customFrame = rctView.frame;
207217
customFrame.origin = CGPointMake(x, y);
218+
customFrame.size = CGSizeMake(w, h);
208219
rctView.frame = customFrame;
209220
[customAreaView addSubview:rctView];
210221
}

0 commit comments

Comments
 (0)