Skip to content

Commit

Permalink
Merge branch 'master' into enhance-swift-package_examples_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lucdion committed Dec 13, 2023
2 parents 22d2e2f + c564935 commit 09b49a5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 21 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/github-actions-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
- run: bundle install
- run: pod install --repo-update

- name: Set Xcode Version 13.2.1
run: sudo xcode-select -s /Applications/Xcode_13.2.1.app

- name: fastlane
run: set -o pipefail && bundle exec fastlane travis

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

# Change Log

## [2.0.03](https://github.com/layoutBox/FlexLayout/releases/tag/2.0.03)
Released on 2023-10-15

#### Fix crashes that occurs when the node's topLeft position is nan

Added by [OhKanghoon](https://github.com/OhKanghoon) in Pull Request [#230](https://github.com/layoutBox/FlexLayout/pull/234)


## [2.0.01](https://github.com/layoutBox/FlexLayout/releases/tag/2.0.01)
Released on 2023-10-01

Expand Down
2 changes: 1 addition & 1 deletion FlexLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |spec|
spec.name = "FlexLayout"
spec.version = "2.0.02"
spec.version = "2.0.03"
spec.summary = "FlexLayout"
spec.homepage = "https://github.com/lucdion/FlexLayout.git"
spec.license = "MIT license"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ Another possible solution:
### layout()
- Applies to: `flex containers`
- Values: `fitContainer` / `adjustWidth` / `adjustHeight`
- Default value: `fitContainer `
- Default value: `fitContainer`

**Method:**

Expand All @@ -419,8 +419,8 @@ The method will layout the flex container's children.
Layout modes:

* **`fitContainer`**: This is the default mode when no parameter is specified. Children are layouted **inside** the container's size (width and height).
* **`adjustHeight `**: In this mode, children are layouted **using only the container's width**. The container's height will be adjusted to fit the flexbox's children
* **`adjustWidth `**: In this mode, children are layouted **using only the container's height**. The container's width will be adjusted to fit the flexbox's children
* **`adjustHeight`**: In this mode, children are layouted **using only the container's width**. The container's height will be adjusted to fit the flexbox's children
* **`adjustWidth`**: In this mode, children are layouted **using only the container's height**. The container's width will be adjusted to fit the flexbox's children

###### Usage examples:
```swift
Expand Down Expand Up @@ -513,7 +513,7 @@ The `justifyContent` property defines the alignment along the main-axis of the c
### alignItems()
- Applies to: `flex containers`
- Values: `stretch` / `start` / `end` / `center` / `baseline`
- Default value: `stretch `
- Default value: `stretch`
- CSS name: `align-items`

**Method:**
Expand Down Expand Up @@ -662,7 +662,7 @@ It specifies the "flex shrink factor", which determines how much the flex item w
<br>

### basis
- Applies to: `flex items `
- Applies to: `flex items`
- Default value: 0
- CSS name: `flex-basis`

Expand Down
27 changes: 16 additions & 11 deletions Sources/YogaKit/YGLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,18 @@ static CGFloat YGRoundPixelValue(CGFloat value) {
return roundf(value * scale) / scale;
}

static CGPoint YGPointReplacingNanWithZero(CGPoint const value) {
CGPoint result = value;

if (isnan(result.x)) {
result.x = 0;
}
if (isnan(result.y)) {
result.y = 0;
}
return result;
}

static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
NSCAssert(
[NSThread isMainThread],
Expand All @@ -529,22 +541,15 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
}

YGNodeRef node = yoga.node;
const CGPoint topLeft = {
const CGPoint topLeft = YGPointReplacingNanWithZero({
YGNodeLayoutGetLeft(node),
YGNodeLayoutGetTop(node),
};
});

CGPoint bottomRight = {
const CGPoint bottomRight = YGPointReplacingNanWithZero({
topLeft.x + YGNodeLayoutGetWidth(node),
topLeft.y + YGNodeLayoutGetHeight(node),
};

if (isnan(bottomRight.x)) {
bottomRight.x = 0;
}
if (isnan(bottomRight.y)) {
bottomRight.y = 0;
}
});

const CGPoint origin = preserveOrigin ? view.frame.origin : CGPointZero;
view.frame = (CGRect){
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ platform :ios do
configuration: "Release",
build: true,
clean: true,
destination: "platform=iOS Simulator,name=iPhone 15,OS=17.0"
destination: "platform=iOS Simulator,name=iPhone 15,OS=17."
)

# FlexLayoutSample from FlexLayout.xcworkspace
Expand Down

0 comments on commit 09b49a5

Please sign in to comment.