(props: Props)
| 338 | private onCloseEndValue: Animated.Value<number> = new Value(0) |
| 339 | |
| 340 | constructor(props: Props) { |
| 341 | super(props) |
| 342 | |
| 343 | this.panRef = props.innerGestureHandlerRefs[0] |
| 344 | this.master = props.innerGestureHandlerRefs[1] |
| 345 | this.tapRef = props.innerGestureHandlerRefs[2] |
| 346 | this.state = BottomSheetBehavior.getDerivedStateFromProps(props, undefined) |
| 347 | |
| 348 | const { snapPoints, init } = this.state |
| 349 | const middlesOfSnapPoints: [ |
| 350 | Animated.Node<number>, |
| 351 | Animated.Node<number> |
| 352 | ][] = [] |
| 353 | |
| 354 | for (let i = 1; i < snapPoints.length; i++) { |
| 355 | const tuple: [Animated.Node<number>, Animated.Node<number>] = [ |
| 356 | add(snapPoints[i - 1], 10), |
| 357 | sub(snapPoints[i], 25), |
| 358 | ] |
| 359 | middlesOfSnapPoints.push(tuple) |
| 360 | } |
| 361 | |
| 362 | const masterOffseted = new Value(init) |
| 363 | // destination point is a approximation of movement if finger released |
| 364 | const tossForMaster = |
| 365 | props.springConfig.hasOwnProperty('toss') && |
| 366 | props.springConfig.toss != undefined |
| 367 | ? props.springConfig.toss |
| 368 | : toss |
| 369 | const destinationPoint = add( |
| 370 | masterOffseted, |
| 371 | multiply(tossForMaster, this.masterVelocity) |
| 372 | ) |
| 373 | |
| 374 | const positive = greaterOrEq( |
| 375 | multiply(tossForMaster, this.masterVelocity), |
| 376 | 0 |
| 377 | ) |
| 378 | // method for generating condition for finding the nearest snap point |
| 379 | const currentSnapPoint = (i = 0): Animated.Node<number> => |
| 380 | i + 1 === snapPoints.length |
| 381 | ? snapPoints[i] |
| 382 | : cond( |
| 383 | positive, |
| 384 | cond( |
| 385 | greaterThan(destinationPoint, middlesOfSnapPoints[i][0]), |
| 386 | cond( |
| 387 | lessThan(destinationPoint, middlesOfSnapPoints[i][1]), |
| 388 | snapPoints[i + 1], |
| 389 | currentSnapPoint(i + 1) |
| 390 | ), |
| 391 | snapPoints[i] |
| 392 | ), |
| 393 | cond( |
| 394 | greaterThan(destinationPoint, middlesOfSnapPoints[i][1]), |
| 395 | cond( |
| 396 | lessThan(destinationPoint, middlesOfSnapPoints[i][0]), |
| 397 | snapPoints[i + 1], |
nothing calls this directly
no test coverage detected