Skip to content

SampleApp: Defining all configuration specific in app.plist to not having to modify AppDelegate.m - #2101

Closed
gre wants to merge 1 commit into
react:masterfrom
gre:master
Closed

gre wants to merge 1 commit into
react:masterfrom
gre:master

Conversation

@gre

@gre gre commented Jul 23, 2015

Copy link
Copy Markdown
Contributor

I've made some changes in AppDelegate.m so it uses a app.plist that contains all your app specific configuration and in order to not have to change any line of Objective-C.

and here is the default app.plist:

screen shot 2015-07-23 at 17 15 46

This also allow to set the initialProps that are passed to the Root component in order to inject some custom settings (that are specific for each dev working on an App), for instance the URL of your app API:

class Root extends Component {
  render () {
    const {
      apiURL
    } = this.props;
    return <App baseURL={apiURL} />;
  }
}

also I've created a "devServer" field where user can set it's react-native server URL, and if not provided it will fallback on the bundled JS.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 23, 2015
@gre gre closed this Jul 28, 2015
@gre gre reopened this Jul 28, 2015
@jsierles

Copy link
Copy Markdown
Contributor

This looks good! Might be useful to merge with the work being done in #1546

@chirag04

chirag04 commented Dec 3, 2015

Copy link
Copy Markdown
Contributor

closing for now because sampleApp is removed from master

@chirag04 chirag04 closed this Dec 3, 2015
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@gre updated the pull request.

@gre

gre commented Dec 3, 2015

Copy link
Copy Markdown
Contributor Author

@chirag04 where is it gone? I guess a bootstrapped project could benefit from this idea of having config file. Anyway, I'm leaving this to someone else, I got it working for my project, if someone want to push this idea again, feel free :)

@satya164

satya164 commented Dec 4, 2015

Copy link
Copy Markdown
Contributor

FalseLobster added a commit to FalseLobster/react-native that referenced this pull request Jul 3, 2024
## Summary:

main targeted PR of react#2100 

Prior to 0.73, the new `role` prop was remapped to `accessibilityRole`
on the JS-side. Starting with react#37304, the work needs to be completed on
the native side. Since the new prop is ARIA inspired, the mappings are
taking from the [ARIA Core
AAM](https://www.w3.org/TR/core-aam-1.2/#mapping_role_table) which
disagrees with some of the mappings used in the old `accessibilityRole`
prop. Users of the old prop are unaffected, but the new prop will take
the mappings from the spec.

## Test Plan:

Tested a variety of permutations of accessibilityRole and role to
confirm the behavior looks correct in Accessibility Inspector
meta-codesync Bot pushed a commit that referenced this pull request Dec 3, 2026
Summary:
* Count the sizes nested boxes state in automatic minimum sizes

Why
===
With automatic minimum sizes on (`YGErrataMinSizeUndefinedInsteadOfAuto` off), a flex item does not shrink below its min-content size (css-flexbox-1 §4.5). That size is built from its children's min-content contributions (css-sizing-3 §5.2), and a child that states a size contributes that size. Yoga's min-content walk reads only content (measure functions, padding, border, margins) and ignores `width`, `height`, `min-*`, `max-*` and `aspect-ratio` on everything below the item:

```html
<div style="display: flex; width: 200px">
  <div style="display: flex; flex-shrink: 1">     <!-- Chrome: 100px. Yoga: 20px -->
    <div style="width: 100px; height: 10px; flex-shrink: 0"></div>
  </div>
  <div style="width: 180px; flex-shrink: 0"></div>
</div>
```

How
===
The walk takes each child's min-content contribution along the axis it is asked for:

- the size the child states, with its padding and border for a content-box size;
- otherwise its content's min-content size, as before, or, where larger, the size its aspect ratio transfers from the size it states on the other axis (css-sizing-4);
- clamped to the minimum and maximum it states, and no less than its padding and border (`boundAxis`).

A percentage size, minimum or maximum depends on the size being found, so it behaves as `auto` or as no limit (css-sizing-3 §5.2.1). A child that states its size on an axis is not measured, walked or cloned for that axis. The item's own specified size suggestion is unchanged.

The walk still differs from the specifications or from Chrome in these ways:

- A child's `flex-basis` and flex factors are not read. css-flexbox-1 §9.9.3 caps a flex item's contribution at its flex base size if it cannot grow and floors it there if it cannot shrink, and Chrome counts a definite flex basis for a child that cannot shrink. An item around a `flex: 0 0 70px` child is 70px in Chrome; with this change and without it, the item is the size of the child's content.
- §9.9.3 also takes the larger of a flex item's min-content size and its stated size. The walk takes the stated size, as css-sizing-3 does. For a child that cannot grow, the cap gives the same result (`child_width_smaller_than_content`: 20px in Chrome). Chrome was not checked for a child that can grow.
- A `display: contents` child is still walked, and counted, as a box of its own.
- A percentage padding or margin resolves against the owner's width, as it does elsewhere in the walk. Chrome resolves it against zero for an intrinsic contribution (css-sizing-3 §5.2.1): a content-box child with `width: 30px; padding-left: 10%` contributes 30px in Chrome and 50px under a 200px owner in Yoga. Following Chrome would remove most of the walk's owner-width memo key, so it belongs in a change of its own.
- The aspect-ratio transfer uses the border-box size, also for a content-box child.

`container_min_content_memo_respects_owner_width` relied on a 20px spacer not counting toward its parent's min-content size. The parent now has `max-width: 70px`, which keeps the two probes the test compares apart.

Test Plan
=========
`yarn gentest -f YGAutoMinSizeTest` generates the new fixtures in `YGAutoMinSizeTest.html` from Chrome. `cmake --build tests/build && tests/build/yogatests` passes with them and with the hand-written tests for whether the probe runs and for the memo.

With the change to `CalculateLayout.cpp` reverted, every new test fails. The width or height of the shrinking item, in Chrome and without the change:

| Fixture | Chrome | Without the change |
| --- | --- | --- |
| `counts_child_width` | 100 | 20 |
| `counts_child_height` | 100 | 20 |
| `counts_widest_child_of_column` | 60 | 20 |
| `item_width_larger_than_content` | 30 | 10 |
| `child_width_larger_than_content` | 100 | 20 |
| `child_width_smaller_than_content` | 20 | 10 |
| `child_min_width` | 50 | 20 |
| `child_max_width` | 40 | 20 |
| `child_percent_width` | 30 | 20 |
| `child_content_box_width` | 66 | 20 |
| `child_padding_exceeds_width` | 40 | 20 |
| `child_aspect_ratio` | 60 | 20 |
| `child_aspect_ratio_column` | 60 | 20 |
| `counts_content_of_overflow_hidden_child` | 130 | 60 |

`child_with_stated_size_skips_min_content_probe` sees 2 probes where it expects none, and `stated_size_with_percentage_padding_follows_owner_width` sees 10 and 0 where it expects 50 and 40.

`yarn gentest -h` leaves the tree clean, and `node ./scripts/clang-format.js --check` passes. The generated Java tests were not run, because the Gradle project has no unit-test source set, and neither were the generated JavaScript tests, which need Emscripten.

Changelog:
[General][Fixed] - Fix Yoga's automatic minimum size ignoring the width, height, min/max sizes and aspect ratio of boxes inside a flex item

* Mark percentage padding in a child's min-content contribution

An empty child, or one with a static min-content size, reports a
contribution that does not depend on the owner's width, but boundAxis then
floors it at the child's padding and border. With a percentage padding the
result depends on the owner's width, so the memo of the container around it
has to be keyed on that width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Wearable integration
====================
The wearable UI adapter retains zero automatic minima for unmeasured, untyped app boxes and size-contained boxes, without disabling Yoga's native WSS and measured-text minima. Explicit minima remain authoritative; containment and type-rule changes remap both minimum axes so compatibility defaults do not persist after they stop applying.

Differential Revision: D135304422

Pull Request resolved: #60483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants